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.
This commit is contained in:
Andreas Kling 2022-03-20 18:43:53 +01:00
parent 6ac3bf2982
commit 07a4d590dd
Notes: sideshowbarker 2024-07-17 17:02:45 +09:00

View file

@ -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)