mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1254275 - Inspect the event queue to find out whether momentum events are following. r=kats a=ritu
MozReview-Commit-ID: 6k3SaJ6X7Mr
This commit is contained in:
parent
1b1c5c5390
commit
e6453f4c35
@ -1992,6 +1992,10 @@ nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
|
||||
SetState(NOTHING);
|
||||
RequestContentRepaint();
|
||||
|
||||
if (!aEvent.mFollowedByMomentum) {
|
||||
RequestSnap();
|
||||
}
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
@ -358,6 +358,7 @@ public:
|
||||
mLineOrPageDeltaX(0),
|
||||
mLineOrPageDeltaY(0),
|
||||
mHandledByAPZ(false),
|
||||
mFollowedByMomentum(false),
|
||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
|
||||
{
|
||||
}
|
||||
@ -385,6 +386,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
|
||||
|
@ -4963,6 +4963,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…
Reference in New Issue
Block a user