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
--- 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,