mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Fix IsInAnonymousSubtree to account for XBL in Shadow DOM.
Bug: 1453206 Reviewed-by: smaug MozReview-Commit-ID: B2aYury8K7i
This commit is contained in:
parent
245d848508
commit
3ef77f59d8
1 changed files with 15 additions and 17 deletions
|
@ -637,10 +637,11 @@ impl<'le> GeckoElement<'le> {
|
||||||
!self.xbl_binding_with_content().is_none()
|
!self.xbl_binding_with_content().is_none()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This and has_xbl_binding_parent duplicate the logic in Gecko's virtual
|
/// This duplicates the logic in Gecko's virtual nsINode::GetBindingParent
|
||||||
/// nsINode::GetBindingParent function, which only has two implementations:
|
/// function, which only has two implementations: one for XUL elements, and
|
||||||
/// one for XUL elements, and one for other elements. We just hard code in
|
/// one for other elements.
|
||||||
/// our knowledge of those two implementations here.
|
///
|
||||||
|
/// We just hard code in our knowledge of those two implementations here.
|
||||||
fn xbl_binding_parent(&self) -> Option<Self> {
|
fn xbl_binding_parent(&self) -> Option<Self> {
|
||||||
if self.is_xul_element() {
|
if self.is_xul_element() {
|
||||||
// FIXME(heycam): Having trouble with bindgen on nsXULElement,
|
// FIXME(heycam): Having trouble with bindgen on nsXULElement,
|
||||||
|
@ -667,17 +668,6 @@ impl<'le> GeckoElement<'le> {
|
||||||
.map_or(ptr::null_mut(), |slots| slots._base.mBindingParent)
|
.map_or(ptr::null_mut(), |slots| slots._base.mBindingParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_xbl_binding_parent(&self) -> bool {
|
|
||||||
if self.is_xul_element() {
|
|
||||||
// FIXME(heycam): Having trouble with bindgen on nsXULElement,
|
|
||||||
// where the binding parent is stored in a member variable
|
|
||||||
// rather than in slots. So just get it through FFI for now.
|
|
||||||
unsafe { bindings::Gecko_GetBindingParent(self.0).is_some() }
|
|
||||||
} else {
|
|
||||||
!self.non_xul_xbl_binding_parent_raw_content().is_null()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn namespace_id(&self) -> i32 {
|
fn namespace_id(&self) -> i32 {
|
||||||
self.as_node().node_info().mInner.mNamespaceID
|
self.as_node().node_info().mInner.mNamespaceID
|
||||||
|
@ -815,8 +805,16 @@ impl<'le> GeckoElement<'le> {
|
||||||
/// This logic is duplicated in Gecko's nsIContent::IsInAnonymousSubtree.
|
/// This logic is duplicated in Gecko's nsIContent::IsInAnonymousSubtree.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_in_anonymous_subtree(&self) -> bool {
|
fn is_in_anonymous_subtree(&self) -> bool {
|
||||||
self.is_in_native_anonymous_subtree() ||
|
if self.is_in_native_anonymous_subtree() {
|
||||||
(!self.as_node().is_in_shadow_tree() && self.has_xbl_binding_parent())
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let binding_parent = match self.xbl_binding_parent() {
|
||||||
|
Some(p) => p,
|
||||||
|
None => return false,
|
||||||
|
};
|
||||||
|
|
||||||
|
binding_parent.shadow_root().is_none()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this node is the shadow root of an use-element shadow tree.
|
/// Returns true if this node is the shadow root of an use-element shadow tree.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue