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.
This commit is contained in:
Andreas Kling 2022-03-15 21:01:26 +01:00
parent b4bda4cdf3
commit 1881761d0f

View file

@ -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();
}