mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09: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
Notes:
sideshowbarker
2024-07-19 00:53:05 +09:00
Author: https://github.com/awesomekling
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