diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-04-29 08:38:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 08:38:50 -0400 |
commit | 799490a02e9bea575bf34c39f045ef0883539f05 (patch) | |
tree | 278cada683564db36997cf3f96c92513b89c3096 /components/script/dom/raredata.rs | |
parent | d58ea974baff1b51a43d2e2bf4b287ff11991a8d (diff) | |
parent | 37e88e77cdf00e3555599dd4004d03548bd95dcf (diff) | |
download | servo-799490a02e9bea575bf34c39f045ef0883539f05.tar.gz servo-799490a02e9bea575bf34c39f045ef0883539f05.zip |
Auto merge of #22743 - ferjm:shadowdom, r=emilio
Partial ShadowDOM support
This is just an early WIP, not to take it very seriously yet.
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [x] These changes fix #22719
- [x] There are tests for these changes
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22743)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/raredata.rs')
-rw-r--r-- | components/script/dom/raredata.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/components/script/dom/raredata.rs b/components/script/dom/raredata.rs new file mode 100644 index 00000000000..2372b0b89ab --- /dev/null +++ b/components/script/dom/raredata.rs @@ -0,0 +1,42 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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::root::Dom; +use crate::dom::customelementregistry::{ + CustomElementDefinition, CustomElementReaction, CustomElementState, +}; +use crate::dom::mutationobserver::RegisteredObserver; +use crate::dom::shadowroot::ShadowRoot; +use std::rc::Rc; + +//XXX(ferjm) Ideally merge NodeRareData and ElementRareData so they share +// storage. + +#[derive(Default, JSTraceable, MallocSizeOf)] +#[must_root] +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 containing_shadow_root: Option<Dom<ShadowRoot>>, + /// Registered observers for this node. + pub mutation_observers: Vec<RegisteredObserver>, +} + +#[derive(Default, JSTraceable, MallocSizeOf)] +#[must_root] +pub struct ElementRareData { + /// https://dom.spec.whatwg.org/#dom-element-shadowroot + /// The ShadowRoot this element is host of. + /// XXX This is currently not exposed to web content. Only for + /// internal use. + pub shadow_root: Option<Dom<ShadowRoot>>, + /// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue> + 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: Option<Rc<CustomElementDefinition>>, + /// <https://dom.spec.whatwg.org/#concept-element-custom-element-state> + pub custom_element_state: CustomElementState, +} |