Bug 1425759: Make the simplified children iterator check account for Shadow DOM on its own. r?xidorn draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 25 Feb 2018 17:58:59 +0100
changeset 759773 f87cc99183d50caafa78071901080ef573ae84be
parent 759772 e0b890813cf6658019733d87c74608ee4ffe9929
child 759774 f3fbe2971dfcd9af39c551cfedf211fe0ccd85c1
push id100460
push userbmo:emilio@crisal.io
push dateMon, 26 Feb 2018 16:00:57 +0000
reviewersxidorn
bugs1425759
milestone60.0a1
Bug 1425759: Make the simplified children iterator check account for Shadow DOM on its own. r?xidorn We are relying in the XBL binding for the shadow host, we need to check explicitly. Also, we were checking in_shadow_tree, which is really broad. Just is_html_slot_element should do, since the rest of the nodes should have only light tree children. MozReview-Commit-ID: KAFRVxaLsK
servo/components/style/gecko/wrapper.rs
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -954,17 +954,18 @@ impl<'le> TElement for GeckoElement<'le>
 
     fn traversal_children(&self) -> LayoutIterator<GeckoChildrenIterator<'le>> {
         // This condition is similar to the check that
         // StyleChildrenIterator::IsNeeded does, except that it might return
         // true if we used to (but no longer) have anonymous content from
         // ::before/::after, XBL bindings, or nsIAnonymousContentCreators.
         if self.is_in_anonymous_subtree() ||
            self.has_xbl_binding_with_content() ||
-           self.is_in_shadow_tree() ||
+           self.is_html_slot_element() ||
+           self.shadow_root().is_some() ||
            self.may_have_anonymous_children() {
             unsafe {
                 let mut iter: structs::StyleChildrenIterator = ::std::mem::zeroed();
                 Gecko_ConstructStyleChildrenIterator(self.0, &mut iter);
                 return LayoutIterator(GeckoChildrenIterator::GeckoIterator(iter));
             }
         }