mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 10:54:33 +00:00
Bug 1254275 - Inspect the event queue to find out whether momentum events are following. r=kats
MozReview-Commit-ID: 6k3SaJ6X7Mr --HG-- extra : histedit_source : 1b6842a2cd855dc04b1375c2c0f174005b1e0c75
This commit is contained in:
parent
aa9962666e
commit
0ab404928f
@ -1995,6 +1995,10 @@ nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
|
||||
SetState(NOTHING);
|
||||
RequestContentRepaint();
|
||||
|
||||
if (!aEvent.mFollowedByMomentum) {
|
||||
RequestSnap();
|
||||
}
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
@ -371,6 +371,7 @@ public:
|
||||
mLineOrPageDeltaX(0),
|
||||
mLineOrPageDeltaY(0),
|
||||
mHandledByAPZ(false),
|
||||
mFollowedByMomentum(false),
|
||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
|
||||
{
|
||||
}
|
||||
@ -398,6 +399,10 @@ public:
|
||||
|
||||
bool mHandledByAPZ;
|
||||
|
||||
// true if this is a PANGESTURE_END event that will be followed by a
|
||||
// PANGESTURE_MOMENTUMSTART event.
|
||||
bool mFollowedByMomentum;
|
||||
|
||||
// If this is true, and this event started a new input block that couldn't
|
||||
// find a scrollable target which is scrollable in the horizontal component
|
||||
// of the scroll start direction, then this input block needs to be put on
|
||||
|
@ -4941,6 +4941,20 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
panEvent.mLineOrPageDeltaX = lineOrPageDeltaX;
|
||||
panEvent.mLineOrPageDeltaY = lineOrPageDeltaY;
|
||||
|
||||
if (panEvent.mType == PanGestureInput::PANGESTURE_END) {
|
||||
// Check if there's a momentum start event in the event queue, so that we
|
||||
// can annotate this event.
|
||||
NSEvent* nextWheelEvent =
|
||||
[NSApp nextEventMatchingMask:NSScrollWheelMask
|
||||
untilDate:[NSDate distantPast]
|
||||
inMode:NSDefaultRunLoopMode
|
||||
dequeue:NO];
|
||||
if (nextWheelEvent &&
|
||||
PanGestureTypeForEvent(nextWheelEvent) == PanGestureInput::PANGESTURE_MOMENTUMSTART) {
|
||||
panEvent.mFollowedByMomentum = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool canTriggerSwipe = [self shouldConsiderStartingSwipeFromEvent:theEvent];
|
||||
panEvent.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection = canTriggerSwipe;
|
||||
mGeckoChild->DispatchAPZWheelInputEvent(panEvent, canTriggerSwipe);
|
||||
|
Loading…
x
Reference in New Issue
Block a user