LibWeb: Skip animation invalidation for elements nested in display none

Paper over the fact we sometimes fail to cancel animations for elements
nested in display none, and do lots of wasted work.
This commit is contained in:
Aliaksandr Kalenik 2025-03-08 18:09:52 +01:00 committed by Andreas Kling
commit 868981a46b
Notes: github-actions[bot] 2025-03-08 23:07:13 +00:00

View file

@ -923,6 +923,13 @@ void KeyframeEffect::update_computed_properties()
if (!target || !target->is_connected())
return;
if (target->has_inclusive_ancestor_with_display_none()) {
// FIXME: Reaching this point means we failed to cancel animation for an element that started
// being nested in "display: none".
// For now this hack is needed to avoid lots of unnecessary work.
return;
}
GC::Ptr<CSS::ComputedProperties> style = {};
if (!pseudo_element_type().has_value())
style = target->computed_properties();