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
commit 9585aeafda
Notes: github-actions[bot] 2024-12-28 10:51:37 +00:00
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;