From b4c90e35df3280fc5ec13dda7991c7caf0bb443d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 6 Oct 2022 16:21:11 +0200 Subject: [PATCH] LibWeb: Use CSS::Display::is_flow_inside() in InlineLevelIterator This is a more correct check than !is_inline_block(), as it now enters all elements that have inline behavior on the outside and flow behavior on the inside. --- .../Libraries/LibWeb/Layout/InlineLevelIterator.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp index 87961ba726a..cc4e2daf279 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp @@ -68,7 +68,10 @@ void InlineLevelIterator::exit_node_with_box_model_metrics() // This is similar to Layout::Node::next_in_pre_order() but will not descend into inline-block nodes. Layout::Node const* InlineLevelIterator::next_inline_node_in_pre_order(Layout::Node const& current, Layout::Node const* stay_within) { - if (current.first_child() && current.first_child()->is_inline() && !current.is_inline_block() && !current.is_replaced_box()) { + if (current.first_child() + && current.first_child()->display().is_inline_outside() + && current.display().is_flow_inside() + && !current.is_replaced_box()) { if (!current.is_box() || !static_cast(current).is_out_of_flow(m_inline_formatting_context)) return current.first_child(); } @@ -107,7 +110,11 @@ void InlineLevelIterator::compute_next() void InlineLevelIterator::skip_to_next() { - if (m_next_node && is(*m_next_node) && !m_next_node->is_inline_block() && !m_next_node->is_out_of_flow(m_inline_formatting_context) && !is(m_next_node)) + if (m_next_node + && is(*m_next_node) + && m_next_node->display().is_flow_inside() + && !m_next_node->is_out_of_flow(m_inline_formatting_context) + && !m_next_node->is_replaced_box()) enter_node_with_box_model_metrics(static_cast(*m_next_node)); m_current_node = m_next_node;