diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-05-06 00:50:13 -0500 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-05-06 00:50:13 -0500 |
commit | 5e59e77c416dbe35e8c30ca1c21c9088ed17a079 (patch) | |
tree | 61f2f1c0be9811a4a88024d51cae56463fe3c7d7 /components/layout/animation.rs | |
parent | c303e9dcd599cd6cb59fb6468a9be7fa18eab065 (diff) | |
parent | be2cb665de412c39748b925582646bc2d40725c2 (diff) | |
download | servo-5e59e77c416dbe35e8c30ca1c21c9088ed17a079.tar.gz servo-5e59e77c416dbe35e8c30ca1c21c9088ed17a079.zip |
Auto merge of #5753 - JIoJIaJIu:timeline, r=jdm
RequestAnimationFrame
[Task](https://github.com/servo/servo/issues/5681)
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5753)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/animation.rs')
-rw-r--r-- | components/layout/animation.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 4bf5dd7ab6e..a2a3e1c5459 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -10,8 +10,9 @@ use incremental::{self, RestyleDamage}; use clock_ticks; use gfx::display_list::OpaqueNode; use layout_task::{LayoutTask, LayoutTaskData}; -use msg::constellation_msg::{Msg, PipelineId}; +use msg::constellation_msg::{AnimationState, Msg, PipelineId}; use script::layout_interface::Animation; +use script_traits::{ConstellationControlMsg, ScriptControlChan}; use std::mem; use std::sync::mpsc::Sender; use style::animation::{GetMod, PropertyAnimation}; @@ -51,11 +52,18 @@ pub fn process_new_animations(rw_data: &mut LayoutTaskData, pipeline_id: Pipelin rw_data.running_animations.push(animation) } - let animations_are_running = !rw_data.running_animations.is_empty(); + let animation_state; + if rw_data.running_animations.is_empty() { + animation_state = AnimationState::NoAnimationsPresent; + } else { + animation_state = AnimationState::AnimationsPresent; + } + rw_data.constellation_chan .0 - .send(Msg::ChangeRunningAnimationsState(pipeline_id, animations_are_running)) + .send(Msg::ChangeRunningAnimationsState(pipeline_id, animation_state)) .unwrap(); + } /// Recalculates style for an animation. This does *not* run with the DOM lock held. @@ -100,5 +108,8 @@ pub fn tick_all_animations(layout_task: &LayoutTask, rw_data: &mut LayoutTaskDat rw_data.running_animations.push(running_animation) } } + + let ScriptControlChan(ref chan) = layout_task.script_chan; + chan.send(ConstellationControlMsg::TickAllAnimations(layout_task.id)).unwrap(); } |