aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/animation.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-07-20 13:38:31 -0500
committerGitHub <noreply@github.com>2016-07-20 13:38:31 -0500
commit14aeccc33ab44d706df86fbce67339218efe710c (patch)
tree623b24534550a56755d440d48f5a89cff6171ded /components/layout/animation.rs
parent46db988b906fbec0286fa07387bb34e76a5b3a94 (diff)
parent0b67b218d0c8dc48a5301227802296aff98af6d7 (diff)
downloadservo-14aeccc33ab44d706df86fbce67339218efe710c.tar.gz
servo-14aeccc33ab44d706df86fbce67339218efe710c.zip
Auto merge of #12392 - emilio:test-animations, r=SimonSapin
style: Add support to test animations programatically. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12120 <!-- Either: --> - [x] There are tests for these changes OR <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @SimonSapin for the style changes, @Ms2ger or @jdm for the dom and test changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12392) <!-- Reviewable:end -->
Diffstat (limited to 'components/layout/animation.rs')
-rw-r--r--components/layout/animation.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs
index 4087479ed47..5a67b1af5bf 100644
--- a/components/layout/animation.rs
+++ b/components/layout/animation.rs
@@ -14,7 +14,7 @@ use script_traits::{AnimationState, LayoutMsg as ConstellationMsg};
use std::collections::HashMap;
use std::sync::mpsc::Receiver;
use style::animation::{Animation, update_style_for_animation};
-use time;
+use style::timer::Timer;
/// Processes any new animations that were discovered after style recalculation.
/// Also expire any old animations that have completed, inserting them into
@@ -23,7 +23,8 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
running_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
expired_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
new_animations_receiver: &Receiver<Animation>,
- pipeline_id: PipelineId) {
+ pipeline_id: PipelineId,
+ timer: &Timer) {
let mut new_running_animations = vec![];
while let Ok(animation) = new_animations_receiver.try_recv() {
let mut should_push = true;
@@ -37,7 +38,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
if let Animation::Keyframes(_, ref anim_name, ref mut anim_state) = *anim {
if *name == *anim_name {
debug!("update_animation_state: Found other animation {}", name);
- anim_state.update_from_other(&state);
+ anim_state.update_from_other(&state, timer);
should_push = false;
break;
}
@@ -57,7 +58,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
return
}
- let now = time::precise_time_s();
+ let now = timer.seconds();
// Expire old running animations.
//
// TODO: Do not expunge Keyframes animations, since we need that state if