From 3ca26c7a7a4d6817b13cb8c50f921bf5388e24e3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 26 Feb 2022 09:25:24 +0100 Subject: [PATCH] LibWeb: Fix InlineLevelIterator not exiting box model metric nodes We were neglecting to pop nodes from the box model stack. The metrics were already being zeroed out when used, but let's not grow the stack needlessly. --- Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp index 69d2763f0d..a0ed2c6f93 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp @@ -86,6 +86,12 @@ Layout::Node const* InlineLevelIterator::next_inline_node_in_pre_order(Layout::N return nullptr; } + // If node is the last node on the "box model node stack", pop it off. + if (!m_box_model_node_stack.is_empty() + && &m_box_model_node_stack.last() == node) { + exit_node_with_box_model_metrics(); + } + return next; }