diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-20 18:43:53 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-20 19:03:43 +0100 |
commit | 07a4d590dd5fbeee08c81336e5c324698d482423 (patch) | |
tree | 147a7453776a7abec8a1c786baa01fc54319286e /Userland/Libraries/LibWeb/DOM | |
parent | 6ac3bf2982f355e42251851654b8f67ee42a8eb1 (diff) | |
download | serenity-07a4d590dd5fbeee08c81336e5c324698d482423.zip |
LibWeb: Layout browsing context parent before its children
When updating layout inside a nested browsing context, try first to
perform layout in the parent document (the nested browsing context's
container's document).
This ensures that nested browsing contexts have the right viewport
dimensions in case the parent layout changes them somehow.
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 3d67b113c9..a08584cf67 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -551,6 +551,11 @@ void Document::invalidate_layout() void Document::update_layout() { + // NOTE: If our parent document needs a relayout, we must do that *first*. + // This is necessary as the parent layout may cause our viewport to change. + if (browsing_context() && browsing_context()->container()) + browsing_context()->container()->document().update_layout(); + update_style(); if (!m_needs_layout && m_layout_root) |