mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Add support for animationend event
This is triggered when an animation finishes. This is a high priority because it allows us to start rooting nodes with animations in the script thread. This doesn't yet cause a lot of tests to pass because they rely on the existence of `Document.getAnimations()` and the presence of `animationstart` and animationiteration` events.
This commit is contained in:
parent
6fb75c2b9e
commit
3903c1fb98
27 changed files with 335 additions and 331 deletions
|
@ -172,6 +172,17 @@ impl KeyframesAnimationState {
|
|||
self.current_direction = old_direction;
|
||||
self.started_at = new_started_at;
|
||||
}
|
||||
|
||||
/// Calculate the active-duration of this animation according to
|
||||
/// https://drafts.csswg.org/css-animations/#active-duration. active-duration
|
||||
/// is not really meaningful for infinite animations so we just return 0
|
||||
/// here in that case.
|
||||
pub fn active_duration(&self) -> f64 {
|
||||
match self.iteration_state {
|
||||
KeyframesIterationState::Finite(_, max) => self.duration * (max as f64),
|
||||
KeyframesIterationState::Infinite => 0.,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for KeyframesAnimationState {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue