mirror of
https://github.com/servo/servo.git
synced 2025-07-22 06:43:40 +01:00
script: Start replacing time
with std::time
and chrono
(#30639)
* Replace `time` with `chrono` in `script/animation_timeline` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/script_thread.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` and `chrono` in `script/script_thread.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/script_runtime.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/script_runtime.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/workerglobalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `chrono` in `script/dom/workerglobalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlmedialelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlmedialelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/globalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `chrono` in `script/dom/globalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlformelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlformelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Increase precision of animation timeline * Some fixes Use Instant a bit more and stop using chrono. Do not transition `navigation_start_precise` to Instant yet as we need to coordinate this across all crates. --------- Signed-off-by: Auguste Baum <auguste.apple@gmail.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
c06ae7faf2
commit
9654363c18
7 changed files with 62 additions and 61 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use encoding_rs::{Encoding, UTF_8};
|
||||
|
@ -20,7 +21,6 @@ use servo_rand::random;
|
|||
use style::attr::AttrValue;
|
||||
use style::str::split_html_space_chars;
|
||||
use style_traits::dom::ElementState;
|
||||
use time::{now, Duration, Tm};
|
||||
|
||||
use super::bindings::trace::{HashMapTracedValues, NoTrace};
|
||||
use crate::body::Extractable;
|
||||
|
@ -94,7 +94,7 @@ pub struct HTMLFormElement {
|
|||
elements: DomOnceCell<HTMLFormControlsCollection>,
|
||||
generation_id: Cell<GenerationId>,
|
||||
controls: DomRefCell<Vec<Dom<Element>>>,
|
||||
past_names_map: DomRefCell<HashMapTracedValues<Atom, (Dom<Element>, NoTrace<Tm>)>>,
|
||||
past_names_map: DomRefCell<HashMapTracedValues<Atom, (Dom<Element>, NoTrace<Instant>)>>,
|
||||
firing_submission_events: Cell<bool>,
|
||||
rel_list: MutNullableDom<DOMTokenList>,
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
|||
name,
|
||||
(
|
||||
Dom::from_ref(&*element_node.downcast::<Element>().unwrap()),
|
||||
NoTrace(now()),
|
||||
NoTrace(Instant::now()),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -556,7 +556,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
|||
let entry = SourcedName {
|
||||
name: key.clone(),
|
||||
element: DomRoot::from_ref(&*val.0),
|
||||
source: SourcedNameSource::Past(now() - val.1 .0), // calculate difference now()-val.1 to find age
|
||||
source: SourcedNameSource::Past(Instant::now().duration_since(val.1 .0)),
|
||||
};
|
||||
sourced_names_vec.push(entry);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue