aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2020-04-23 17:06:24 +0200
committerMartin Robinson <mrobinson@igalia.com>2020-04-24 14:20:37 +0200
commitd386d6d1f1e1dba33b49e0b44d9216128f29da1c (patch)
treefe253bdd7d28cc06a606af1e6f9cc39332848652 /components/script/script_thread.rs
parent0540c4a284952145773e3c86d0f57f69a83283f1 (diff)
downloadservo-d386d6d1f1e1dba33b49e0b44d9216128f29da1c.tar.gz
servo-d386d6d1f1e1dba33b49e0b44d9216128f29da1c.zip
Add support for transitionrun events
These events are triggered as soon as a transition is added to the list of running transitions. This will allow better test coverage while reworking the transitions and animations processing model.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 7a672851ba6..606ac81493e 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -2920,22 +2920,20 @@ impl ScriptThread {
let js_runtime = self.js_runtime.rt();
let node = unsafe { from_untrusted_node_address(js_runtime, unsafe_node) };
- let idx = self
+ let node_index = self
.transitioning_nodes
.borrow()
.iter()
.position(|n| &**n as *const _ == &*node as *const _);
- match idx {
- Some(idx) => {
- self.transitioning_nodes.borrow_mut().remove(idx);
- },
+ let node_index = match node_index {
+ Some(node_index) => node_index,
None => {
// If no index is found, we can't know whether this node is safe to use.
// It's better not to fire a DOM event than crash.
warn!("Ignoring transition end notification for unknown node.");
return;
},
- }
+ };
if self.closed_pipelines.borrow().contains(&pipeline_id) {
warn!("Ignoring transition event for closed pipeline.");
@@ -2943,12 +2941,17 @@ impl ScriptThread {
}
let event_atom = match event_type {
+ TransitionEventType::TransitionRun => atom!("transitionrun"),
TransitionEventType::TransitionEnd => {
// Not quite the right thing - see #13865.
node.dirty(NodeDamage::NodeStyleDamaged);
+ self.transitioning_nodes.borrow_mut().remove(node_index);
atom!("transitionend")
},
- TransitionEventType::TransitionCancel => atom!("transitioncancel"),
+ TransitionEventType::TransitionCancel => {
+ self.transitioning_nodes.borrow_mut().remove(node_index);
+ atom!("transitioncancel")
+ },
};
let event_init = TransitionEventInit {