Bug 1654933. ScrollFrameHelper::CurPosAttributeChanged should be using the scroll range not the scroll rect. r=kats

UpdateScrollbarPosition and ReflowFinished both use the scroll range for this. It usually doesn't matter, but the next patch will make it important.

Differential Revision: https://phabricator.services.mozilla.com/D85983
This commit is contained in:
Timothy Nikkel 2020-08-05 17:56:12 +00:00
Родитель 51464aefa0
Коммит 87a1cf6b13
1 изменённых файлов: 7 добавлений и 6 удалений

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

@ -5388,12 +5388,13 @@ void ScrollFrameHelper::CurPosAttributeChanged(nsIContent* aContent,
// updating our scrollbar.
if (mFrameIsUpdatingScrollbar) return;
nsRect scrolledRect = GetScrolledRect();
nsRect scrollRange = GetVisualScrollRange();
nsPoint current = GetScrollPosition() - scrolledRect.TopLeft();
nsPoint current = GetScrollPosition() - scrollRange.TopLeft();
if (gfxPlatform::UseDesktopZoomingScrollbars()) {
current = GetVisualViewportOffset() - scrolledRect.TopLeft();
scrollRange = GetScrollRangeForUserInputEvents();
current = GetVisualViewportOffset() - scrollRange.TopLeft();
}
nsPoint dest;
@ -5402,9 +5403,9 @@ void ScrollFrameHelper::CurPosAttributeChanged(nsIContent* aContent,
&allowedRange.x, &allowedRange.width);
dest.y = GetCoordAttribute(mVScrollbarBox, nsGkAtoms::curpos, current.y,
&allowedRange.y, &allowedRange.height);
current += scrolledRect.TopLeft();
dest += scrolledRect.TopLeft();
allowedRange += scrolledRect.TopLeft();
current += scrollRange.TopLeft();
dest += scrollRange.TopLeft();
allowedRange += scrollRange.TopLeft();
// Don't try to scroll if we're already at an acceptable place.
// Don't call Contains here since Contains returns false when the point is