mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Move from clock_ticks to time.
This is recommended at <https://github.com/tomaka/clock_ticks>.
This commit is contained in:
parent
f5d05a39af
commit
2e40297885
6 changed files with 9 additions and 35 deletions
|
@ -53,9 +53,6 @@ path = "../profile_traits"
|
|||
[dependencies.util]
|
||||
path = "../util"
|
||||
|
||||
[dependencies.clock_ticks]
|
||||
git = "https://github.com/tomaka/clock_ticks"
|
||||
|
||||
[dependencies.ipc-channel]
|
||||
git = "https://github.com/servo/ipc-channel"
|
||||
|
||||
|
@ -75,6 +72,7 @@ euclid = {version = "0.4", features = ["plugins"]}
|
|||
serde = "0.6"
|
||||
serde_macros = "0.6"
|
||||
serde_json = "0.5"
|
||||
time = "0.1"
|
||||
unicode-bidi = "0.2"
|
||||
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
||||
url = "0.5"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! CSS transitions and animations.
|
||||
|
||||
use clock_ticks;
|
||||
use flow::{self, Flow};
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use incremental::{self, RestyleDamage};
|
||||
|
@ -17,6 +16,7 @@ use std::sync::mpsc::{Sender, Receiver};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use style::animation::{GetMod, PropertyAnimation};
|
||||
use style::properties::ComputedValues;
|
||||
use time;
|
||||
|
||||
/// Inserts transitions into the queue of running animations as applicable for the given style
|
||||
/// difference. This is called from the layout worker threads. Returns true if any animations were
|
||||
|
@ -35,7 +35,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Mutex<Sender<Anim
|
|||
property_animation.update(new_style, 0.0);
|
||||
|
||||
// Kick off the animation.
|
||||
let now = clock_ticks::precise_time_s();
|
||||
let now = time::precise_time_s();
|
||||
let animation_style = new_style.get_animation();
|
||||
let start_time =
|
||||
now + (animation_style.transition_delay.0.get_mod(i).seconds() as f64);
|
||||
|
@ -73,7 +73,7 @@ pub fn update_animation_state(constellation_chan: &ConstellationChan<Constellati
|
|||
}
|
||||
|
||||
// Expire old running animations.
|
||||
let now = clock_ticks::precise_time_s();
|
||||
let now = time::precise_time_s();
|
||||
let mut keys_to_remove = Vec::new();
|
||||
for (key, running_animations) in running_animations.iter_mut() {
|
||||
let mut animations_still_running = vec![];
|
||||
|
@ -145,7 +145,7 @@ pub fn recalc_style_for_animations(flow: &mut Flow,
|
|||
pub fn update_style_for_animation(animation: &Animation,
|
||||
style: &mut Arc<ComputedValues>,
|
||||
damage: Option<&mut RestyleDamage>) {
|
||||
let now = clock_ticks::precise_time_s();
|
||||
let now = time::precise_time_s();
|
||||
let mut progress = (now - animation.start_time) / animation.duration();
|
||||
if progress > 1.0 {
|
||||
progress = 1.0
|
||||
|
|
|
@ -23,7 +23,6 @@ extern crate azure;
|
|||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
extern crate canvas_traits;
|
||||
extern crate clock_ticks;
|
||||
extern crate cssparser;
|
||||
extern crate encoding;
|
||||
extern crate euclid;
|
||||
|
@ -52,6 +51,7 @@ extern crate smallvec;
|
|||
#[macro_use(atom, ns)] extern crate string_cache;
|
||||
extern crate style;
|
||||
extern crate style_traits;
|
||||
extern crate time;
|
||||
extern crate unicode_bidi;
|
||||
extern crate unicode_script;
|
||||
extern crate url;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue