From b19f62217ff0bfd6f0107f0ce67fa91eb197e434 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 29 Nov 2020 22:24:53 +0100 Subject: [PATCH] LibWeb: Allow inline-block boxes to have non-inline children We were incorrectly hoisting non-inline children of inline-block boxes to the nearest non-inline ancestor. Since inline-block boxes are only inline on the *outside*, it's fine for them to have non-inline children. Eventually we should clarify these relationships by making the inside and outside display types more explicit. --- Libraries/LibWeb/Layout/TreeBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Libraries/LibWeb/Layout/TreeBuilder.cpp index de9885cab59..17ab36d8f1b 100644 --- a/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -118,7 +118,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node) // Non-inlines 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_inline()) + if (!m_parent_stack[i]->is_inline() || m_parent_stack[i]->is_inline_block()) return *m_parent_stack[i]; } ASSERT_NOT_REACHED();