Bug 1858984 - Fix ComputeNeedToScroll with large line sizes. r=emilio,devtools-reviewers,ochameau

When the line scroll amount is larger than that of the rectangle to
scroll into view, do not use the line size to determine if we should
scroll.

Depends on D192869

Differential Revision: https://phabricator.services.mozilla.com/D192870
This commit is contained in:
Dan Robertson
2024-01-03 19:12:22 +00:00
parent 3365e64177
commit 516dd41c49
4 changed files with 8 additions and 4 deletions

View File

@@ -3326,6 +3326,13 @@ static bool ComputeNeedToScroll(WhenToScroll aWhenToScroll, nscoord aLineSize,
// The caller wants the frame as visible as possible
return true;
case WhenToScroll::IfNotVisible:
if (aLineSize > (aRectMax - aRectMin)) {
// If the line size is greater than the size of the rect
// to scroll into view, do not use the line size to determine
// if we need to scroll.
aLineSize = 0;
}
// Scroll only if no part of the frame is visible in this view.
return aRectMax - aLineSize <= aViewMin ||
aRectMin + aLineSize >= aViewMax;