mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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:
parent
0d8a013ee1
commit
9f6841a65c
Notes:
sideshowbarker
2024-07-17 00:57:24 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9f6841a65c Pull-request: https://github.com/SerenityOS/serenity/pull/22849
3 changed files with 12 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
PASS (didn't crash)
|
5
Tests/LibWeb/Text/input/window-scroll-while-parsing.html
Normal file
5
Tests/LibWeb/Text/input/window-scroll-while-parsing.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<body><script>
|
||||
window.scrollTo(200, 200);
|
||||
if (window.internals !== undefined)
|
||||
window.internals.signalTextTestIsDone();
|
||||
</script>PASS (didn't crash)
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue