summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-05-29 05:49:06 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-29 06:05:03 +0200
commit5857f24bc8dba4e3decf017bea9a9040f3570081 (patch)
tree624f4526373af4e74b52201b6eccbcc289738e70
parent3ed26e9af889c305fa66272f94c7d7fd66a7c6fe (diff)
downloadserenity-5857f24bc8dba4e3decf017bea9a9040f3570081.zip
LibWeb: Only update style for the element being animated by CSS
Unlike DOM mutations, CSS animations don't affect the style of the entire subtree of the element being animated. This means we only have to recompute style for the animating element, which is significantly faster than doing the whole subtree. This takes idle CPU usage on https://shopify.com/ from 100% to 30% on my (not massively powerful) laptop. :^)
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleComputer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
index cb175090ec..a4ee6234d0 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -1325,7 +1325,7 @@ void StyleComputer::ensure_animation_timer() const
m_active_animations.remove(key);
for (auto* element : owning_elements_to_invalidate)
- element->invalidate_style();
+ element->set_needs_style_update(true);
});
}