Bug 1351535 - Part 3: Only explicitly style newly inserted content if the parent is not in a display:none subtree. r=bholley
authorCameron McCormack <cam@mcc.id.au>
Tue, 04 Apr 2017 19:21:05 +0800
changeset 559339 98731ed693b0aa45ae83afdb04e3089fc9af5b7f
parent 559338 206a7c5ddcb14ef0ab5fe81388f7cb92e38dddce
child 559340 d35ce8c70ea51f020140129372c656dcac2be93d
push id53058
push userarchaeopteryx@coole-files.de
push dateSun, 09 Apr 2017 21:36:26 +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
@@ -7415,17 +7415,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,