From 0863c04a4d45b834c2df03498e96c5cc535daf06 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Sat, 12 Sep 2020 13:06:20 +0000 Subject: [PATCH] Bug 1662013 - Move some function bodies into .cpp files. r=botond Differential Revision: https://phabricator.services.mozilla.com/D88746 --- gfx/layers/FrameMetrics.cpp | 9 +++++++++ gfx/layers/FrameMetrics.h | 8 +------- layout/generic/nsGfxScrollFrame.cpp | 18 ++++++++++++++++++ layout/generic/nsGfxScrollFrame.h | 17 ++--------------- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/gfx/layers/FrameMetrics.cpp b/gfx/layers/FrameMetrics.cpp index 9731ea9b17df..c52abf2e0087 100644 --- a/gfx/layers/FrameMetrics.cpp +++ b/gfx/layers/FrameMetrics.cpp @@ -105,6 +105,15 @@ void FrameMetrics::ApplyScrollUpdateFrom(const ScrollPositionUpdate& aUpdate) { ClampAndSetVisualScrollOffset(aUpdate.GetDestination() + relativeOffset); } +CSSPoint FrameMetrics::ApplyRelativeScrollUpdateFrom( + const ScrollPositionUpdate& aUpdate) { + MOZ_ASSERT(aUpdate.GetType() == ScrollUpdateType::Relative); + CSSPoint origin = GetVisualScrollOffset(); + CSSPoint delta = (aUpdate.GetDestination() - aUpdate.GetSource()); + ClampAndSetVisualScrollOffset(origin + delta); + return GetVisualScrollOffset() - origin; +} + ScrollSnapInfo::ScrollSnapInfo() : mScrollSnapStrictnessX(StyleScrollSnapStrictness::None), mScrollSnapStrictnessY(StyleScrollSnapStrictness::None) {} diff --git a/gfx/layers/FrameMetrics.h b/gfx/layers/FrameMetrics.h index ba6712978792..589ed146c119 100644 --- a/gfx/layers/FrameMetrics.h +++ b/gfx/layers/FrameMetrics.h @@ -271,13 +271,7 @@ struct FrameMetrics { * * @returns The clamped scroll offset delta that was applied */ - CSSPoint ApplyRelativeScrollUpdateFrom(const ScrollPositionUpdate& aUpdate) { - MOZ_ASSERT(aUpdate.GetType() == ScrollUpdateType::Relative); - CSSPoint origin = GetVisualScrollOffset(); - CSSPoint delta = (aUpdate.GetDestination() - aUpdate.GetSource()); - ClampAndSetVisualScrollOffset(origin + delta); - return GetVisualScrollOffset() - origin; - } + CSSPoint ApplyRelativeScrollUpdateFrom(const ScrollPositionUpdate& aUpdate); void UpdatePendingScrollInfo(const ScrollPositionUpdate& aInfo) { SetLayoutScrollOffset(aInfo.GetDestination()); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 0391b74bce70..877e91234479 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4328,6 +4328,13 @@ bool ScrollFrameHelper::DecideScrollableLayer( return mWillBuildScrollableLayer; } +void ScrollFrameHelper::NotifyApzTransaction() { + mAllowScrollOriginDowngrade = true; + mApzScrollPos = GetScrollPosition(); + mRelativeOffset.reset(); + mScrollUpdates.Clear(); +} + Maybe ScrollFrameHelper::ComputeScrollMetadata( LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame, const Maybe& aParameters, @@ -7020,6 +7027,17 @@ bool ScrollFrameHelper::IsScrollAnimating( mRelativeOffset.isSome(); } +void ScrollFrameHelper::ResetScrollInfoIfNeeded(uint32_t aGeneration, + bool aApzAnimationInProgress) { + if (aGeneration == mScrollGeneration) { + mLastScrollOrigin = ScrollOrigin::None; + mLastSmoothScrollOrigin = ScrollOrigin::None; + } + // We can reset this regardless of scroll generation, as this is only set + // here, as a response to APZ requesting a repaint. + mApzAnimationInProgress = aApzAnimationInProgress; +} + UniquePtr ScrollFrameHelper::SaveState() const { nsIScrollbarMediator* mediator = do_QueryFrame(GetScrolledFrame()); if (mediator) { diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 514da0ce1b48..4771cc80760e 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -439,12 +439,7 @@ class ScrollFrameHelper : public nsIReflowCallback { nsRect* aVisibleRect, nsRect* aDirtyRect, bool aSetBase, bool* aDirtyRectHasBeenOverriden = nullptr); - void NotifyApzTransaction() { - mAllowScrollOriginDowngrade = true; - mApzScrollPos = GetScrollPosition(); - mRelativeOffset.reset(); - mScrollUpdates.Clear(); - } + void NotifyApzTransaction(); void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort); bool GetDisplayPortAtLastApproximateFrameVisibilityUpdate( nsRect* aDisplayPort); @@ -471,15 +466,7 @@ class ScrollFrameHelper : public nsIReflowCallback { bool IsScrollAnimating(IncludeApzAnimation = IncludeApzAnimation::Yes) const; void ResetScrollInfoIfNeeded(uint32_t aGeneration, - bool aApzAnimationInProgress) { - if (aGeneration == mScrollGeneration) { - mLastScrollOrigin = ScrollOrigin::None; - mLastSmoothScrollOrigin = ScrollOrigin::None; - } - // We can reset this regardless of scroll generation, as this is only set - // here, as a response to APZ requesting a repaint. - mApzAnimationInProgress = aApzAnimationInProgress; - } + bool aApzAnimationInProgress); Maybe GetRelativeOffset() const { return mRelativeOffset; } bool WantAsyncScroll() const; Maybe ComputeScrollMetadata(