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
This commit is contained in:
Timothy Nikkel 2020-09-13 15:27:34 +00:00
Родитель bfc490a120
Коммит 0fd2537d8e
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -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;
}