|
@@ -66,24 +66,27 @@ static bool has_in_flow_block_children(Layout::Node const& layout_node)
|
|
|
|
|
|
static Layout::Node& insertion_parent_for_inline_node(Layout::NodeWithStyle& layout_parent)
|
|
|
{
|
|
|
+ auto last_child_creating_anonymous_wrapper_if_needed = [](auto& layout_parent) -> Layout::Node& {
|
|
|
+ if (!layout_parent.last_child()
|
|
|
+ || !layout_parent.last_child()->is_anonymous()
|
|
|
+ || !layout_parent.last_child()->children_are_inline()
|
|
|
+ || layout_parent.last_child()->is_generated()) {
|
|
|
+ layout_parent.append_child(layout_parent.create_anonymous_wrapper());
|
|
|
+ }
|
|
|
+ return *layout_parent.last_child();
|
|
|
+ };
|
|
|
+
|
|
|
if (layout_parent.display().is_inline_outside() && layout_parent.display().is_flow_inside())
|
|
|
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() && !layout_parent.last_child()->is_generated())
|
|
|
- return *layout_parent.last_child();
|
|
|
- layout_parent.append_child(layout_parent.create_anonymous_wrapper());
|
|
|
- return *layout_parent.last_child();
|
|
|
- }
|
|
|
+ if (layout_parent.display().is_flex_inside() || layout_parent.display().is_grid_inside())
|
|
|
+ return last_child_creating_anonymous_wrapper_if_needed(layout_parent);
|
|
|
|
|
|
if (!has_in_flow_block_children(layout_parent) || layout_parent.children_are_inline())
|
|
|
return layout_parent;
|
|
|
|
|
|
// Parent has block-level children, insert into an anonymous wrapper block (and create it first if needed)
|
|
|
- if (!layout_parent.last_child()->is_anonymous() || !layout_parent.last_child()->children_are_inline()) {
|
|
|
- layout_parent.append_child(layout_parent.create_anonymous_wrapper());
|
|
|
- }
|
|
|
- return *layout_parent.last_child();
|
|
|
+ return last_child_creating_anonymous_wrapper_if_needed(layout_parent);
|
|
|
}
|
|
|
|
|
|
static Layout::Node& insertion_parent_for_block_node(Layout::NodeWithStyle& layout_parent, Layout::Node& layout_node)
|