LibWeb: Don't put abspos grid/flex items in anonymous wrapper

Grid and flex containers have their own rules for abspos items, so we
shouldn't try to be clever and put them in the "current" anonymous
wrapper block. That behavior is primarily for the benefit of block &
inline layout.
This commit is contained in:
Andreas Kling 2023-04-06 18:01:01 +02:00
commit 7b4c76788b
Notes: sideshowbarker 2024-07-17 07:43:44 +09:00
3 changed files with 25 additions and 0 deletions

View file

@ -92,6 +92,8 @@ static Layout::Node& insertion_parent_for_block_node(Layout::NodeWithStyle& layo
bool is_out_of_flow = layout_node.is_absolutely_positioned() || layout_node.is_floating();
if (is_out_of_flow
&& !layout_parent.display().is_flex_inside()
&& !layout_parent.display().is_grid_inside()
&& layout_parent.last_child()->is_anonymous()
&& layout_parent.last_child()->children_are_inline()) {
// Block is out-of-flow & previous sibling was wrapped in an anonymous block.