summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibWeb/Layout/TreeBuilder.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Libraries/LibWeb/Layout/TreeBuilder.cpp
index 981b881be9..7d7b349433 100644
--- a/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -115,15 +115,15 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node)
insertion_point.append_child(*layout_node);
insertion_point.set_children_are_inline(true);
} else {
- // Blocks can't be inserted into an inline parent, so find the nearest block ancestor.
- auto& nearest_block_ancestor = [&]() -> Layout::Node& {
+ // Blocks can't be inserted into an inline parent, so find the nearest non-inline ancestor.
+ auto& nearest_non_inline_ancestor = [&]() -> Layout::Node& {
for (ssize_t i = m_parent_stack.size() - 1; i >= 0; --i) {
- if (m_parent_stack[i]->is_block())
+ if (!m_parent_stack[i]->is_inline())
return *m_parent_stack[i];
}
ASSERT_NOT_REACHED();
}();
- auto& insertion_point = insertion_parent_for_block_node(nearest_block_ancestor, *layout_node);
+ auto& insertion_point = insertion_parent_for_block_node(nearest_non_inline_ancestor, *layout_node);
insertion_point.append_child(*layout_node);
insertion_point.set_children_are_inline(false);
}