LibWeb: Allow replaced elements to host children

We add a new formatting context that simply runs layout for an
anonymous block formatting context within it. This allows replaced
elements to contain children, if the parent rewrites inline-flow to
inline-block.
This commit is contained in:
Zaggy1024
2026-02-20 20:33:07 -06:00
committed by Alexander Kalenik
parent bc60768cb0
commit dd0c821291
Notes: github-actions[bot] 2026-02-23 06:28:55 +00:00
8 changed files with 137 additions and 7 deletions

View File

@@ -243,7 +243,7 @@ static GC::Ptr<Box> nearest_ancestor_capable_of_forming_a_containing_block(Node&
if (ancestor->is_block_container()
|| ancestor->display().is_flex_inside()
|| ancestor->display().is_grid_inside()
|| ancestor->is_svg_svg_box()) {
|| ancestor->is_replaced_box_with_children()) {
return as<Box>(ancestor);
}
}
@@ -1424,6 +1424,11 @@ bool NodeWithStyleAndBoxModelMetrics::should_create_inline_continuation() const
if (is_svg_box() || is_svg_svg_box() || is_svg_foreign_object_box())
return false;
// Replaced boxes with children (e.g. media elements with shadow DOM controls)
// have their own formatting context; don't split them.
if (parent()->is_replaced_box_with_children())
return false;
return true;
}