Bug 1322570 Part 8 - Run debug code only if the style source is a gecko rule node. draft
authorTing-Yu Lin <tlin@mozilla.com>
Mon, 20 Mar 2017 17:05:16 +0800
changeset 504316 d9748087105620e13ee472e84e15122d37dfc4a5
parent 504315 7a183183e8561c99c7d6e943be04cae4986312ad
child 504317 2fb965a810c42fd56b4f2b1a1b33ae43562bd9d1
push id50776
push userbmo:tlin@mozilla.com
push dateFri, 24 Mar 2017 06:09:16 +0000
bugs1322570
milestone55.0a1
Bug 1322570 Part 8 - Run debug code only if the style source is a gecko rule node. Per bug 1322570 comment 27, the debug code is only useful in Gecko-backed style system. To prevent the assertion in nsStyleContext::GetParent() when running stylo, run them only in gecko. MozReview-Commit-ID: DOcJ3T7vS1J
layout/tables/nsTableColGroupFrame.cpp
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -291,25 +291,28 @@ nsTableColGroupFrame::RemoveFrame(ChildL
       contentRemoval = true;
       // Remove any anonymous column frames this <col> produced via a colspan
       nsTableColFrame* col = colFrame->GetNextCol();
       nsTableColFrame* nextCol;
       while (col && col->GetColType() == eColAnonymousCol) {
 #ifdef DEBUG
         nsIFrame* providerFrame;
         nsStyleContext* psc = colFrame->GetParentStyleContext(&providerFrame);
-        if (colFrame->StyleContext()->GetParent() == psc) {
-          NS_ASSERTION(col->StyleContext() == colFrame->StyleContext() &&
-                       col->GetContent() == colFrame->GetContent(),
-                       "How did that happen??");
+        if (psc->StyleSource().IsGeckoRuleNodeOrNull()) {
+          // This check code is useful only in Gecko-backed style system.
+          if (colFrame->StyleContext()->GetParent() == psc) {
+            NS_ASSERTION(col->StyleContext() == colFrame->StyleContext() &&
+                         col->GetContent() == colFrame->GetContent(),
+                         "How did that happen??");
+          }
+          // else colFrame is being removed because of a frame
+          // reconstruct on it, and its style context is still the old
+          // one, so we can't assert anything about how it compares to
+          // col's style context.
         }
-        // else colFrame is being removed because of a frame
-        // reconstruct on it, and its style context is still the old
-        // one, so we can't assert anything about how it compares to
-        // col's style context.
 #endif
         nextCol = col->GetNextCol();
         RemoveFrame(kPrincipalList, col);
         col = nextCol;
       }
     }
     
     int32_t colIndex = colFrame->GetColIndex();