mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
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:
parent
de02a2680f
commit
15a8baee03
Notes:
sideshowbarker
2024-07-17 10:16:43 +09:00
Author: https://github.com/mattco98
Commit: 15a8baee03
Pull-request: https://github.com/SerenityOS/serenity/pull/24427
Issue: https://github.com/SerenityOS/serenity/issues/24424
5 changed files with 38 additions and 2 deletions
|
@ -2103,8 +2103,9 @@ void Document::dispatch_events_for_animation_if_necessary(JS::NonnullGCPtr<Anima
|
|||
}
|
||||
|
||||
if (current_phase == Animations::AnimationEffect::Phase::Idle && previous_phase != Animations::AnimationEffect::Phase::Idle && previous_phase != Animations::AnimationEffect::Phase::After) {
|
||||
// FIXME: Use the active time "at the moment it was cancelled"
|
||||
dispatch_event(HTML::EventNames::animationcancel, effect->active_time_using_fill(Bindings::FillMode::Both).value());
|
||||
// FIXME: Calculate a non-zero time when the animation is cancelled by means other than calling cancel()
|
||||
auto cancel_time = animation->release_saved_cancel_time().value_or(0.0);
|
||||
dispatch_event(HTML::EventNames::animationcancel, cancel_time);
|
||||
}
|
||||
}
|
||||
effect->set_previous_phase(current_phase);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue