LibWeb: Make TreeBuilder treat inline-flex's children correctly

We were skipping over inline flex containers when looking for an
insertion parent. This made us not generate flex items in those cases.

This commit changes the behavior, so that non-inline-level items can
get inserted into an inline-outside parent, as long as the parent isn't
just flow-inside.
This commit is contained in:
Andreas Kling 2022-10-06 21:03:30 +02:00
parent 71f7bb619d
commit b6ab9a261f
Notes: sideshowbarker 2024-07-17 06:14:13 +09:00

View file

@ -124,7 +124,9 @@ void TreeBuilder::insert_node_into_inline_or_block_ancestor(Layout::Node& node,
// Non-inlines can't be inserted into an inline parent, so find the nearest non-inline ancestor.
auto& nearest_non_inline_ancestor = [&]() -> Layout::NodeWithStyle& {
for (auto& ancestor : m_ancestor_stack.in_reverse()) {
if (!ancestor.is_inline() || ancestor.is_inline_block())
if (!ancestor.display().is_inline_outside())
return ancestor;
if (!ancestor.display().is_flow_inside())
return ancestor;
}
VERIFY_NOT_REACHED();