From c06eb6ae820f3d8b90c07b454fb8de7c65062e9f Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 5 Jun 2020 09:41:07 +0000 Subject: [PATCH] Bug 1643042 - Switch mLastSmoothScrollOrigin to using None as well. r=tnikkel This uses "None" instead of "NotSpecified" as the value for mLastSmoothScrollOrigin when there is no smooth scroll in progress. Depends on D78439 Differential Revision: https://phabricator.services.mozilla.com/D78469 --- gfx/layers/apz/util/APZCCallbackHelper.cpp | 2 +- layout/base/nsLayoutUtils.cpp | 2 +- layout/generic/ScrollOrigin.h | 8 ++++---- layout/generic/nsGfxScrollFrame.cpp | 8 ++++---- layout/generic/nsGfxScrollFrame.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp index ec6d6cf2d1fd..f8435ce651af 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -818,7 +818,7 @@ void APZCCallbackHelper::NotifyFlushComplete(PresShell* aPresShell) { bool APZCCallbackHelper::IsScrollInProgress(nsIScrollableFrame* aFrame) { return aFrame->IsProcessingAsyncScroll() || nsLayoutUtils::CanScrollOriginClobberApz(aFrame->LastScrollOrigin()) || - aFrame->LastSmoothScrollOrigin() != ScrollOrigin::NotSpecified; + aFrame->LastSmoothScrollOrigin() != ScrollOrigin::None; } /* static */ diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index a7175f725ab3..dc7e3f9bdae4 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -9185,7 +9185,7 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata( ScrollOrigin lastSmoothScrollOrigin = scrollableFrame->LastSmoothScrollOrigin(); - if (lastSmoothScrollOrigin != ScrollOrigin::NotSpecified) { + if (lastSmoothScrollOrigin != ScrollOrigin::None) { metrics.SetSmoothScrollOffsetUpdated( scrollableFrame->CurrentScrollGeneration()); } diff --git a/layout/generic/ScrollOrigin.h b/layout/generic/ScrollOrigin.h index d516158dc2c2..e7cfd1be6d90 100644 --- a/layout/generic/ScrollOrigin.h +++ b/layout/generic/ScrollOrigin.h @@ -13,13 +13,13 @@ namespace mozilla { enum class ScrollOrigin : uint8_t { // This is used as an initial value for the "LastScrollOrigin" property on // scrollable frames. It is not intended to be an actual scroll origin, but - // a sentinel value that indicates that there was no "last scroll". + // a sentinel value that indicates that there was no "last scroll". It is + // used similarly for the "LastSmoothScrollOrigin" property, to indicate + // no smooth scroll is in progress. None, // This is a default value that we use when we don't know of a more specific - // value that we can use. Note that for the "LastSmoothScrollOrigin" property - // on a scrollable frame, the NotSpecified value is special, in that it means - // there is no smooth scroll in progress. + // value that we can use. NotSpecified, // The scroll came from APZ code. Apz, diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 86316829dd1b..3cd762e96893 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2090,7 +2090,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot) mAsyncScroll(nullptr), mAsyncSmoothMSDScroll(nullptr), mLastScrollOrigin(ScrollOrigin::None), - mLastSmoothScrollOrigin(ScrollOrigin::NotSpecified), + mLastSmoothScrollOrigin(ScrollOrigin::None), mScrollGeneration(++sScrollGenerationCounter), mDestination(0, 0), mRestorePos(-1, -1), @@ -2893,7 +2893,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, mLastScrollOrigin = aOrigin; mAllowScrollOriginDowngrade = false; } - mLastSmoothScrollOrigin = ScrollOrigin::NotSpecified; + mLastSmoothScrollOrigin = ScrollOrigin::None; mScrollGeneration = ++sScrollGenerationCounter; if (mLastScrollOrigin == ScrollOrigin::Apz) { mApzScrollPos = GetScrollPosition(); @@ -6655,7 +6655,7 @@ UniquePtr ScrollFrameHelper::SaveState() const { // Don't store a scroll state if we never have been scrolled or restored // a previous scroll state, and we're not in the middle of a smooth scroll. bool isInSmoothScroll = IsProcessingAsyncScroll() || - mLastSmoothScrollOrigin != ScrollOrigin::NotSpecified; + mLastSmoothScrollOrigin != ScrollOrigin::None; if (!mHasBeenScrolled && !mDidHistoryRestore && !isInSmoothScroll) { return nullptr; } @@ -7244,7 +7244,7 @@ void ScrollFrameHelper::ApzSmoothScrollTo(const nsPoint& aDestination, // The animation will be handled in the compositor, pass the // information needed to start the animation and skip the main-thread // animation for this scroll. - MOZ_ASSERT(aOrigin != ScrollOrigin::NotSpecified); + MOZ_ASSERT(aOrigin != ScrollOrigin::None); mLastSmoothScrollOrigin = aOrigin; mApzSmoothScrollDestination = Some(aDestination); mScrollGeneration = ++sScrollGenerationCounter; diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index eede67b9015d..a25ee081c7bc 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -467,7 +467,7 @@ class ScrollFrameHelper : public nsIReflowCallback { void ResetScrollInfoIfGeneration(uint32_t aGeneration) { if (aGeneration == mScrollGeneration) { mLastScrollOrigin = ScrollOrigin::NotSpecified; - mLastSmoothScrollOrigin = ScrollOrigin::NotSpecified; + mLastSmoothScrollOrigin = ScrollOrigin::None; } } bool WantAsyncScroll() const;