mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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
Notes:
sideshowbarker
2024-07-17 23:02:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c3059701b0
@ -261,6 +261,11 @@ void Node::invalidate_style()
|
||||
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) {
|
||||
node.m_needs_style_update = true;
|
||||
if (node.has_children())
|
||||
|
Loading…
Reference in New Issue
Block a user