mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +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));
|
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) {
|
if (aMode == nsIScrollableFrame::INSTANT) {
|
||||||
// Asynchronous scrolling is not allowed, so we'll kill any existing
|
// Asynchronous scrolling is not allowed, so we'll kill any existing
|
||||||
// async-scrolling process and do an instant scroll.
|
// async-scrolling process and do an instant scroll.
|
||||||
@ -2122,7 +2128,7 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) {
|
if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) {
|
||||||
if (mApzSmoothScrollDestination == mDestination &&
|
if (mApzSmoothScrollDestination == Some(mDestination) &&
|
||||||
mScrollGeneration == sScrollGenerationCounter) {
|
mScrollGeneration == sScrollGenerationCounter) {
|
||||||
// If we already sent APZ a smooth-scroll request to this
|
// If we already sent APZ a smooth-scroll request to this
|
||||||
// destination with this generation (i.e. it was the last request
|
// 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
|
// calls, incrementing the generation counter, and blocking APZ from
|
||||||
// syncing the scroll offset back to the main thread.
|
// syncing the scroll offset back to the main thread.
|
||||||
// Note that if we get two smooth-scroll requests to the same
|
// Note that if we get two smooth-scroll requests to the same
|
||||||
// destination with some other scroll in between, mDestination will
|
// destination with some other scroll in between,
|
||||||
// get reset and so we shouldn't have the problem where this check
|
// mApzSmoothScrollDestination will get reset to Nothing() and so
|
||||||
// discards a legitimate smooth-scroll.
|
// we shouldn't have the problem where this check discards a
|
||||||
|
// legitimate smooth-scroll.
|
||||||
// Note: if there are two separate scrollframes both getting smooth
|
// Note: if there are two separate scrollframes both getting smooth
|
||||||
// scrolled at the same time, sScrollGenerationCounter can get
|
// scrolled at the same time, sScrollGenerationCounter can get
|
||||||
// incremented and this early-exit won't get taken. Bug 1231177 is
|
// 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
|
// information needed to start the animation and skip the main-thread
|
||||||
// animation for this scroll.
|
// animation for this scroll.
|
||||||
mLastSmoothScrollOrigin = aOrigin;
|
mLastSmoothScrollOrigin = aOrigin;
|
||||||
mApzSmoothScrollDestination = mDestination;
|
mApzSmoothScrollDestination = Some(mDestination);
|
||||||
mScrollGeneration = ++sScrollGenerationCounter;
|
mScrollGeneration = ++sScrollGenerationCounter;
|
||||||
|
|
||||||
if (!nsLayoutUtils::GetDisplayPort(mOuter->GetContent())) {
|
if (!nsLayoutUtils::GetDisplayPort(mOuter->GetContent())) {
|
||||||
|
@ -432,7 +432,7 @@ public:
|
|||||||
nsTArray<nsIScrollPositionListener*> mListeners;
|
nsTArray<nsIScrollPositionListener*> mListeners;
|
||||||
nsIAtom* mLastScrollOrigin;
|
nsIAtom* mLastScrollOrigin;
|
||||||
nsIAtom* mLastSmoothScrollOrigin;
|
nsIAtom* mLastSmoothScrollOrigin;
|
||||||
nsPoint mApzSmoothScrollDestination;
|
Maybe<nsPoint> mApzSmoothScrollDestination;
|
||||||
uint32_t mScrollGeneration;
|
uint32_t mScrollGeneration;
|
||||||
nsRect mScrollPort;
|
nsRect mScrollPort;
|
||||||
// Where we're currently scrolling to, if we're scrolling asynchronously.
|
// Where we're currently scrolling to, if we're scrolling asynchronously.
|
||||||
|
Loading…
Reference in New Issue
Block a user