--- 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) {