mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
LibWeb: Limit style update tree traversal to dirty subtrees
This patch adds a second style dirty bit that tracks whether a DOM node has one or more children with dirty style. This allows the style update to skip over entire subtrees where all nodes are clean.
This commit is contained in:
parent
d1479aef56
commit
6809be436b
3 changed files with 32 additions and 7 deletions
|
@ -254,8 +254,17 @@ void Node::set_needs_style_update(bool value)
|
|||
if (m_needs_style_update == value)
|
||||
return;
|
||||
m_needs_style_update = value;
|
||||
if (m_needs_style_update)
|
||||
|
||||
if (m_needs_style_update) {
|
||||
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent())
|
||||
ancestor->m_child_needs_style_update = true;
|
||||
document().schedule_style_update();
|
||||
}
|
||||
}
|
||||
|
||||
void Node::inserted_into(Node&)
|
||||
{
|
||||
set_needs_style_update(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue