Bug 1358968 - Part 3: Use nsCSSAnonBoxList.h data to skip parent display-based style fixups when restyling anon boxes with ReparentStyleContext. r=bz
MozReview-Commit-ID: 5jqBEuVt3GH
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -2440,21 +2440,24 @@ nsStyleSet::ReparentStyleContext(nsStyle
}
if (pseudoType == CSSPseudoElementType::NotPseudo ||
pseudoType == CSSPseudoElementType::before ||
pseudoType == CSSPseudoElementType::after) {
flags |= eDoAnimation;
}
- if (aElement && aElement->IsRootOfAnonymousSubtree()) {
+ if ((aElement && aElement->IsRootOfAnonymousSubtree()) ||
+ (aStyleContext->IsAnonBox() &&
+ nsCSSAnonBoxes::AnonBoxSkipsParentDisplayBasedStyleFixup(
+ aStyleContext->GetPseudo()))) {
// For anonymous subtree roots, don't tweak "display" value based on whether
// or not the parent is styled as a flex/grid container. (If the parent
// has anonymous-subtree kids, then we know it's not actually going to get
- // a flex/grid container frame, anyway.)
+ // a flex/grid container frame, anyway.) Same for certain anonymous boxes.
flags |= eSkipParentDisplayBasedStyleFixup;
}
return GetContext(aNewParentContext, ruleNode, visitedRuleNode,
pseudoTag, pseudoType,
aElement, flags);
}