diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index c07742bcdb..c84220ce51 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -432,11 +432,15 @@ void BlockFormattingContext::layout_block_level_children(BlockContainer const& b OwnPtr independent_formatting_context; if (child_box.can_have_children()) { - independent_formatting_context = create_independent_formatting_context_if_needed(m_state, child_box); - if (independent_formatting_context) - independent_formatting_context->run(child_box, layout_mode); - else - layout_block_level_children(verify_cast(child_box), layout_mode); + if (child_box.children_are_inline()) { + layout_inline_children(verify_cast(child_box), layout_mode); + } else { + independent_formatting_context = create_independent_formatting_context_if_needed(m_state, child_box); + if (independent_formatting_context) + independent_formatting_context->run(child_box, layout_mode); + else + layout_block_level_children(verify_cast(child_box), layout_mode); + } } compute_height(child_box, m_state); diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index afae391bbe..85c3fc474b 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -109,8 +108,7 @@ OwnPtr FormattingContext::create_independent_formatting_conte return make(state, verify_cast(child_box), this); VERIFY(is_block_formatting_context()); - if (child_box.children_are_inline()) - return make(state, verify_cast(child_box), static_cast(*this)); + VERIFY(!child_box.children_are_inline()); // The child box is a block container that doesn't create its own BFC. // It will be formatted by this BFC.