Bug 955712 - Don't draw background color when not needed. r=roc
authorMats Palmgren <matspal@gmail.com>
Sun, 05 Jan 2014 23:31:14 +0000
changeset 162175 183398cf2b5e6187687fe7841c3d5579bc8475dd
parent 162174 794680b9599d01635c6734a00192d9ca099f4793
child 162176 d1cf3709a1f06b92def61b81f062ed2df5869520
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs955712
milestone29.0a1
Bug 955712 - Don't draw background color when not needed. r=roc
layout/base/nsCSSRendering.cpp
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -2609,24 +2609,27 @@ nsCSSRendering::PaintBackgroundColorWith
   }
 
   NS_ASSERTION(!IsCanvasFrame(aForFrame), "Should not be trying to paint a background color for canvas frames!");
 
   // Determine whether we are drawing background images and/or
   // background colors.
   bool drawBackgroundImage;
   bool drawBackgroundColor;
-
   nscolor bgColor = DetermineBackgroundColor(aPresContext,
                                              aBackgroundSC,
                                              aForFrame,
                                              drawBackgroundImage,
                                              drawBackgroundColor);
 
-  NS_ASSERTION(drawBackgroundColor, "Should not be trying to paint a background color if we don't have one");
+  NS_ASSERTION(drawBackgroundImage || drawBackgroundColor,
+               "Should not be trying to paint a background if we don't have one");
+  if (!drawBackgroundColor) {
+    return;
+  }
 
   // Compute the outermost boundary of the area that might be painted.
   gfxContext *ctx = aRenderingContext.ThebesContext();
   nscoord appUnitsPerPixel = aPresContext->AppUnitsPerDevPixel();
 
   // Same coordinate space as aBorderArea
   gfxCornerSizes bgRadii;
   bool haveRoundedCorners;