1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2023-05-29 05:49:06 +02:00
parent 3ed26e9af8
commit 5857f24bc8

View file

@ -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);
});
}