From 0fd2537d8e1cdbd382739a61caf733d5a4ae3d19 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sun, 13 Sep 2020 15:27:34 +0000 Subject: [PATCH] Bug 1664661. Make ScrollFrameHelper::UpdateScrollbarPosition use the same calculation for scrollbar attributes as ScrollFrameHelper::ReflowFinished. r=kats UpdateScrollbarPosition should have been using scroll range and not scrolled rect for a long time. It didn't matter because we only used the top left of the rect which matched until bug 1654933 made GetScrollRangeForUserInputEvents return a rect that wasn't located at 0,0. Differential Revision: https://phabricator.services.mozilla.com/D90031 --- layout/generic/nsGfxScrollFrame.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 00faa98e94a3..c6eca46c581d 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -5371,22 +5371,23 @@ void ScrollFrameHelper::UpdateScrollbarPosition() { mFrameIsUpdatingScrollbar = true; nsPoint pt = GetScrollPosition(); - nsRect scrolledRect = GetScrolledRect(); + nsRect scrollRange = GetVisualScrollRange(); if (gfxPlatform::UseDesktopZoomingScrollbars()) { pt = GetVisualViewportOffset(); + scrollRange = GetScrollRangeForUserInputEvents(); } if (mVScrollbarBox) { SetCoordAttribute(mVScrollbarBox->GetContent()->AsElement(), - nsGkAtoms::curpos, pt.y - scrolledRect.y); + nsGkAtoms::curpos, pt.y - scrollRange.y); if (!weakFrame.IsAlive()) { return; } } if (mHScrollbarBox) { SetCoordAttribute(mHScrollbarBox->GetContent()->AsElement(), - nsGkAtoms::curpos, pt.x - scrolledRect.x); + nsGkAtoms::curpos, pt.x - scrollRange.x); if (!weakFrame.IsAlive()) { return; }