Bug 1643201 - servo: 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.

Depends on D78186

Differential Revision: https://phabricator.services.mozilla.com/D78187
This commit is contained in:
Martin Robinson 2020-06-04 00:34:12 +00:00
Родитель 05ab25fd1b
Коммит f879808ac6
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -173,6 +173,17 @@ impl KeyframesAnimationState {
self.current_direction = old_direction; self.current_direction = old_direction;
self.started_at = new_started_at; 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 { impl fmt::Debug for KeyframesAnimationState {