Bug 1235994 - For wheel events which may have momentum following them, handle scroll snapping in APZ. r=mstange

This commit is contained in:
Kartikaya Gupta 2016-01-07 10:39:46 -05:00
parent 8d6061ac09
commit 872332b3f9
2 changed files with 8 additions and 2 deletions

View File

@ -3167,10 +3167,15 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (pluginFrame) {
MOZ_ASSERT(pluginFrame->WantsToHandleWheelEventAsDefaultAction());
action = WheelPrefs::ACTION_SEND_TO_PLUGIN;
} else if (nsLayoutUtils::IsScrollFrameWithSnapping(frameToScroll)) {
} else if (!wheelEvent->mayHaveMomentum &&
nsLayoutUtils::IsScrollFrameWithSnapping(frameToScroll)) {
// If the target has scroll-snapping points then we want to handle
// the wheel event on the main thread even if we have APZ enabled. Do
// so and let the APZ know that it should ignore this event.
// so and let the APZ know that it should ignore this event. However,
// if the wheel event is synthesized from a Mac trackpad or other device
// that can generate additional momentum events, then we should allow
// APZ to handle it, because it will track the velocity and predicted
// destination from the momentum.
if (wheelEvent->mFlags.mHandledByAPZ) {
wheelEvent->mFlags.mDefaultPrevented = true;
}

View File

@ -1968,6 +1968,7 @@ nsEventStatus AsyncPanZoomController::OnPanMomentumStart(const PanGestureInput&
}
SetState(PAN_MOMENTUM);
RequestSnapToDestination();
// Call into OnPan in order to process any delta included in this event.
OnPan(aEvent, false);