mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01: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:
parent
f527217bdc
commit
8034216d06
7 changed files with 44 additions and 12 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue