mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
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>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user