mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +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:
parent
108a8e4c88
commit
daece542f5
2 changed files with 6 additions and 6 deletions
|
@ -377,12 +377,11 @@ void BlockFormattingContext::layout_block_level_box(Box const& box, BlockContain
|
||||||
|
|
||||||
OwnPtr<FormattingContext> independent_formatting_context;
|
OwnPtr<FormattingContext> independent_formatting_context;
|
||||||
if (!box.is_replaced_box() && box.has_children()) {
|
if (!box.is_replaced_box() && box.has_children()) {
|
||||||
if (box.children_are_inline()) {
|
if (auto independent_formatting_context = create_independent_formatting_context_if_needed(m_state, box)) {
|
||||||
layout_inline_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
|
independent_formatting_context->run(box, layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
|
||||||
} else {
|
} else {
|
||||||
independent_formatting_context = create_independent_formatting_context_if_needed(m_state, box);
|
if (box.children_are_inline())
|
||||||
if (independent_formatting_context)
|
layout_inline_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
|
||||||
independent_formatting_context->run(box, layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
|
|
||||||
else
|
else
|
||||||
layout_block_level_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
|
layout_block_level_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,8 @@ OwnPtr<FormattingContext> FormattingContext::create_independent_formatting_conte
|
||||||
}
|
}
|
||||||
|
|
||||||
VERIFY(is_block_formatting_context());
|
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.
|
// The child box is a block container that doesn't create its own BFC.
|
||||||
// It will be formatted by this BFC.
|
// It will be formatted by this BFC.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue