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.
This commit is contained in:
Andreas Kling 2022-07-22 21:58:59 +02:00
commit 16c173de43
Notes: sideshowbarker 2024-07-17 08:34:48 +09:00

View file

@ -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.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());
icb.set_has_definite_width(true);
icb.set_has_definite_height(true);
root_formatting_context.run(*m_layout_root, Layout::LayoutMode::Normal);
}
layout_state.commit();
browsing_context()->set_needs_display();