LibWeb: Make document-level style invalidation fast

Add a flag to DOM::Document that means the whole document needs a style
update. This saves us the trouble of traversing the entire DOM to mark
all nodes as needing a style update.
This commit is contained in:
Andreas Kling 2022-03-19 18:10:59 +01:00
commit 0b861e0c9d
Notes: sideshowbarker 2024-07-17 17:05:06 +09:00
3 changed files with 18 additions and 4 deletions

View file

@ -176,6 +176,13 @@ void Node::set_node_value(const String& value)
void Node::invalidate_style()
{
if (is_document()) {
auto& document = static_cast<DOM::Document&>(*this);
document.set_needs_full_style_update(true);
document.schedule_style_update();
return;
}
for_each_in_inclusive_subtree([&](Node& node) {
node.m_needs_style_update = true;
if (node.has_children())