From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- gfx/layers/FrameMetrics.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'gfx/layers/FrameMetrics.cpp') diff --git a/gfx/layers/FrameMetrics.cpp b/gfx/layers/FrameMetrics.cpp index 5d82b7f295..86fdd5ffd6 100644 --- a/gfx/layers/FrameMetrics.cpp +++ b/gfx/layers/FrameMetrics.cpp @@ -147,12 +147,10 @@ CSSSize FrameMetrics::CalculateCompositedSizeInCssPixels( return aCompositionBounds.Size() / aZoom; } -std::pair FrameMetrics::ApplyAbsoluteScrollUpdateFrom( - const ScrollPositionUpdate& aUpdate) { - CSSPoint oldVisualOffset = GetVisualScrollOffset(); +bool FrameMetrics::ApplyScrollUpdateFrom(const ScrollPositionUpdate& aUpdate) { // In applying a main-thread scroll update, try to preserve the relative // offset between the visual and layout viewports. - CSSPoint relativeOffset = oldVisualOffset - GetLayoutScrollOffset(); + CSSPoint relativeOffset = GetVisualScrollOffset() - GetLayoutScrollOffset(); MOZ_ASSERT(IsRootContent() || relativeOffset == CSSPoint()); // We need to set the two offsets together, otherwise a subsequent // RecalculateLayoutViewportOffset() could see divergent layout and @@ -160,7 +158,7 @@ std::pair FrameMetrics::ApplyAbsoluteScrollUpdateFrom( bool offsetChanged = SetLayoutScrollOffset(aUpdate.GetDestination()); offsetChanged |= ClampAndSetVisualScrollOffset(aUpdate.GetDestination() + relativeOffset); - return {offsetChanged, GetVisualScrollOffset() - oldVisualOffset}; + return offsetChanged; } CSSPoint FrameMetrics::ApplyRelativeScrollUpdateFrom( @@ -168,7 +166,7 @@ CSSPoint FrameMetrics::ApplyRelativeScrollUpdateFrom( MOZ_ASSERT(aUpdate.GetType() == ScrollUpdateType::Relative); CSSPoint origin = GetVisualScrollOffset(); CSSPoint delta = (aUpdate.GetDestination() - aUpdate.GetSource()); - ClampAndSetVisualScrollOffset(origin + delta); + SetVisualScrollOffset(origin + delta); return GetVisualScrollOffset() - origin; } -- cgit v1.2.3