Bug 1331047: Require a child iterator for elements with ::before and ::after pseudos. r?bholley draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 22 Apr 2017 22:53:03 +0200
changeset 568643 708d1afaa6553f5672137a3c720bf5a6dc46a5f2
parent 568642 83acbdfe1eac4df7e7f10536fcc8983a4019f8bb
child 568644 b50eeee21129d1d7dee0e984ea5793c8b9ccbb57
push id55935
push userbmo:emilio+bugs@crisal.io
push dateWed, 26 Apr 2017 11:57:38 +0000
reviewersbholley
bugs1331047
milestone55.0a1
Bug 1331047: Require a child iterator for elements with ::before and ::after pseudos. r?bholley MozReview-Commit-ID: e1UTlnNn3X
dom/base/ChildIterator.cpp
--- a/dom/base/ChildIterator.cpp
+++ b/dom/base/ChildIterator.cpp
@@ -507,16 +507,26 @@ StyleChildrenIterator::IsNeeded(const El
   if (aElement->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
     nsBindingManager* manager = aElement->OwnerDoc()->BindingManager();
     nsXBLBinding* binding = manager->GetBindingWithContent(aElement);
     if (binding && binding->GetAnonymousContent()) {
       return true;
     }
   }
 
+  // If the node has a ::before or ::after pseudo, return true, because we want
+  // to visit those.
+  //
+  // TODO(emilio): Make this fast adding a bit? or, perhaps just using
+  // ProbePseudoElementStyle? It should be quite fast in Stylo.
+  if (aElement->GetProperty(nsGkAtoms::beforePseudoProperty) ||
+      aElement->GetProperty(nsGkAtoms::afterPseudoProperty)) {
+    return true;
+  }
+
   // If the node has native anonymous content, return true.
   nsIAnonymousContentCreator* ac = do_QueryFrame(aElement->GetPrimaryFrame());
   if (ac) {
     return true;
   }
 
   return false;
 }