mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1232048 - Fix breakage in scroll snapping when snapping twice in a row to the same thing with non-smooth-scrolls in between. r=botond
--HG-- extra : commitid : HOoM79IZd2u
This commit is contained in:
parent
13e85d0c92
commit
edc45db293
@ -2093,6 +2093,12 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
||||
|
||||
nsRect range = aRange ? *aRange : nsRect(aScrollPosition, nsSize(0, 0));
|
||||
|
||||
if (aMode != nsIScrollableFrame::SMOOTH_MSD) {
|
||||
// If we get a non-smooth-scroll, reset the cached APZ scroll destination,
|
||||
// so that we know to process the next smooth-scroll destined for APZ.
|
||||
mApzSmoothScrollDestination = Nothing();
|
||||
}
|
||||
|
||||
if (aMode == nsIScrollableFrame::INSTANT) {
|
||||
// Asynchronous scrolling is not allowed, so we'll kill any existing
|
||||
// async-scrolling process and do an instant scroll.
|
||||
@ -2122,7 +2128,7 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) {
|
||||
if (mApzSmoothScrollDestination == mDestination &&
|
||||
if (mApzSmoothScrollDestination == Some(mDestination) &&
|
||||
mScrollGeneration == sScrollGenerationCounter) {
|
||||
// If we already sent APZ a smooth-scroll request to this
|
||||
// destination with this generation (i.e. it was the last request
|
||||
@ -2131,9 +2137,10 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
||||
// calls, incrementing the generation counter, and blocking APZ from
|
||||
// syncing the scroll offset back to the main thread.
|
||||
// Note that if we get two smooth-scroll requests to the same
|
||||
// destination with some other scroll in between, mDestination will
|
||||
// get reset and so we shouldn't have the problem where this check
|
||||
// discards a legitimate smooth-scroll.
|
||||
// destination with some other scroll in between,
|
||||
// mApzSmoothScrollDestination will get reset to Nothing() and so
|
||||
// we shouldn't have the problem where this check discards a
|
||||
// legitimate smooth-scroll.
|
||||
// Note: if there are two separate scrollframes both getting smooth
|
||||
// scrolled at the same time, sScrollGenerationCounter can get
|
||||
// incremented and this early-exit won't get taken. Bug 1231177 is
|
||||
@ -2145,7 +2152,7 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
||||
// information needed to start the animation and skip the main-thread
|
||||
// animation for this scroll.
|
||||
mLastSmoothScrollOrigin = aOrigin;
|
||||
mApzSmoothScrollDestination = mDestination;
|
||||
mApzSmoothScrollDestination = Some(mDestination);
|
||||
mScrollGeneration = ++sScrollGenerationCounter;
|
||||
|
||||
if (!nsLayoutUtils::GetDisplayPort(mOuter->GetContent())) {
|
||||
|
@ -432,7 +432,7 @@ public:
|
||||
nsTArray<nsIScrollPositionListener*> mListeners;
|
||||
nsIAtom* mLastScrollOrigin;
|
||||
nsIAtom* mLastSmoothScrollOrigin;
|
||||
nsPoint mApzSmoothScrollDestination;
|
||||
Maybe<nsPoint> mApzSmoothScrollDestination;
|
||||
uint32_t mScrollGeneration;
|
||||
nsRect mScrollPort;
|
||||
// Where we're currently scrolling to, if we're scrolling asynchronously.
|
||||
|
Loading…
Reference in New Issue
Block a user