aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2020-05-18 20:32:27 +0200
committerMartin Robinson <mrobinson@igalia.com>2020-05-21 15:19:34 +0200
commit873cdd13368d904e4723fec1d60ecc04d9dbe03d (patch)
tree5dd6ca295dcdd435dfef0ef98937a3411ec190c6 /components/script/script_thread.rs
parentf02aba1ed2bb38067cf4c32726e8612a48d40ca9 (diff)
downloadservo-873cdd13368d904e4723fec1d60ecc04d9dbe03d.tar.gz
servo-873cdd13368d904e4723fec1d60ecc04d9dbe03d.zip
Implement animationiteration event
This event is triggered when an animation iterates. This change also moves iteration out of style calculation to an "update animations" which is the next part of having animation event handling match the HTML spec.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 41dc5406b4a..d0505b35acf 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -151,7 +151,6 @@ use script_traits::{
};
use servo_atoms::Atom;
use servo_config::opts;
-use servo_config::pref;
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
use std::borrow::Cow;
use std::cell::Cell;
@@ -1650,19 +1649,17 @@ impl ScriptThread {
// TODO(mrobinson): This should also update the current animations to conform to
// the HTML specification.
fn update_animations_and_send_events(&self) {
- for (_, document) in self.documents.borrow().iter() {
- // Only update the time if it isn't being managed by a test.
- if !pref!(layout.animations.test.enabled) {
- document.update_animation_timeline();
- }
- }
-
// We remove the events because handling these events might trigger
// a reflow which might want to add more events to the queue.
let events = self.animation_events.replace(Vec::new());
for event in events.into_iter() {
self.handle_transition_or_animation_event(&event);
}
+
+ for (_, document) in self.documents.borrow().iter() {
+ let update = document.update_animation_timeline();
+ unsafe { ScriptThread::process_animations_update(update) };
+ }
}
fn categorize_msg(&self, msg: &MixedMessage) -> ScriptThreadEventCategory {
@@ -3021,6 +3018,7 @@ impl ScriptThread {
let event_atom = match event.event_type {
TransitionOrAnimationEventType::AnimationEnd => atom!("animationend"),
+ TransitionOrAnimationEventType::AnimationIteration => atom!("animationiteration"),
TransitionOrAnimationEventType::TransitionCancel => atom!("transitioncancel"),
TransitionOrAnimationEventType::TransitionEnd => atom!("transitionend"),
TransitionOrAnimationEventType::TransitionRun => atom!("transitionrun"),