mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
updated past_names_map to save time info
This commit is contained in:
parent
7b968a3ca8
commit
16b9efc406
2 changed files with 9 additions and 5 deletions
|
@ -143,13 +143,15 @@ use style::values::specified::Length;
|
||||||
use tendril::fmt::UTF8;
|
use tendril::fmt::UTF8;
|
||||||
use tendril::stream::LossyDecoder;
|
use tendril::stream::LossyDecoder;
|
||||||
use tendril::{StrTendril, TendrilSink};
|
use tendril::{StrTendril, TendrilSink};
|
||||||
use time::{Duration, Timespec};
|
use time::{Duration, Timespec, Tm};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use webgpu::{WebGPU, WebGPUAdapter};
|
use webgpu::{WebGPU, WebGPUAdapter};
|
||||||
use webrender_api::{DocumentId, ImageKey, RenderApiSender};
|
use webrender_api::{DocumentId, ImageKey, RenderApiSender};
|
||||||
use webvr_traits::{WebVRGamepadData, WebVRGamepadHand, WebVRGamepadState};
|
use webvr_traits::{WebVRGamepadData, WebVRGamepadHand, WebVRGamepadState};
|
||||||
use webxr_api::SwapChainId as WebXRSwapChainId;
|
use webxr_api::SwapChainId as WebXRSwapChainId;
|
||||||
|
|
||||||
|
unsafe_no_jsmanaged_fields!(Tm);
|
||||||
|
|
||||||
/// A trait to allow tracing (only) DOM objects.
|
/// A trait to allow tracing (only) DOM objects.
|
||||||
pub unsafe trait JSTraceable {
|
pub unsafe trait JSTraceable {
|
||||||
/// Trace `self`.
|
/// Trace `self`.
|
||||||
|
|
|
@ -67,6 +67,8 @@ use style::str::split_html_space_chars;
|
||||||
use crate::dom::bindings::codegen::UnionTypes::RadioNodeListOrElement;
|
use crate::dom::bindings::codegen::UnionTypes::RadioNodeListOrElement;
|
||||||
use crate::dom::radionodelist::RadioNodeList;
|
use crate::dom::radionodelist::RadioNodeList;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use time::{now, Tm, Duration};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
pub struct GenerationId(u32);
|
pub struct GenerationId(u32);
|
||||||
|
@ -80,7 +82,7 @@ pub struct HTMLFormElement {
|
||||||
elements: DomOnceCell<HTMLFormControlsCollection>,
|
elements: DomOnceCell<HTMLFormControlsCollection>,
|
||||||
generation_id: Cell<GenerationId>,
|
generation_id: Cell<GenerationId>,
|
||||||
controls: DomRefCell<Vec<Dom<Element>>>,
|
controls: DomRefCell<Vec<Dom<Element>>>,
|
||||||
past_names_map: DomRefCell<HashMap<DOMString, Dom<Element>>>,
|
past_names_map: DomRefCell<HashMap<DOMString, (Dom<Element>, Tm)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFormElement {
|
impl HTMLFormElement {
|
||||||
|
@ -300,7 +302,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
||||||
if candidates.len() == 0 {
|
if candidates.len() == 0 {
|
||||||
if past_names_map.contains_key(&name) {
|
if past_names_map.contains_key(&name) {
|
||||||
return Some(RadioNodeListOrElement::Element(DomRoot::from_ref(
|
return Some(RadioNodeListOrElement::Element(DomRoot::from_ref(
|
||||||
&*past_names_map.get(&name).unwrap(),
|
&*past_names_map.get(&name).unwrap().0,
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
|
@ -315,7 +317,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
||||||
let element_node = &candidates[0];
|
let element_node = &candidates[0];
|
||||||
past_names_map.insert(
|
past_names_map.insert(
|
||||||
name,
|
name,
|
||||||
Dom::from_ref(&*element_node.downcast::<Element>().unwrap()),
|
(Dom::from_ref(&*element_node.downcast::<Element>().unwrap()), now()),
|
||||||
);
|
);
|
||||||
|
|
||||||
return Some(RadioNodeListOrElement::Element(DomRoot::from_ref(
|
return Some(RadioNodeListOrElement::Element(DomRoot::from_ref(
|
||||||
|
@ -328,7 +330,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
||||||
enum SourcedNameSource {
|
enum SourcedNameSource {
|
||||||
Id,
|
Id,
|
||||||
Name,
|
Name,
|
||||||
Past(std::time::Duration),
|
Past(Duration),
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SourcedName {
|
struct SourcedName {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue