From 9dd59e06731e8806f11f63b30e0b2126d8cb22cd Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 17 Feb 2025 19:29:01 +0100 Subject: [PATCH] LibWeb: Early return when invalidations=none in animation style update This allows to skip a bunch of unnecessary work performed by `apply_style()`. --- Libraries/LibWeb/Animations/KeyframeEffect.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cpp index ceb6c237263..826d9ab7cea 100644 --- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -938,6 +938,9 @@ void KeyframeEffect::update_computed_properties() auto invalidation = compute_required_invalidation(animated_properties_before_update, style->animated_property_values()); + if (invalidation.is_none()) + return; + // Traversal of the subtree is necessary to update the animated properties inherited from the target element. target->for_each_in_subtree_of_type([&](auto& element) { auto element_invalidation = element.recompute_inherited_style();