diff options
author | Martin Robinson <mrobinson@igalia.com> | 2020-04-29 12:19:21 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2020-05-01 15:29:57 +0200 |
commit | 3903c1fb98373ae08323c36e147f2f041d6f0280 (patch) | |
tree | a6f8a7ac23540c944ceefbf526a1fcf8def91968 /components/layout_thread/lib.rs | |
parent | 6fb75c2b9eb3825932a22b1c7a6d7ce03809fbb2 (diff) | |
download | servo-3903c1fb98373ae08323c36e147f2f041d6f0280.tar.gz servo-3903c1fb98373ae08323c36e147f2f041d6f0280.zip |
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.
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r-- | components/layout_thread/lib.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 4a346315e8a..046a9a6f30e 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -648,7 +648,7 @@ impl LayoutThread { } else { None }, - newly_transitioning_nodes: if script_initiated_layout { + newly_animating_nodes: if script_initiated_layout { Some(Mutex::new(vec![])) } else { None @@ -1565,11 +1565,11 @@ impl LayoutThread { }; reflow_result.pending_images = pending_images; - let newly_transitioning_nodes = match context.newly_transitioning_nodes { + let newly_animating_nodes = match context.newly_animating_nodes { Some(ref nodes) => std::mem::replace(&mut *nodes.lock().unwrap(), vec![]), None => vec![], }; - reflow_result.newly_transitioning_nodes = newly_transitioning_nodes; + reflow_result.newly_animating_nodes = newly_animating_nodes; let mut root_flow = match self.root_flow.borrow().clone() { Some(root_flow) => root_flow, @@ -1741,7 +1741,7 @@ impl LayoutThread { invalid_nodes, ); assert!(layout_context.pending_images.is_none()); - assert!(layout_context.newly_transitioning_nodes.is_none()); + assert!(layout_context.newly_animating_nodes.is_none()); } } @@ -1756,19 +1756,13 @@ impl LayoutThread { invalid_nodes: FxHashSet<OpaqueNode>, ) { { - let mut newly_transitioning_nodes = context - .newly_transitioning_nodes + let mut newly_animating_nodes = context + .newly_animating_nodes .as_ref() .map(|nodes| nodes.lock().unwrap()); - let newly_transitioning_nodes = - newly_transitioning_nodes.as_mut().map(|nodes| &mut **nodes); + let newly_animating_nodes = newly_animating_nodes.as_mut().map(|nodes| &mut **nodes); let mut animation_states = self.animation_states.write(); - - animation::collect_newly_transitioning_nodes( - &animation_states, - newly_transitioning_nodes, - ); - + animation::collect_newly_animating_nodes(&animation_states, newly_animating_nodes); animation::update_animation_states( &self.constellation_chan, &self.script_chan, |