aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/lib.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2017-04-07 06:57:08 +0900
committerJosh Matthews <josh@joshmatthews.net>2017-05-15 14:07:41 -0400
commitdabebdfbf5e502e3eef7cb0159b20f0fa5e74f65 (patch)
tree2e206f387ada558e16f19078d1113247f2d68582 /components/layout_thread/lib.rs
parentf3c8f7e0d0fb42f32e3699d07fc0f8002bf564c8 (diff)
downloadservo-dabebdfbf5e502e3eef7cb0159b20f0fa5e74f65.tar.gz
servo-dabebdfbf5e502e3eef7cb0159b20f0fa5e74f65.zip
Root nodes for the duration of their CSS transitions.
This ensures that we can pass a node address as part of the asynchronous transition end notification, making it safe to fire the corresponding DOM event on the node from the script thread. Without explicitly rooting this node when the transition starts, we risk the node being GCed before the transition is complete.
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r--components/layout_thread/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 9e8cc9bc165..2bef4bc1c21 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -478,6 +478,7 @@ impl LayoutThread {
text_index_response: TextIndexResponse(None),
pending_images: vec![],
nodes_from_point_response: vec![],
+ newly_transitioning_nodes: vec![],
})),
error_reporter: CSSErrorReporter {
pipelineid: id,
@@ -1436,11 +1437,14 @@ impl LayoutThread {
document: Option<&ServoLayoutDocument>,
rw_data: &mut LayoutThreadData,
context: &mut LayoutContext) {
+ assert!(rw_data.newly_transitioning_nodes.is_empty());
+
// Kick off animations if any were triggered, expire completed ones.
animation::update_animation_state(&self.constellation_chan,
&self.script_chan,
&mut *self.running_animations.write(),
&mut *self.expired_animations.write(),
+ &mut rw_data.newly_transitioning_nodes,
&self.new_animations_receiver,
self.id,
&self.timer);