LibWeb: Save time for animationcancel event before transitioning to idle

The if statement in the dispatch implies we are in the idle state, so of
course the active time will always be undefined. If this was cancelled
via a call to cancel(), we can save the time at that point. Otherwise,
just send 0.
This commit is contained in:
Matthew Olsson 2024-05-23 19:17:52 -07:00 committed by Andreas Kling
commit 15a8baee03
Notes: sideshowbarker 2024-07-17 10:16:43 +09:00
5 changed files with 38 additions and 2 deletions

View file

@ -470,6 +470,10 @@ void Animation::cancel(ShouldInvalidate should_invalidate)
// 3. Make animations start time unresolved.
m_start_time = {};
// This time is needed for dispatching the animationcancel DOM event
if (auto effect = m_effect)
m_saved_cancel_time = effect->active_time_using_fill(Bindings::FillMode::Both);
if (should_invalidate == ShouldInvalidate::Yes)
invalidate_effect();
}