mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Make Node and Element rare_data an Option
This commit is contained in:
parent
f6069630d2
commit
6bf1ca20a2
8 changed files with 181 additions and 120 deletions
|
@ -2,14 +2,12 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::bindings::root::MutNullableDom;
|
||||
use crate::dom::bindings::root::Dom;
|
||||
use crate::dom::customelementregistry::{
|
||||
CustomElementDefinition, CustomElementReaction, CustomElementState,
|
||||
};
|
||||
use crate::dom::mutationobserver::RegisteredObserver;
|
||||
use crate::dom::shadowroot::ShadowRoot;
|
||||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Default, JSTraceable, MallocSizeOf)]
|
||||
|
@ -18,9 +16,9 @@ pub struct NodeRareData {
|
|||
/// The shadow root the node belongs to.
|
||||
/// This is None if the node is not in a shadow tree or
|
||||
/// if it is a ShadowRoot.
|
||||
pub owner_shadow_root: MutNullableDom<ShadowRoot>,
|
||||
pub owner_shadow_root: Option<Dom<ShadowRoot>>,
|
||||
/// Registered observers for this node.
|
||||
pub mutation_observers: DomRefCell<Vec<RegisteredObserver>>,
|
||||
pub mutation_observers: Vec<RegisteredObserver>,
|
||||
}
|
||||
|
||||
#[derive(Default, JSTraceable, MallocSizeOf)]
|
||||
|
@ -29,12 +27,12 @@ pub struct ElementRareData {
|
|||
/// https://dom.spec.whatwg.org/#dom-element-shadowroot
|
||||
/// XXX This is currently not exposed to web content. Only for
|
||||
/// internal use.
|
||||
pub shadow_root: MutNullableDom<ShadowRoot>,
|
||||
pub shadow_root: Option<Dom<ShadowRoot>>,
|
||||
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
|
||||
pub custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
|
||||
pub custom_element_reaction_queue: Vec<CustomElementReaction>,
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-definition>
|
||||
#[ignore_malloc_size_of = "Rc"]
|
||||
pub custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
|
||||
pub custom_element_definition: Option<Rc<CustomElementDefinition>>,
|
||||
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||
pub custom_element_state: Cell<CustomElementState>,
|
||||
pub custom_element_state: CustomElementState,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue