From 1881761d0f0288d3332bdcae6b0df979fc1168ba Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 15 Mar 2022 21:01:26 +0100 Subject: [PATCH] LibWeb: Fix mistake in Node::invalidate_style() We were not actually walking past the first ancestor when setting child-needs-update bit upwards. Also, let's walk all the way to the root, even if there's a child-needs-update bit already set. This ensures that we always leave this function with the ancestor chain in a sane state. --- Userland/Libraries/LibWeb/DOM/Node.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index dcea0438c0..ee91ec5e25 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -188,11 +188,8 @@ void Node::invalidate_style() } return IterationDecision::Continue; }); - for (auto* ancestor = parent_or_shadow_host(); ancestor; ancestor = parent_or_shadow_host()) { - if (ancestor->m_child_needs_style_update) - break; + for (auto* ancestor = parent_or_shadow_host(); ancestor; ancestor = ancestor->parent_or_shadow_host()) ancestor->m_child_needs_style_update = true; - } document().schedule_style_update(); }