@@ -637,10 +637,11 @@ impl<'le> GeckoElement<'le> {
637
637
!self . xbl_binding_with_content ( ) . is_none ( )
638
638
}
639
639
640
- /// This and has_xbl_binding_parent duplicate the logic in Gecko's virtual
641
- /// nsINode::GetBindingParent function, which only has two implementations:
642
- /// one for XUL elements, and one for other elements. We just hard code in
643
- /// our knowledge of those two implementations here.
640
+ /// This duplicates the logic in Gecko's virtual nsINode::GetBindingParent
641
+ /// function, which only has two implementations: one for XUL elements, and
642
+ /// one for other elements.
643
+ ///
644
+ /// We just hard code in our knowledge of those two implementations here.
644
645
fn xbl_binding_parent ( & self ) -> Option < Self > {
645
646
if self . is_xul_element ( ) {
646
647
// FIXME(heycam): Having trouble with bindgen on nsXULElement,
@@ -667,17 +668,6 @@ impl<'le> GeckoElement<'le> {
667
668
. map_or ( ptr:: null_mut ( ) , |slots| slots. _base . mBindingParent )
668
669
}
669
670
670
- fn has_xbl_binding_parent ( & self ) -> bool {
671
- if self . is_xul_element ( ) {
672
- // FIXME(heycam): Having trouble with bindgen on nsXULElement,
673
- // where the binding parent is stored in a member variable
674
- // rather than in slots. So just get it through FFI for now.
675
- unsafe { bindings:: Gecko_GetBindingParent ( self . 0 ) . is_some ( ) }
676
- } else {
677
- !self . non_xul_xbl_binding_parent_raw_content ( ) . is_null ( )
678
- }
679
- }
680
-
681
671
#[ inline]
682
672
fn namespace_id ( & self ) -> i32 {
683
673
self . as_node ( ) . node_info ( ) . mInner . mNamespaceID
@@ -815,8 +805,16 @@ impl<'le> GeckoElement<'le> {
815
805
/// This logic is duplicated in Gecko's nsIContent::IsInAnonymousSubtree.
816
806
#[ inline]
817
807
fn is_in_anonymous_subtree ( & self ) -> bool {
818
- self . is_in_native_anonymous_subtree ( ) ||
819
- ( !self . as_node ( ) . is_in_shadow_tree ( ) && self . has_xbl_binding_parent ( ) )
808
+ if self . is_in_native_anonymous_subtree ( ) {
809
+ return true ;
810
+ }
811
+
812
+ let binding_parent = match self . xbl_binding_parent ( ) {
813
+ Some ( p) => p,
814
+ None => return false ,
815
+ } ;
816
+
817
+ binding_parent. shadow_root ( ) . is_none ( )
820
818
}
821
819
822
820
/// Returns true if this node is the shadow root of an use-element shadow tree.
0 commit comments