Bug 494667. Don't apply optimization to shrink drawn background area to exclude solid borders, if we're not going to draw those borders (e.g. in tables with collapsing borders). r+sr=dbaron,a=beltzner
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 28 May 2009 17:01:42 +1200
changeset 28800 7c4cf9d4af3410ecc6612e3ee4020b201f6f423a
parent 28799 95c878a87ccdef055171507bfc0e4bcd0fd3f850
child 28801 db81fd5f395826fe64ee9a1ff0864f4b3e60c2ea
push id7263
push userrocallahan@mozilla.com
push dateThu, 28 May 2009 05:04:58 +0000
treeherdermozilla-central@7c4cf9d4af34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbeltzner
bugs494667
milestone1.9.2a1pre
Bug 494667. Don't apply optimization to shrink drawn background area to exclude solid borders, if we're not going to draw those borders (e.g. in tables with collapsing borders). r+sr=dbaron,a=beltzner
layout/base/nsCSSRendering.cpp
layout/base/nsCSSRendering.h
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsHTMLButtonControlFrame.h
layout/generic/nsHTMLFrame.cpp
layout/generic/nsPageFrame.cpp
layout/mathml/nsMathMLChar.cpp
layout/reftests/bugs/494667-1-ref.html
layout/reftests/bugs/494667-1.html
layout/reftests/bugs/494667-2-ref.html
layout/reftests/bugs/494667-2.html
layout/reftests/bugs/reftest.list
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTablePainter.cpp
layout/xul/base/src/nsGroupBoxFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -1321,17 +1321,17 @@ nsCSSRendering::PaintBoxShadowInner(nsPr
 }
 
 void
 nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
                                 nsIRenderingContext& aRenderingContext,
                                 nsIFrame* aForFrame,
                                 const nsRect& aDirtyRect,
                                 const nsRect& aBorderArea,
-                                PRBool aUsePrintSettings,
+                                PRUint32 aFlags,
                                 nsRect* aBGClipRect)
 {
   NS_PRECONDITION(aForFrame,
                   "Frame is expected to be provided to PaintBackground");
 
   const nsStyleBackground *color;
   if (!FindBackground(aPresContext, aForFrame, &color)) {
     // we don't want to bail out of moz-appearance is set on a root
@@ -1348,18 +1348,18 @@ nsCSSRendering::PaintBackground(nsPresCo
       return;
     }
         
     color = aForFrame->GetStyleBackground();
   }
 
   PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
                         aDirtyRect, aBorderArea, *color,
-                        *aForFrame->GetStyleBorder(),
-                        aUsePrintSettings, aBGClipRect);
+                        *aForFrame->GetStyleBorder(), aFlags,
+                        aBGClipRect);
 }
 
 static PRBool
 IsSolidBorderEdge(const nsStyleBorder& aBorder, PRUint32 aSide)
 {
   if (aBorder.GetActualBorder().side(aSide) == 0)
     return PR_TRUE;
   if (aBorder.GetBorderStyle(aSide) != NS_STYLE_BORDER_STYLE_SOLID)
@@ -1499,17 +1499,17 @@ SetupBackgroundClip(gfxContext *aCtx, PR
 void
 nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
                                       nsIRenderingContext& aRenderingContext,
                                       nsIFrame* aForFrame,
                                       const nsRect& aDirtyRect,
                                       const nsRect& aBorderArea,
                                       const nsStyleBackground& aColor,
                                       const nsStyleBorder& aBorder,
-                                      PRBool aUsePrintSettings,
+                                      PRUint32 aFlags,
                                       nsRect* aBGClipRect)
 {
   NS_PRECONDITION(aForFrame,
                   "Frame is expected to be provided to PaintBackground");
 
   // Check to see if we have an appearance defined.  If so, we let the theme
   // renderer draw the background and bail out.
   // XXXzw this ignores aBGClipRect.
@@ -1525,18 +1525,18 @@ nsCSSRendering::PaintBackgroundWithSC(ns
       return;
     }
   }
 
   // Determine whether we are drawing background images and/or
   // background colors.
   PRBool drawBackgroundImage = PR_TRUE;
   PRBool drawBackgroundColor = PR_TRUE;
-
-  if (aUsePrintSettings) {
+  PRBool usePrintSettings = aForFrame->HonorPrintBackgroundSettings();
+  if (usePrintSettings) {
     drawBackgroundImage = aPresContext->GetBackgroundImageDraw();
     drawBackgroundColor = aPresContext->GetBackgroundColorDraw();
   }
 
   nsStyleBackground::Image bottomImage(aColor.BottomLayer().mImage);
   PRBool useFallbackColor = PR_FALSE;
   if (bottomImage.mSpecified) {
     if (!drawBackgroundImage ||
@@ -1607,17 +1607,18 @@ nsCSSRendering::PaintBackgroundWithSC(ns
     // which is normally equal to the border area but may be reduced
     // to the padding area by CSS.  Also, if the border is solid, we
     // don't need to draw outside the padding area.  In either case,
     // if the borders are rounded, make sure we use the same inner
     // radii as the border code will.
     // The background-color is drawn based on the bottom
     // background-clip.
     currentBackgroundClip = aColor.BottomLayer().mClip;
-    isSolidBorder = IsSolidBorder(aBorder);
+    isSolidBorder =
+      (aFlags & PAINT_WILL_PAINT_BORDER) && IsSolidBorder(aBorder);
     if (isSolidBorder)
       currentBackgroundClip = NS_STYLE_BG_CLIP_PADDING;
     SetupBackgroundClip(ctx, currentBackgroundClip, aForFrame,
                         aBorderArea, aDirtyRect, haveRoundedCorners,
                         bgRadii, appUnitsPerPixel, &autoSR,
                         &bgClipArea, &dirtyRect, &dirtyRectGfx);
   }
 
@@ -1692,17 +1693,17 @@ nsCSSRendering::PaintBackgroundWithSC(ns
                               aBorderArea, aDirtyRect, haveRoundedCorners,
                               bgRadii, appUnitsPerPixel, &autoSR,
                               &bgClipArea, &dirtyRect, &dirtyRectGfx);
         }
       }
       if (!dirtyRectGfx.IsEmpty()) {
         PaintBackgroundLayer(aPresContext, aRenderingContext, aForFrame,
                              dirtyRect, aBorderArea, bgClipArea, aColor,
-                             layer, aBorder, aUsePrintSettings);
+                             layer, aBorder, usePrintSettings);
       }
     }
   }
 }
 
 static void
 PaintBackgroundLayer(nsPresContext* aPresContext,
                      nsIRenderingContext& aRenderingContext,
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -169,37 +169,44 @@ struct nsCSSRendering {
 
   /**
    * Render the background for an element using css rendering rules
    * for backgrounds.
    *
    * Both aDirtyRect and aBorderArea are in the local coordinate space
    * of aForFrame
    */
+  enum {
+    /**
+     * When this flag is passed, the element's nsDisplayBorder will be
+     * painted immediately on top of this background.
+     */
+    PAINT_WILL_PAINT_BORDER = 0x01
+  };
   static void PaintBackground(nsPresContext* aPresContext,
                               nsIRenderingContext& aRenderingContext,
                               nsIFrame* aForFrame,
                               const nsRect& aDirtyRect,
                               const nsRect& aBorderArea,
-                              PRBool aUsePrintSettings,
+                              PRUint32 aFlags,
                               nsRect* aBGClipRect = nsnull);
 
   /**
    * Same as |PaintBackground|, except using the provided style structs.
    * This short-circuits the code that ensures that the root element's
    * background is drawn on the canvas.
    */
   static void PaintBackgroundWithSC(nsPresContext* aPresContext,
                                     nsIRenderingContext& aRenderingContext,
                                     nsIFrame* aForFrame,
                                     const nsRect& aDirtyRect,
                                     const nsRect& aBorderArea,
                                     const nsStyleBackground& aColor,
                                     const nsStyleBorder& aBorder,
-                                    PRBool aUsePrintSettings = PR_FALSE,
+                                    PRUint32 aFlags,
                                     nsRect* aBGClipRect = nsnull);
 
   /**
    * Called by the presShell when painting is finished, so we can clear our
    * inline background data cache.
    */
   static void DidPaint();
 
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -617,19 +617,25 @@ nsDisplayBackground::IsVaryingRelativeTo
   // want to return true because mFrame won't move relative to its viewport.
   return movingFrame->PresContext() == presContext;
 }
 
 void
 nsDisplayBackground::Paint(nsDisplayListBuilder* aBuilder,
      nsIRenderingContext* aCtx, const nsRect& aDirtyRect) {
   nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
+  PRUint32 flags = 0;
+  nsDisplayItem* nextItem = GetAbove();
+  if (nextItem && nextItem->GetUnderlyingFrame() == mFrame &&
+      nextItem->GetType() == TYPE_BORDER) {
+    flags |= nsCSSRendering::PAINT_WILL_PAINT_BORDER;
+  }
   nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
                                   aDirtyRect, nsRect(offset, mFrame->GetSize()),
-                                  mFrame->HonorPrintBackgroundSettings());
+                                  flags);
 }
 
 nsRect
 nsDisplayBackground::GetBounds(nsDisplayListBuilder* aBuilder) {
   if (mIsThemed)
     return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
 
   return nsRect(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize());
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -390,17 +390,18 @@ public:
     TYPE_GENERIC,
     TYPE_OUTLINE,
     TYPE_CLIP,
     TYPE_OPACITY,
 #ifdef MOZ_SVG
     TYPE_SVG_EFFECTS,
 #endif
     TYPE_WRAPLIST,
-    TYPE_TRANSFORM
+    TYPE_TRANSFORM,
+    TYPE_BORDER
   };
 
   struct HitTestState {
     ~HitTestState() {
       NS_ASSERTION(mItemBuffer.Length() == 0,
                    "mItemBuffer should have been cleared");
     }
     nsAutoTArray<nsDisplayItem*, 100> mItemBuffer;
@@ -996,16 +997,17 @@ public:
     MOZ_COUNT_CTOR(nsDisplayBorder);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayBorder() {
     MOZ_COUNT_DTOR(nsDisplayBorder);
   }
 #endif
 
+  virtual Type GetType() { return TYPE_BORDER; }
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
      const nsRect& aDirtyRect);
   virtual PRBool OptimizeVisibility(nsDisplayListBuilder* aBuilder, nsRegion* aVisibleRegion);
   NS_DISPLAY_DECL_NAME("Border")
 };
 
 /**
  * A simple display item that just renders a solid color across the
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -264,17 +264,17 @@ nsButtonFrameRenderer::PaintBorderAndBac
   nsRect buttonRect;
   GetButtonRect(aRect, buttonRect);
 
   nsStyleContext* context = mFrame->GetStyleContext();
 
   const nsStyleBorder* border = context->GetStyleBorder();
 
   nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
-                                  aDirtyRect, buttonRect, PR_FALSE);
+                                  aDirtyRect, buttonRect, 0);
   nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
                                       mFrame, buttonRect, aDirtyRect);
   nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
                               aDirtyRect, buttonRect, *border, context);
 }
 
 
 void
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -274,17 +274,17 @@ nsFieldSetFrame::PaintBorderBackground(n
   // if the border is smaller than the legend. Move the border down
   // to be centered on the legend. 
   if (topBorder < mLegendRect.height)
     yoff = (mLegendRect.height - topBorder)/2;
       
   nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
 
   nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
-                                  aDirtyRect, rect, PR_TRUE);
+                                  aDirtyRect, rect, 0);
 
   nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
                                       this, rect, aDirtyRect);
 
    if (mLegendFrame) {
 
     // Use the rect of the legend frame, not mLegendRect, so we draw our
     // border under the legend's left and right margins.
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -111,16 +111,18 @@ public:
   virtual nsIAtom* GetType() const;
   
 #ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const {
     return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
   }
 #endif
 
+  virtual PRBool HonorPrintBackgroundSettings() { return PR_FALSE; }
+
   // nsIFormControlFrame
   void SetFocus(PRBool aOn, PRBool aRepaint);
   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
   virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const; 
 
   // Inserted child content gets its frames parented by our child block
   virtual nsIFrame* GetContentInsertionFrame() {
     return GetFirstChild(nsnull)->GetContentInsertionFrame();
--- a/layout/generic/nsHTMLFrame.cpp
+++ b/layout/generic/nsHTMLFrame.cpp
@@ -428,18 +428,17 @@ public:
     CanvasFrame* frame = static_cast<CanvasFrame*>(mFrame);
     nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
     nsRect bgClipRect = frame->CanvasArea() + offset;
     // XXXzw This is the only use of the bgClipRect argument.  Does this
     // path need the propagation-of-root-background-to-viewport logic?
     nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
                                     aDirtyRect,
                                     nsRect(offset, mFrame->GetSize()),
-                                    mFrame->HonorPrintBackgroundSettings(),
-                                    &bgClipRect);
+                                    0, &bgClipRect);
   }
 
   NS_DISPLAY_DECL_NAME("CanvasBackground")
 };
 
 /**
  * A display item to paint the focus ring for the document.
  *
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -571,17 +571,17 @@ nsPageFrame::PaintPageContent(nsIRenderi
     clipRect.height = expectedPageContentHeight;
     NS_ASSERTION(clipRect.y < pageContentFrame->GetSize().height,
                  "Should be clipping to region inside the page content bounds");
   }
   aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
 
   nsRect backgroundRect = nsRect(nsPoint(0, 0), pageContentFrame->GetSize());
   nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
-                                  rect, backgroundRect, PR_TRUE);
+                                  rect, backgroundRect, 0);
 
   nsLayoutUtils::PaintFrame(&aRenderingContext, pageContentFrame,
                             nsRegion(rect), NS_RGBA(0,0,0,0));
 
   aRenderingContext.PopState();
 }
 
 void
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1929,17 +1929,17 @@ private:
 void nsDisplayMathMLCharBackground::Paint(nsDisplayListBuilder* aBuilder,
      nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
 {
   const nsStyleBorder* border = mStyleContext->GetStyleBorder();
   const nsStyleBackground* backg = mStyleContext->GetStyleBackground();
   nsRect rect(mRect + aBuilder->ToReferenceFrame(mFrame));
   nsCSSRendering::PaintBackgroundWithSC(mFrame->PresContext(), *aCtx, mFrame,
                                         aDirtyRect, rect, *backg, *border,
-                                        PR_TRUE);
+                                        0);
 }
 
 class nsDisplayMathMLCharForeground : public nsDisplayItem {
 public:
   nsDisplayMathMLCharForeground(nsIFrame* aFrame, nsMathMLChar* aChar,
 				PRBool aIsSelected)
     : nsDisplayItem(aFrame), mChar(aChar), mIsSelected(aIsSelected) {
     MOZ_COUNT_CTOR(nsDisplayMathMLCharForeground);
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/494667-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div style="width:200px; height:200px; background:lime;"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/494667-1.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+table {
+  border-collapse: collapse;
+  background-color: red;
+}
+td, th {
+  background-color: lime;
+  width:100px;
+  height:100px;
+}
+td {
+  border-top: 4px solid lime;
+}
+</style>
+</head>
+<body>
+<table cellpadding="0">
+  <tr><th colspan="2"></th></tr>
+  <tr><th></th><td></td>
+</table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/494667-2-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div style="width:212px; height:204px; background:lime;"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/494667-2.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+table {
+  border-collapse: collapse;
+  background-color: red;
+}
+td, th {
+  background-color: lime;
+  width:100px;
+  height:100px;
+  border:4px solid lime;
+}
+td {
+  border-top:hidden;
+}
+</style>
+</head>
+<body>
+<table cellpadding="0">
+  <tr><th colspan="2"></th></tr>
+  <tr><th></th><td></td>
+</table>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1235,8 +1235,10 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 
 fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs EXTEND_PAD on non-Mac for correct scaling behaviour
 == 492661-1.html 492661-1-ref.html
 == 490182-1a.html 490182-1-ref.html
 == 490182-1b.html 490182-1-ref.html
 == 490173-1.html 490173-1-ref.html
 == 490173-2.html 490173-2-ref.html
 == 491323-1.xul 491323-1-ref.xul
 == 493968-1.html 493968-1-ref.html
+== 494667-1.html 494667-1-ref.html
+== 494667-2.html 494667-2-ref.html
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -360,17 +360,17 @@ nsTableCellFrame::DecorateForSelection(n
 
 void
 nsTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
                                   const nsRect&        aDirtyRect,
                                   nsPoint              aPt)
 {
   nsRect rect(aPt, GetSize());
   nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
-                                  aDirtyRect, rect, PR_TRUE);
+                                  aDirtyRect, rect, 0);
 }
 
 // Called by nsTablePainter
 void
 nsTableCellFrame::PaintCellBackground(nsIRenderingContext& aRenderingContext,
                                       const nsRect& aDirtyRect, nsPoint aPt)
 {
   if (!GetStyleVisibility()->IsVisible())
@@ -1205,10 +1205,10 @@ nsBCTableCellFrame::PaintBackground(nsIR
   }
 
   nsRect rect(aPt, GetSize());
   // bypassing nsCSSRendering::PaintBackground is safe because this kind
   // of frame cannot be used for the root element
   nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this,
                                         aDirtyRect, rect,
                                         *GetStyleBackground(), myBorder,
-                                        PR_TRUE, nsnull);
+                                        0, nsnull);
 }
--- a/layout/tables/nsTablePainter.cpp
+++ b/layout/tables/nsTablePainter.cpp
@@ -321,17 +321,17 @@ TableBackgroundPainter::PaintTableFrame(
     }
   }
   if (tableData.IsVisible()) {
     nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
                                           tableData.mFrame, mDirtyRect,
                                           tableData.mRect + mRenderPt,
                                           *tableData.mBackground,
                                           *tableData.mBorder,
-                                          PR_TRUE);
+                                          0);
   }
   tableData.Destroy(mPresContext);
   return NS_OK;
 }
 
 void
 TableBackgroundPainter::TranslateContext(nscoord aDX,
                                          nscoord aDY)
@@ -626,45 +626,45 @@ TableBackgroundPainter::PaintCell(nsTabl
 
   //Paint column group background
   if (mCols && mCols[colIndex].mColGroup && mCols[colIndex].mColGroup->IsVisible()) {
     nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
                                           mCols[colIndex].mColGroup->mFrame, mDirtyRect,
                                           mCols[colIndex].mColGroup->mRect + mRenderPt,
                                           *mCols[colIndex].mColGroup->mBackground,
                                           *mCols[colIndex].mColGroup->mBorder,
-                                          PR_TRUE, &mCellRect);
+                                          0, &mCellRect);
   }
 
   //Paint column background
   if (mCols && mCols[colIndex].mCol.IsVisible()) {
     nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
                                           mCols[colIndex].mCol.mFrame, mDirtyRect,
                                           mCols[colIndex].mCol.mRect + mRenderPt,
                                           *mCols[colIndex].mCol.mBackground,
                                           *mCols[colIndex].mCol.mBorder,
-                                          PR_TRUE, &mCellRect);
+                                          0, &mCellRect);
   }
 
   //Paint row group background
   if (mRowGroup.IsVisible()) {
     nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
                                           mRowGroup.mFrame, mDirtyRect,
                                           mRowGroup.mRect + mRenderPt,
                                           *mRowGroup.mBackground, *mRowGroup.mBorder,
-                                          PR_TRUE, &mCellRect);
+                                          0, &mCellRect);
   }
 
   //Paint row background
   if (mRow.IsVisible()) {
     nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
                                           mRow.mFrame, mDirtyRect,
                                           mRow.mRect + mRenderPt,
                                           *mRow.mBackground, *mRow.mBorder,
-                                          PR_TRUE, &mCellRect);
+                                          0, &mCellRect);
   }
 
   //Paint cell background in border-collapse unless we're just passing
   if (mIsBorderCollapse && !aPassSelf) {
     aCell->PaintCellBackground(mRenderingContext, mDirtyRect,
                                mCellRect.TopLeft());
   }
 
--- a/layout/xul/base/src/nsGroupBoxFrame.cpp
+++ b/layout/xul/base/src/nsGroupBoxFrame.cpp
@@ -55,16 +55,18 @@ public:
                               const nsDisplayListSet& aLists);
 
 #ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const {
     return MakeFrameName(NS_LITERAL_STRING("GroupBoxFrame"), aResult);
   }
 #endif
 
+  virtual PRBool HonorPrintBackgroundSettings() { return PR_FALSE; }
+
   void PaintBorderBackground(nsIRenderingContext& aRenderingContext,
       nsPoint aPt, const nsRect& aDirtyRect);
 
   // make sure we our kids get our orient and align instead of us.
   // our child box has no content node so it will search for a parent with one.
   // that will be us.
   virtual void GetInitialOrientation(PRBool& aHorizontal) { aHorizontal = PR_FALSE; }
   virtual PRBool GetInitialHAlignment(Halignment& aHalign)  { aHalign = hAlign_Left; return PR_TRUE; } 
@@ -168,17 +170,17 @@ nsGroupBoxFrame::PaintBorderBackground(n
         yoff = (groupRect.height - border.top)/2 + groupRect.y;
   }
 
   nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
 
   groupRect += aPt;
 
   nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
-                                  aDirtyRect, rect, PR_FALSE);
+                                  aDirtyRect, rect, 0);
 
   if (groupBox) {
 
     // we should probably use PaintBorderEdges to do this but for now just use clipping
     // to achieve the same effect.
 
     // draw left side
     nsRect clipRect(rect);
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -3905,17 +3905,17 @@ nsTreeBodyFrame::PaintBackgroundLayer(ns
                                       const nsRect&        aDirtyRect)
 {
   const nsStyleBackground* myColor = aStyleContext->GetStyleBackground();
   const nsStyleBorder* myBorder = aStyleContext->GetStyleBorder();
   const nsStyleOutline* myOutline = aStyleContext->GetStyleOutline();
   
   nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
                                         this, aDirtyRect, aRect,
-                                        *myColor, *myBorder, PR_TRUE);
+                                        *myColor, *myBorder, 0);
 
   nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
                               aDirtyRect, aRect, *myBorder, mStyleContext);
 
   nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
                                aDirtyRect, aRect, *myBorder, *myOutline,
                                aStyleContext);
 }