aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlformelement.rs
diff options
context:
space:
mode:
authorAuguste Baum <52001167+augustebaum@users.noreply.github.com>2024-01-16 13:23:18 +0100
committerGitHub <noreply@github.com>2024-01-16 12:23:18 +0000
commit9654363c187ee549b82bca8c4e3098e4c20c7287 (patch)
tree83744130e3842433d89e1011fadc0f6db172aa2b /components/script/dom/htmlformelement.rs
parentc06ae7faf201e539a4cfbaefb6d5b8444796f472 (diff)
downloadservo-9654363c187ee549b82bca8c4e3098e4c20c7287.tar.gz
servo-9654363c187ee549b82bca8c4e3098e4c20c7287.zip
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>
Diffstat (limited to 'components/script/dom/htmlformelement.rs')
-rw-r--r--components/script/dom/htmlformelement.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index bbd12d4d491..06a97771a38 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -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);
}