1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +00:00

LibWeb: Join out-of-flow block nodes in last parent child if possible

Join out-of-flow block nodes into last child of parent node if last
child has inline children.
This commit is contained in:
Aliaksandr Kalenik 2022-11-15 22:17:27 +03:00 committed by Andreas Kling
parent 43c5b94ea6
commit c1401b37c4

View file

@ -83,13 +83,15 @@ static Layout::Node& insertion_parent_for_block_node(Layout::NodeWithStyle& layo
return layout_parent;
}
if (!layout_parent.children_are_inline()) {
// Parent block has block-level children, insert this block into parent.
return layout_parent;
}
if (layout_node.is_floating() || layout_node.is_absolutely_positioned()) {
// Block is out-of-flow, it can have inline siblings if necessary.
if (layout_parent.last_child()->children_are_inline()) {
return *layout_parent.last_child();
}
}
if (!layout_parent.children_are_inline()) {
// Parent block has block-level children, insert this block into parent.
return layout_parent;
}