mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +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]
|
[dependencies.util]
|
||||||
path = "../util"
|
path = "../util"
|
||||||
|
|
||||||
[dependencies.clock_ticks]
|
|
||||||
git = "https://github.com/tomaka/clock_ticks"
|
|
||||||
|
|
||||||
[dependencies.ipc-channel]
|
[dependencies.ipc-channel]
|
||||||
git = "https://github.com/servo/ipc-channel"
|
git = "https://github.com/servo/ipc-channel"
|
||||||
|
|
||||||
|
@ -75,6 +72,7 @@ euclid = {version = "0.4", features = ["plugins"]}
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
serde_json = "0.5"
|
serde_json = "0.5"
|
||||||
|
time = "0.1"
|
||||||
unicode-bidi = "0.2"
|
unicode-bidi = "0.2"
|
||||||
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
||||||
url = "0.5"
|
url = "0.5"
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! CSS transitions and animations.
|
//! CSS transitions and animations.
|
||||||
|
|
||||||
use clock_ticks;
|
|
||||||
use flow::{self, Flow};
|
use flow::{self, Flow};
|
||||||
use gfx::display_list::OpaqueNode;
|
use gfx::display_list::OpaqueNode;
|
||||||
use incremental::{self, RestyleDamage};
|
use incremental::{self, RestyleDamage};
|
||||||
|
@ -17,6 +16,7 @@ use std::sync::mpsc::{Sender, Receiver};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use style::animation::{GetMod, PropertyAnimation};
|
use style::animation::{GetMod, PropertyAnimation};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
|
use time;
|
||||||
|
|
||||||
/// Inserts transitions into the queue of running animations as applicable for the given style
|
/// 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
|
/// 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);
|
property_animation.update(new_style, 0.0);
|
||||||
|
|
||||||
// Kick off the animation.
|
// 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 animation_style = new_style.get_animation();
|
||||||
let start_time =
|
let start_time =
|
||||||
now + (animation_style.transition_delay.0.get_mod(i).seconds() as f64);
|
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.
|
// Expire old running animations.
|
||||||
let now = clock_ticks::precise_time_s();
|
let now = time::precise_time_s();
|
||||||
let mut keys_to_remove = Vec::new();
|
let mut keys_to_remove = Vec::new();
|
||||||
for (key, running_animations) in running_animations.iter_mut() {
|
for (key, running_animations) in running_animations.iter_mut() {
|
||||||
let mut animations_still_running = vec![];
|
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,
|
pub fn update_style_for_animation(animation: &Animation,
|
||||||
style: &mut Arc<ComputedValues>,
|
style: &mut Arc<ComputedValues>,
|
||||||
damage: Option<&mut RestyleDamage>) {
|
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();
|
let mut progress = (now - animation.start_time) / animation.duration();
|
||||||
if progress > 1.0 {
|
if progress > 1.0 {
|
||||||
progress = 1.0
|
progress = 1.0
|
||||||
|
|
|
@ -23,7 +23,6 @@ extern crate azure;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
extern crate canvas_traits;
|
extern crate canvas_traits;
|
||||||
extern crate clock_ticks;
|
|
||||||
extern crate cssparser;
|
extern crate cssparser;
|
||||||
extern crate encoding;
|
extern crate encoding;
|
||||||
extern crate euclid;
|
extern crate euclid;
|
||||||
|
@ -52,6 +51,7 @@ extern crate smallvec;
|
||||||
#[macro_use(atom, ns)] extern crate string_cache;
|
#[macro_use(atom, ns)] extern crate string_cache;
|
||||||
extern crate style;
|
extern crate style;
|
||||||
extern crate style_traits;
|
extern crate style_traits;
|
||||||
|
extern crate time;
|
||||||
extern crate unicode_bidi;
|
extern crate unicode_bidi;
|
||||||
extern crate unicode_script;
|
extern crate unicode_script;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
10
components/servo/Cargo.lock
generated
10
components/servo/Cargo.lock
generated
|
@ -227,14 +227,6 @@ dependencies = [
|
||||||
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clock_ticks"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://github.com/tomaka/clock_ticks#d4b7f5d53d400ae47f20487ebbbf071c351ea40e"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
@ -949,7 +941,6 @@ dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"canvas 0.0.1",
|
"canvas 0.0.1",
|
||||||
"canvas_traits 0.0.1",
|
"canvas_traits 0.0.1",
|
||||||
"clock_ticks 0.1.0 (git+https://github.com/tomaka/clock_ticks)",
|
|
||||||
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -975,6 +966,7 @@ dependencies = [
|
||||||
"string_cache 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
10
ports/cef/Cargo.lock
generated
10
ports/cef/Cargo.lock
generated
|
@ -216,14 +216,6 @@ dependencies = [
|
||||||
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clock_ticks"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://github.com/tomaka/clock_ticks#d4b7f5d53d400ae47f20487ebbbf071c351ea40e"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -909,7 +901,6 @@ dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"canvas 0.0.1",
|
"canvas 0.0.1",
|
||||||
"canvas_traits 0.0.1",
|
"canvas_traits 0.0.1",
|
||||||
"clock_ticks 0.1.0 (git+https://github.com/tomaka/clock_ticks)",
|
|
||||||
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -935,6 +926,7 @@ dependencies = [
|
||||||
"string_cache 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
10
ports/gonk/Cargo.lock
generated
10
ports/gonk/Cargo.lock
generated
|
@ -207,14 +207,6 @@ dependencies = [
|
||||||
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clock_ticks"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://github.com/tomaka/clock_ticks#d4b7f5d53d400ae47f20487ebbbf071c351ea40e"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cocoa"
|
name = "cocoa"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
@ -885,7 +877,6 @@ dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"canvas 0.0.1",
|
"canvas 0.0.1",
|
||||||
"canvas_traits 0.0.1",
|
"canvas_traits 0.0.1",
|
||||||
"clock_ticks 0.1.0 (git+https://github.com/tomaka/clock_ticks)",
|
|
||||||
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -911,6 +902,7 @@ dependencies = [
|
||||||
"string_cache 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"string_cache 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue