1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Consolidate consecutive inlines in a single anonymous flex item

Before this change, we were creating a new anonymous flex item for every
inline-level child of a flex container, even when we had a sequence of
inline-level children.

The fix here is to simply keep putting things in the last child of the
flex container, if that child is already an anonymous flex item.
This commit is contained in:
Andreas Kling 2023-09-01 10:06:28 +02:00
parent d54cd23615
commit ef9b6c25fa
Notes: sideshowbarker 2024-07-17 01:23:08 +09:00
3 changed files with 38 additions and 0 deletions

View file

@ -69,6 +69,8 @@ static Layout::Node& insertion_parent_for_inline_node(Layout::NodeWithStyle& lay
return layout_parent;
if (layout_parent.display().is_flex_inside() || layout_parent.display().is_grid_inside()) {
if (layout_parent.last_child() && layout_parent.last_child()->is_anonymous() && layout_parent.last_child()->children_are_inline())
return *layout_parent.last_child();
layout_parent.append_child(layout_parent.create_anonymous_wrapper());
return *layout_parent.last_child();
}