1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:48:14 +00:00

LibWeb: Update layout before looking at overflow in window.scroll()

Fixes a crash seen on https://www.ekioh.com/
This commit is contained in:
Andreas Kling 2024-01-18 20:58:53 +01:00
parent 0d8a013ee1
commit 9f6841a65c
3 changed files with 12 additions and 0 deletions

View file

@ -1273,6 +1273,12 @@ void Window::scroll(ScrollToOptions const& options)
auto viewport_height = viewport_rect.height();
auto const document = top_level_traversable->active_document();
VERIFY(document);
// Make sure layout is up-to-date before looking at scrollable overflow metrics.
document->update_layout();
VERIFY(document->paintable_box());
auto scrolling_area = document->paintable_box()->scrollable_overflow_rect()->to_type<float>();
// 7. FIXME: For now we always assume overflow direction is rightward