Bug 1658167. Use AsyncPanZoomController::GetCurrentAnimationDestination in one more place. r=kats

Differential Revision: https://phabricator.services.mozilla.com/D86480
This commit is contained in:
Timothy Nikkel 2020-08-09 21:06:27 +00:00
parent e2d27d8052
commit 6cd64d8551

View File

@ -2415,18 +2415,12 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(
RecordScrollPayload(aEvent.mTimeStamp);
// Perform scroll snapping if appropriate.
CSSPoint startPosition = Metrics().GetScrollOffset();
// If we're already in a wheel scroll or smooth scroll animation,
// the delta is applied to its destination, not to the current
// scroll position. Take this into account when finding a snap point.
if (mState == WHEEL_SCROLL) {
startPosition = mAnimation->AsWheelScrollAnimation()->GetDestination();
} else if (mState == SMOOTH_SCROLL) {
startPosition = mAnimation->AsSmoothScrollAnimation()->GetDestination();
} else if (mState == KEYBOARD_SCROLL) {
startPosition =
mAnimation->AsKeyboardScrollAnimation()->GetDestination();
}
CSSPoint startPosition = GetCurrentAnimationDestination(lock).valueOr(
Metrics().GetScrollOffset());
if (MaybeAdjustDeltaForScrollSnappingOnWheelInput(aEvent, delta,
startPosition)) {
// If we're scroll snapping, use a smooth scroll animation to get