1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:47:34 +00:00

LibWeb: Check if block creates BFC even if all it's children are inline

Even if block has all children inline there need to be a check
if it creates BFC because otherwise IFC will be looking in
wrong parent BFC to calculate space used by floats.
This commit is contained in:
Aliaksandr Kalenik 2022-12-11 01:27:42 +03:00 committed by Andreas Kling
parent 108a8e4c88
commit daece542f5
2 changed files with 6 additions and 6 deletions

View file

@ -377,12 +377,11 @@ void BlockFormattingContext::layout_block_level_box(Box const& box, BlockContain
OwnPtr<FormattingContext> independent_formatting_context;
if (!box.is_replaced_box() && box.has_children()) {
if (box.children_are_inline()) {
layout_inline_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
} else {
independent_formatting_context = create_independent_formatting_context_if_needed(m_state, box);
if (independent_formatting_context)
if (auto independent_formatting_context = create_independent_formatting_context_if_needed(m_state, box)) {
independent_formatting_context->run(box, layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
} else {
if (box.children_are_inline())
layout_inline_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
else
layout_block_level_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
}

View file

@ -155,7 +155,8 @@ OwnPtr<FormattingContext> FormattingContext::create_independent_formatting_conte
}
VERIFY(is_block_formatting_context());
VERIFY(!child_box.children_are_inline());
if (child_box.children_are_inline())
return {};
// The child box is a block container that doesn't create its own BFC.
// It will be formatted by this BFC.