1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibWeb: Move initial containing block setup out of BFC

BFC currently has a number of architectural issues due to it being
responsible for setting the dimensions of the BFC root.

This patch moves the logic for setting up the ICB from BFC to Document.
This commit is contained in:
Andreas Kling 2022-02-12 00:57:45 +01:00
parent 8b8a1449c4
commit 40bd2cb611
2 changed files with 5 additions and 4 deletions

View file

@ -405,6 +405,8 @@ void Document::update_layout()
if (!browsing_context())
return;
auto viewport_rect = browsing_context()->viewport_rect();
update_style();
if (!m_layout_root) {
@ -413,6 +415,9 @@ void Document::update_layout()
}
Layout::BlockFormattingContext root_formatting_context(*m_layout_root, nullptr);
m_layout_root->build_stacking_context_tree();
m_layout_root->set_content_size(viewport_rect.size().to_type<float>());
root_formatting_context.run(*m_layout_root, Layout::LayoutMode::Default);
m_layout_root->set_needs_display();