summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-20 18:43:53 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-20 19:03:43 +0100
commit07a4d590dd5fbeee08c81336e5c324698d482423 (patch)
tree147a7453776a7abec8a1c786baa01fc54319286e /Userland/Libraries/LibWeb/DOM
parent6ac3bf2982f355e42251851654b8f67ee42a8eb1 (diff)
downloadserenity-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.cpp5
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)