mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make :-moz-native-anonymous and :-moz-use-shadow-tree-root matches in Rust code.
This commit is contained in:
parent
bb15111dab
commit
911f174b70
1 changed files with 26 additions and 17 deletions
|
@ -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<LonghandId, Arc<AnimationValue>> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue