diff options
-rw-r--r-- | components/layout_thread/dom_wrapper.rs | 4 | ||||
-rw-r--r-- | components/style/dom.rs | 3 | ||||
-rw-r--r-- | components/style/gecko/wrapper.rs | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index b9baea95b0e..3161de39b00 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -562,6 +562,10 @@ impl<'le> TElement for ServoLayoutElement<'le> { fn shadow_root(&self) -> Option<ShadowRoot<'le>> { None } + + fn containing_shadow(&self) -> Option<ShadowRoot<'le>> { + None + } } impl<'le> PartialEq for ServoLayoutElement<'le> { diff --git a/components/style/dom.rs b/components/style/dom.rs index 69a4a9a4432..9cd6e29feeb 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -740,6 +740,9 @@ pub trait TElement /// The shadow root this element is a host of. fn shadow_root(&self) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>; + /// The shadow root which roots the subtree this element is contained in. + fn containing_shadow(&self) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>; + /// Return the element which we can use to look up rules in the selector /// maps. /// diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 0475651340e..661bc1137bd 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1068,6 +1068,12 @@ impl<'le> TElement for GeckoElement<'le> { unsafe { slots.mShadowRoot.mRawPtr.as_ref().map(GeckoShadowRoot) } } + #[inline] + fn containing_shadow(&self) -> Option<GeckoShadowRoot<'le>> { + let slots = self.extended_slots()?; + unsafe { slots._base.mContainingShadow.mRawPtr.as_ref().map(GeckoShadowRoot) } + } + /// Execute `f` for each anonymous content child element (apart from /// ::before and ::after) whose originating element is `self`. fn each_anonymous_content_child<F>(&self, mut f: F) |