style: Allow to share style across elements with similar XBL bindings.

This commit is contained in:
Emilio Cobos Álvarez 2018-03-07 02:04:56 +01:00
parent af12284b6a
commit c338745b17
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 21 additions and 42 deletions

View file

@ -135,6 +135,13 @@ impl<'ld> TDocument for GeckoDocument<'ld> {
#[derive(Clone, Copy)]
pub struct GeckoShadowRoot<'lr>(pub &'lr structs::ShadowRoot);
impl<'lr> PartialEq for GeckoShadowRoot<'lr> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.0 as *const _ == other.0 as *const _
}
}
impl<'lr> TShadowRoot for GeckoShadowRoot<'lr> {
type ConcreteNode = GeckoNode<'lr>;
@ -1040,29 +1047,6 @@ impl<'le> TElement for GeckoElement<'le> {
self.before_or_after_pseudo(/* is_before = */ false)
}
/// Ensure this accurately represents the rules that an element may ever
/// match, even in the native anonymous content case.
fn style_scope(&self) -> Self::ConcreteNode {
if self.implemented_pseudo_element().is_some() {
return self.closest_non_native_anonymous_ancestor().unwrap().style_scope();
}
if self.is_in_native_anonymous_subtree() {
return self.as_node().owner_doc().as_node();
}
if self.xbl_binding().is_some() || self.shadow_root().is_some() {
return self.as_node();
}
if let Some(parent) = self.xbl_binding_parent() {
return parent.as_node();
}
self.as_node().owner_doc().as_node()
}
#[inline]
fn is_html_element(&self) -> bool {
self.namespace_id() == (structs::root::kNameSpaceID_XHTML as i32)