mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibWeb: Avoid style invalidation when entire document has invalid style
If the entire document is invalidated, we know a full style update is coming soon, and there's no need to try and invalidate a smaller part. This avoids a *lot* of work on some pages. As an example, we are able to skip ~1.5 million style invalidations on https://html.spec.whatwg.org/
This commit is contained in:
parent
de32b77ceb
commit
c3059701b0
1 changed files with 5 additions and 0 deletions
|
@ -261,6 +261,11 @@ void Node::invalidate_style()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the document is already marked for a full style update, there's no need to do anything here.
|
||||||
|
if (document().needs_full_style_update()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for_each_in_inclusive_subtree([&](Node& node) {
|
for_each_in_inclusive_subtree([&](Node& node) {
|
||||||
node.m_needs_style_update = true;
|
node.m_needs_style_update = true;
|
||||||
if (node.has_children())
|
if (node.has_children())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue