LibWeb/DOM: Don't assume that Animations have an associated effect

Fixes a crash on:
 - css/css-transitions/CSSTransition-effect.tentative.html
This commit is contained in:
Lucas CHOLLET
2024-12-27 22:31:47 -05:00
committed by Andreas Kling
parent 42a8effae5
commit 9585aeafda
4 changed files with 586 additions and 0 deletions

View File

@@ -4741,6 +4741,10 @@ void Document::update_animations_and_send_events(Optional<double> const& timesta
// 6. Perform a stable sort of the animation events in events to dispatch as follows:
auto sort_events_by_composite_order = [](auto const& a, auto const& b) {
if (!a.animation->effect())
return true;
if (!b.animation->effect())
return false;
auto& a_effect = verify_cast<Animations::KeyframeEffect>(*a.animation->effect());
auto& b_effect = verify_cast<Animations::KeyframeEffect>(*b.animation->effect());
return Animations::KeyframeEffect::composite_order(a_effect, b_effect) < 0;