Bug 1351535 - Part 3: Only explicitly style newly inserted content if the parent is not in a display:none subtree. r=bholley draft
authorCameron McCormack <cam@mcc.id.au>
Tue, 04 Apr 2017 19:21:05 +0800
changeset 558862 30d4c9f84cfdd9c3ae0b8c8d5eff90c573d4f27c
parent 558861 417057c1fde32fec6e13a8b66a68fbd24cb7803c
child 558863 2589b7fca69a87e74d0fd3a9bf3c19a50f65cb64
child 558892 0836d2e91bd0f7bce471154b1c78727e19e4f75f
push id52975
push userbmo:cam@mcc.id.au
push dateSat, 08 Apr 2017 09:24:07 +0000
reviewersbholley
bugs1351535
milestone55.0a1
Bug 1351535 - Part 3: Only explicitly style newly inserted content if the parent is not in a display:none subtree. r=bholley If we append children to an element inside a display:none tree and we decide not to do lazy frame construction, StyleNewChildren will assert. It's also unnecessary, anyway, since we want to keep the descendants of the display:none element free of ElementData. MozReview-Commit-ID: 19tuzAzAIDp
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -7431,17 +7431,19 @@ nsCSSFrameConstructor::StyleNewChildRang
     // already handled that parent.  In the common case of inserting elements
     // into a container that does not have an XBL binding or shadow tree with
     // distributed children, this boils down to a single call to
     // GetFlattenedTreeParent/StyleNewChildren, and traversing the list of
     // children checking HasServoData (which is fast).
     if (child->IsElement() && !child->AsElement()->HasServoData()) {
       Element* parent = child->AsElement()->GetFlattenedTreeParentElement();
       MOZ_ASSERT(parent);
-      styleSet->StyleNewChildren(parent);
+      if (parent->HasServoData()) {
+        styleSet->StyleNewChildren(parent);
+      }
     }
   }
 }
 
 void
 nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
                                        nsIContent* aFirstNewContent,
                                        bool aAllowLazyConstruction,