aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/shadowroot.rs
diff options
context:
space:
mode:
authorSimon Wülker <simon.wuelker@arcor.de>2025-03-12 01:09:32 +0100
committerGitHub <noreply@github.com>2025-03-12 00:09:32 +0000
commit8034216d06e540f41ae3a157537dbf58db71bc96 (patch)
treec5b09c30dc868568618194324ec7f6db486f0959 /components/script/dom/shadowroot.rs
parentf527217bdc81faccbc599d7868123561c85441d5 (diff)
downloadservo-8034216d06e540f41ae3a157537dbf58db71bc96.tar.gz
servo-8034216d06e540f41ae3a157537dbf58db71bc96.zip
Implement `ElementInternals::shadowRoot` (#35923)
* Implement ElementInternals::shadowRoot Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Diffstat (limited to 'components/script/dom/shadowroot.rs')
-rw-r--r--components/script/dom/shadowroot.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/components/script/dom/shadowroot.rs b/components/script/dom/shadowroot.rs
index 73d5c13174b..dc33ecc254f 100644
--- a/components/script/dom/shadowroot.rs
+++ b/components/script/dom/shadowroot.rs
@@ -2,6 +2,7 @@
* 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 std::cell::Cell;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
@@ -72,6 +73,9 @@ pub(crate) struct ShadowRoot {
/// <https://dom.spec.whatwg.org/#dom-shadowroot-clonable>
clonable: bool,
+ /// <https://dom.spec.whatwg.org/#shadowroot-available-to-element-internals>
+ available_to_element_internals: Cell<bool>,
+
slots: DomRefCell<HashMap<DOMString, Vec<Dom<HTMLSlotElement>>>>,
}
@@ -103,6 +107,7 @@ impl ShadowRoot {
mode,
slot_assignment_mode,
clonable,
+ available_to_element_internals: Cell::new(false),
slots: Default::default(),
}
}
@@ -252,6 +257,15 @@ impl ShadowRoot {
pub(crate) fn has_slot_descendants(&self) -> bool {
!self.slots.borrow().is_empty()
}
+
+ pub(crate) fn set_available_to_element_internals(&self, value: bool) {
+ self.available_to_element_internals.set(value);
+ }
+
+ /// <https://dom.spec.whatwg.org/#shadowroot-available-to-element-internals>
+ pub(crate) fn is_available_to_element_internals(&self) -> bool {
+ self.available_to_element_internals.get()
+ }
}
impl ShadowRootMethods<crate::DomTypeHolder> for ShadowRoot {