Bug 1749352 - Always call ScrollSnapToDestination from OnPanEnd, and ignore mFollowedByMomentum. r=botond

This patch makes us use the same code path for scroll snapping of
zero-velocity OnPanEnd and followed-by-momentum OnPanEnd.
This is preferable because mFollowedByMomentum is unreliable.

Depends on D135921

Differential Revision: https://phabricator.services.mozilla.com/D135922
This commit is contained in:
Markus Stange 2022-03-03 04:11:15 +00:00
Родитель 3da51fcc14
Коммит 0ce5d3bb24
2 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -2754,10 +2754,7 @@ nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
}
RequestContentRepaint();
if (!aEvent.mFollowedByMomentum) {
ScrollSnap();
}
ScrollSnapToDestination();
return nsEventStatus_eConsumeNoDefault;
}
@ -2771,7 +2768,6 @@ nsEventStatus AsyncPanZoomController::OnPanMomentumStart(
}
SetState(PAN_MOMENTUM);
ScrollSnapToDestination();
// Call into OnPan in order to process any delta included in this event.
OnPan(aEvent, FingersOnTouchpad::No);

Просмотреть файл

@ -66,8 +66,10 @@ TEST_F(APZCSnappingOnMomentumTesterMock, Snap_On_Momentum) {
PanGesture(PanGestureInput::PANGESTURE_END, manager, ScreenIntPoint(50, 80),
ScreenPoint(0, 0), mcc->Time());
// After lifting the fingers, the velocity should still be positive.
EXPECT_GT(apzc->GetVelocityVector().y, 3.0);
// After lifting the fingers, the velocity should be zero and a smooth
// animation should have been triggered for scroll snap.
EXPECT_EQ(apzc->GetVelocityVector().y, 0);
apzc->AssertStateIsSmoothMsdScroll();
mcc->AdvanceByMillis(5);