summaryrefslogtreecommitdiffstats
path: root/gfx/layers/FrameMetrics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/FrameMetrics.cpp')
-rw-r--r--gfx/layers/FrameMetrics.cpp10
1 files changed, 4 insertions, 6 deletions
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<bool, CSSPoint> 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<bool, CSSPoint> 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;
}