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 148439 782006611b5266cbde8004f22941d84a89f7b1ad
parent 148438 ad1f0ae291d76eee3ee91002c232f213fda5a3f3
child 148440 58c80ab3c0e01a38a0eea3dcd05da6db7c8ca2fe
push id2802
push userryanvm@gmail.com
push dateMon, 26 Aug 2013 14:12:40 +0000
treeherdermozilla-beta@a5c5523c4123 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud, bajaj
bugs673875, 907275
milestone24.0
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
@@ -3547,16 +3547,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;
 }
 
@@ -3912,17 +3914,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
@@ -3966,30 +3967,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) {