mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-19 07:49:05 +00:00
LibWeb: Stop traversal early when marking nodes for child style update
These flags always propagate to the root, so once we encounter an ancestor with the flag set, we can stop traversal since everything above it will already be set as well.
This commit is contained in:
parent
d21c5631aa
commit
f106aa9e8a
Notes:
github-actions[bot]
2024-10-19 19:14:52 +00:00
Author: https://github.com/awesomekling
Commit: f106aa9e8a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1865
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 2 additions and 0 deletions
|
@ -1174,6 +1174,8 @@ void Node::set_needs_style_update(bool value)
|
||||||
|
|
||||||
if (m_needs_style_update) {
|
if (m_needs_style_update) {
|
||||||
for (auto* ancestor = parent_or_shadow_host(); ancestor; ancestor = ancestor->parent_or_shadow_host()) {
|
for (auto* ancestor = parent_or_shadow_host(); ancestor; ancestor = ancestor->parent_or_shadow_host()) {
|
||||||
|
if (ancestor->m_child_needs_style_update)
|
||||||
|
break;
|
||||||
ancestor->m_child_needs_style_update = true;
|
ancestor->m_child_needs_style_update = true;
|
||||||
}
|
}
|
||||||
document().schedule_style_update();
|
document().schedule_style_update();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue