diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index ace76867217..f4081ed7aa5 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -814,6 +814,21 @@ impl<'le> GeckoElement<'le> { (!self.as_node().is_in_shadow_tree() && self.has_xbl_binding_parent()) } + /// Returns true if this node is the shadow root of an use-element shadow tree. + #[inline] + fn is_root_of_use_element_shadow_tree(&self) -> bool { + if !self.is_root_of_anonymous_subtree() { + return false + } + match self.parent_element() { + Some(e) => { + e.local_name() == &*local_name!("use") && + e.namespace() == &*ns!("http://www.w3.org/2000/svg") + }, + None => false, + } + } + fn css_transitions_info(&self) -> FnvHashMap> { use gecko_bindings::bindings::Gecko_ElementTransitions_EndValueAt; use gecko_bindings::bindings::Gecko_ElementTransitions_Length; @@ -2103,10 +2118,14 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { } true } + NonTSPseudoClass::MozNativeAnonymous => { + self.is_in_native_anonymous_subtree() + } + NonTSPseudoClass::MozUseShadowTreeRoot => { + self.is_root_of_use_element_shadow_tree() + } NonTSPseudoClass::MozTableBorderNonzero | - NonTSPseudoClass::MozBrowserFrame | - NonTSPseudoClass::MozNativeAnonymous | - NonTSPseudoClass::MozUseShadowTreeRoot => unsafe { + NonTSPseudoClass::MozBrowserFrame => unsafe { Gecko_MatchesElement(pseudo_class.to_gecko_pseudoclasstype().unwrap(), self.0) }, NonTSPseudoClass::MozIsHTML => { @@ -2235,20 +2254,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { #[inline] fn blocks_ancestor_combinators(&self) -> bool { - if !self.is_root_of_anonymous_subtree() { - return false - } - - match self.parent_element() { - Some(e) => { - // If this element is the shadow root of an use-element shadow - // tree, according to the spec, we should not match rules - // cross the shadow DOM boundary. - e.local_name() == &*local_name!("use") && - e.namespace() == &*ns!("http://www.w3.org/2000/svg") - }, - None => false, - } + // If this element is the shadow root of an use-element shadow tree, + // according to the spec, we should not match rules cross the shadow + // DOM boundary. + self.is_root_of_use_element_shadow_tree() } }