Revert fd6c7792b048 from bug 673875 for causing bug 907275. r=smichaud, a=bajaj
authorStephen Pohl <spohl.mozilla.bugs@gmail.com>
Wed, 21 Aug 2013 12:21:59 -0400
changeset 153869 7be7bbac0064fe4dea3f0a607b320bd51971460f
parent 153868 f4ed497d794bf8e0daf7ea7024ad06511f455bed
child 153870 e6b7411e9b1f4f1a2f5b5466d91c2ff6f88b5ed9
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud, bajaj
bugs673875, 907275
milestone25.0a2
Revert fd6c7792b048 from bug 673875 for causing bug 907275. r=smichaud, a=bajaj
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -3832,16 +3832,18 @@ NSEvent* gLastDragMouseDownEvent = nil;
   // Send the event.
   mGeckoChild->DispatchWindowEvent(geckoEvent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)beginGestureWithEvent:(NSEvent *)anEvent
 {
+  NS_ASSERTION(mGestureState == eGestureState_None, "mGestureState should be eGestureState_None");
+
   if (!anEvent)
     return;
 
   mGestureState = eGestureState_StartGesture;
   mCumulativeMagnification = 0;
   mCumulativeRotation = 0.0;
 }
 
@@ -4197,17 +4199,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
   if (!(direction & vDirs)) {
     min = (allowedDirections & nsIDOMSimpleGestureEvent::DIRECTION_RIGHT) ?
           -1.0 : 0.0;
     max = (allowedDirections & nsIDOMSimpleGestureEvent::DIRECTION_LEFT) ?
           1.0 : 0.0;
   }
 
   __block BOOL animationCanceled = NO;
-  __block BOOL geckoSwipeEventSent = NO;
   // At this point, anEvent is the first scroll wheel event in a two-finger
   // horizontal gesture that we've decided to treat as a swipe.  When we call
   // [NSEvent trackSwipeEventWithOptions:...], the OS interprets all
   // subsequent scroll wheel events that are part of this gesture as a swipe,
   // and stops sending them to us.  The OS calls the trackingHandler "block"
   // multiple times, asynchronously (sometimes after [NSEvent
   // maybeTrackScrollEventAsSwipe:...] has returned).  The OS determines when
   // the gesture has finished, and whether or not it was "successful" -- this
@@ -4251,30 +4252,29 @@ NSEvent* gLastDragMouseDownEvent = nil;
 
     // Update animation overlay to match gestureAmount.
     [self sendSwipeEvent:anEvent
                 withKind:NS_SIMPLE_GESTURE_SWIPE_UPDATE
        allowedDirections:&allowedDirectionsCopy
                direction:0.0
                    delta:gestureAmount];
 
-    if (phase == NSEventPhaseEnded && !geckoSwipeEventSent) {
+    if (phase == NSEventPhaseEnded) {
       // The result of the swipe is now known, so the main event can be sent.
       // The animation might continue even after this event was sent, so
       // don't tear down the animation overlay yet.
 
       uint32_t directionCopy = direction;
 
       // gestureAmount is documented to be '-1', '0' or '1' when isComplete
       // is TRUE, but the docs don't say anything about its value at other
       // times.  However, tests show that, when phase == NSEventPhaseEnded,
       // gestureAmount is negative when it will be '-1' at isComplete, and
       // positive when it will be '1'.  And phase is never equal to
       // NSEventPhaseEnded when gestureAmount will be '0' at isComplete.
-      geckoSwipeEventSent = YES;
       [self sendSwipeEvent:anEvent
                   withKind:NS_SIMPLE_GESTURE_SWIPE
          allowedDirections:&allowedDirectionsCopy
                  direction:directionCopy
                      delta:0.0];
     }
 
     if (isComplete) {