tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 5ec1de4603394ab9a55b6c003812bbfc410bedfd
parent 52e752321ecc315ca070141c51ec567de2f9d882
Author: Botond Ballo <botond@mozilla.com>
Date:   Wed,  3 Dec 2025 20:04:37 +0000

Bug 1999440 - Allow PresShell::ScrollToVisual to be called with ScrollMode::Smooth as well. r=hiro,layout-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D272347

Diffstat:
Mlayout/base/PresShell.cpp | 6++----
Mlayout/generic/ScrollContainerFrame.cpp | 6++++--
Mlayout/generic/ScrollContainerFrame.h | 3++-
3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp @@ -12331,11 +12331,9 @@ void PresShell::RefreshViewportSize() { void PresShell::ScrollToVisual(const nsPoint& aVisualViewportOffset, FrameMetrics::ScrollOffsetUpdateType aUpdateType, ScrollMode aMode) { - MOZ_ASSERT(aMode == ScrollMode::Instant || aMode == ScrollMode::SmoothMsd); - - if (aMode == ScrollMode::SmoothMsd) { + if (aMode == ScrollMode::Smooth || aMode == ScrollMode::SmoothMsd) { if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) { - if (sf->SmoothScrollVisual(aVisualViewportOffset, aUpdateType)) { + if (sf->SmoothScrollVisual(aVisualViewportOffset, aUpdateType, aMode)) { return; } } diff --git a/layout/generic/ScrollContainerFrame.cpp b/layout/generic/ScrollContainerFrame.cpp @@ -7758,7 +7758,9 @@ bool ScrollContainerFrame::CanApzScrollInTheseDirections( bool ScrollContainerFrame::SmoothScrollVisual( const nsPoint& aVisualViewportOffset, - FrameMetrics::ScrollOffsetUpdateType aUpdateType) { + FrameMetrics::ScrollOffsetUpdateType aUpdateType, ScrollMode aMode) { + MOZ_ASSERT(aMode == ScrollMode::Smooth || aMode == ScrollMode::SmoothMsd); + bool canDoApzSmoothScroll = nsLayoutUtils::AsyncPanZoomEnabled(this) && WantAsyncScroll(); if (!canDoApzSmoothScroll) { @@ -7785,7 +7787,7 @@ bool ScrollContainerFrame::SmoothScrollVisual( UniquePtr<ScrollSnapTargetIds> snapTargetIds; // Perform the scroll. - ApzSmoothScrollTo(mDestination, ScrollMode::SmoothMsd, + ApzSmoothScrollTo(mDestination, aMode, aUpdateType == FrameMetrics::eRestore ? ScrollOrigin::Restore : ScrollOrigin::Other, diff --git a/layout/generic/ScrollContainerFrame.h b/layout/generic/ScrollContainerFrame.h @@ -853,7 +853,8 @@ class ScrollContainerFrame : public nsContainerFrame, bool SmoothScrollVisual( const nsPoint& aVisualViewportOffset, - layers::FrameMetrics::ScrollOffsetUpdateType aUpdateType); + layers::FrameMetrics::ScrollOffsetUpdateType aUpdateType, + ScrollMode aMode); /** * Returns true if this scroll frame should perform smooth scroll with the