Bug 1247865 - Fix assertion to handle restyling of a table::after. r?birtles draft
authorL. David Baron <dbaron@dbaron.org>
Fri, 12 Feb 2016 17:01:43 -0800
changeset 330793 0dc36d66c61e847af05ceff29ad5c66da0345f28
parent 330792 251793138777995d4f25feaf8efee0caeefa3283
child 514256 829352184c8c5dfae1830708e2a1370bcff38fbd
push id10845
push userdbaron@mozilla.com
push dateSat, 13 Feb 2016 01:03:44 +0000
reviewersbirtles
bugs1247865
milestone47.0a1
Bug 1247865 - Fix assertion to handle restyling of a table::after. r?birtles I confirmed locally that this patch does fix the assertion in the crashtest. MozReview-Commit-ID: 8LHhJhNzDz9
layout/style/crashtests/crashtests.list
layout/style/nsStyleSet.cpp
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -131,13 +131,13 @@ load 1206105-1.html
 load 1223688-1.html
 load 1223694-1.html
 load 1226400-1.html
 load 1227501-1.html
 load 1230408-1.html
 load 1233135-1.html
 load 1233135-2.html
 load 1238660-1.html
-asserts(1) load 1247865-1.html # bug 1247865
+load 1247865-1.html
 load border-image-visited-link.html
 load font-face-truncated-src.html 
 load large_border_image_width.html
 load long-url-list-stack-overflow.html
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -1709,22 +1709,27 @@ nsStyleSet::ResolveStyleWithReplacement(
     // if we're dealing with a replacement (such as style attribute
     // replacement) that could lead to the animation property changing,
     // and we explicitly do NOT want to call CheckAnimationRule when
     // we're trying to do an animation-only update.
     if (aReplacements & ~(eRestyle_CSSTransitions | eRestyle_CSSAnimations)) {
       flags |= eDoAnimation;
     }
     elementForAnimation = aElement;
-    NS_ASSERTION(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
-                 !elementForAnimation->GetPrimaryFrame() ||
-                 elementForAnimation->GetPrimaryFrame()->StyleContext()->
-                     GetPseudoType() ==
-                   nsCSSPseudoElements::ePseudo_NotPseudoElement,
-                 "aElement should be the element and not the pseudo-element");
+#ifdef DEBUG
+    {
+      nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(elementForAnimation);
+      NS_ASSERTION(pseudoType ==
+                     nsCSSPseudoElements::ePseudo_NotPseudoElement ||
+                   !styleFrame ||
+                   styleFrame->StyleContext()->GetPseudoType() ==
+                     nsCSSPseudoElements::ePseudo_NotPseudoElement,
+                   "aElement should be the element and not the pseudo-element");
+    }
+#endif
   }
 
   if (aElement && aElement->IsRootOfAnonymousSubtree()) {
     // 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.)
     flags |= eSkipParentDisplayBasedStyleFixup;