diff options
author | Andreas Kling <kling@serenityos.org> | 2022-07-22 21:58:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-26 00:04:21 +0200 |
commit | 16c173de4375f1002f76ed6b3d1e5a150bd18863 (patch) | |
tree | 94d4979102d686e07f6e05e847066b741ff3de5a | |
parent | 689cbdf6b6569e2b0d0a2a2894e1791b6451ab77 (diff) | |
download | serenity-16c173de4375f1002f76ed6b3d1e5a150bd18863.zip |
LibWeb: Destroy ICB formatting context before committing used values
Absolutely positioned boxes are handled by the BFC destructor, so we
need to make sure the ICB BFC is destroyed if we want these boxes
to get laid out.
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index b53c5a7605..d6aa84af5c 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -616,17 +616,20 @@ void Document::update_layout() Layout::LayoutState layout_state; layout_state.used_values_per_layout_node.resize(layout_node_count()); - Layout::BlockFormattingContext root_formatting_context(layout_state, *m_layout_root, nullptr); - auto& icb = static_cast<Layout::InitialContainingBlock&>(*m_layout_root); - auto& icb_state = layout_state.get_mutable(icb); - icb_state.set_content_width(viewport_rect.width()); - icb_state.set_content_height(viewport_rect.height()); + { + Layout::BlockFormattingContext root_formatting_context(layout_state, *m_layout_root, nullptr); - icb.set_has_definite_width(true); - icb.set_has_definite_height(true); + auto& icb = static_cast<Layout::InitialContainingBlock&>(*m_layout_root); + auto& icb_state = layout_state.get_mutable(icb); + icb.set_has_definite_width(true); + icb.set_has_definite_height(true); + icb_state.set_content_width(viewport_rect.width()); + icb_state.set_content_height(viewport_rect.height()); + + root_formatting_context.run(*m_layout_root, Layout::LayoutMode::Normal); + } - root_formatting_context.run(*m_layout_root, Layout::LayoutMode::Normal); layout_state.commit(); browsing_context()->set_needs_display(); |