Bug 1358968 - Part 3: Use nsCSSAnonBoxList.h data to skip parent display-based style fixups when restyling anon boxes with ReparentStyleContext. r=bz draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 24 Apr 2017 16:26:29 +0800
changeset 570511 cf91eb874434ddbf7515cf1b910e2035ffe99bc0
parent 570510 339fada8cf163e75eb6561353a8cc3cb007dc0bc
child 570512 6bc305c17a3cfc4a56e54f81365a089c4b2efa43
push id56510
push userbmo:cam@mcc.id.au
push dateSat, 29 Apr 2017 00:48:31 +0000
reviewersbz
bugs1358968
milestone55.0a1
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
layout/style/nsStyleSet.cpp
--- 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);
 }