LibWeb: Implement the unreachable scrollable overflow

Whenever we end up with a scrollable overflow rect that goes beyond
either of its axes (i.e. the rect has a negative X or Y position
relative to its parent's absolute padding box position), we need to clip
that rect to prevent going into the "unreachable scrollable overflow".

This fixes the horizontal scrolling on https://ladybird.org (gets more
pronounced if you make the window very narrow).
This commit is contained in:
Jelle Raaijmakers 2025-07-10 11:43:46 +02:00
parent 05ddf5c718
commit 2998049fe9
Notes: github-actions[bot] 2025-07-11 06:24:49 +00:00
33 changed files with 140 additions and 98 deletions

View file

@ -1917,9 +1917,9 @@ int Element::scroll_width()
return 0;
// 7. Return the width of the elements scrolling area.
if (auto scrollable_overflow_rect = paintable_box()->scrollable_overflow_rect(); scrollable_overflow_rect.has_value()) {
if (auto scrollable_overflow_rect = paintable_box()->scrollable_overflow_rect(); scrollable_overflow_rect.has_value())
return scrollable_overflow_rect->width().to_int();
}
return 0;
}