mirror of
https://github.com/servo/servo.git
synced 2025-06-21 07:38:59 +01:00
style: Add a shadow root accessor.
I'm going to use it in a bit.
This commit is contained in:
parent
6a2feb3c1b
commit
da99f159f4
1 changed files with 5 additions and 4 deletions
|
@ -226,7 +226,7 @@ impl<'ln> GeckoNode<'ln> {
|
|||
}
|
||||
|
||||
if let Some(parent) = parent_el {
|
||||
if parent.has_shadow_root() || parent.get_xbl_binding().is_some() {
|
||||
if parent.shadow_root().is_some() || parent.get_xbl_binding().is_some() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -519,9 +519,10 @@ impl<'le> GeckoElement<'le> {
|
|||
}
|
||||
|
||||
/// Returns true if this element has a shadow root.
|
||||
fn has_shadow_root(&self) -> bool {
|
||||
self.get_extended_slots()
|
||||
.map_or(false, |slots| !slots.mShadowRoot.mRawPtr.is_null())
|
||||
#[inline]
|
||||
fn shadow_root(&self) -> Option<&structs::ShadowRoot> {
|
||||
let slots = self.get_extended_slots()?;
|
||||
unsafe { slots.mShadowRoot.mRawPtr.as_ref() }
|
||||
}
|
||||
|
||||
/// Returns a reference to the DOM slots for this Element, if they exist.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue