diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index f71e8571fd4..7bac24f2419 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -1700,12 +1700,12 @@ DrawBackgroundColor(BackgroundClipState& aClipState, gfxContext *aCtx, aCtx->Restore(); } -nscolor -nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext, - nsStyleContext* aStyleContext, - nsIFrame* aFrame, - PRBool& aDrawBackgroundImage, - PRBool& aDrawBackgroundColor) +static nscolor +DetermineBackgroundColorInternal(nsPresContext* aPresContext, + nsStyleContext* aStyleContext, + nsIFrame* aFrame, + PRBool& aDrawBackgroundImage, + PRBool& aDrawBackgroundColor) { aDrawBackgroundImage = PR_TRUE; aDrawBackgroundColor = PR_TRUE; @@ -1737,6 +1737,20 @@ nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext, return bgColor; } +nscolor +nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext, + nsStyleContext* aStyleContext, + nsIFrame* aFrame) +{ + PRBool drawBackgroundImage; + PRBool drawBackgroundColor; + return DetermineBackgroundColorInternal(aPresContext, + aStyleContext, + aFrame, + drawBackgroundImage, + drawBackgroundColor); +} + static gfxFloat ConvertGradientValueToPixels(const nsStyleCoord& aCoord, gfxFloat aFillLength, @@ -2304,11 +2318,11 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext, PRBool drawBackgroundImage; PRBool drawBackgroundColor; - nscolor bgColor = DetermineBackgroundColor(aPresContext, - aBackgroundSC, - aForFrame, - drawBackgroundImage, - drawBackgroundColor); + nscolor bgColor = DetermineBackgroundColorInternal(aPresContext, + aBackgroundSC, + aForFrame, + drawBackgroundImage, + drawBackgroundColor); // At this point, drawBackgroundImage and drawBackgroundColor are // true if and only if we are actually supposed to paint an image or diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h index bac9d7febd2..a57298ae595 100644 --- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -211,9 +211,7 @@ struct nsCSSRendering { static nscolor DetermineBackgroundColor(nsPresContext* aPresContext, nsStyleContext* aStyleContext, - nsIFrame* aFrame, - PRBool& aDrawBackgroundImage, - PRBool& aDrawBackgroundColor); + nsIFrame* aFrame); /** * Render the background for an element using css rendering rules diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 91437466ae5..bacda5c31e0 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5846,14 +5846,10 @@ void PresShell::UpdateCanvasBackground() // style frame but we don't have access to the canvasframe here. It isn't // a problem because only a few frames can return something other than true // and none of them would be a canvas frame or root element style frame. - PRBool drawBackgroundImage; - PRBool drawBackgroundColor; mCanvasBackgroundColor = nsCSSRendering::DetermineBackgroundColor(mPresContext, bgStyle, - rootStyleFrame, - drawBackgroundImage, - drawBackgroundColor); - if (drawBackgroundColor && GetPresContext()->IsRootContentDocument() && + rootStyleFrame); + if (GetPresContext()->IsRootContentDocument() && !IsTransparentContainerElement(mPresContext)) { mCanvasBackgroundColor = NS_ComposeColors(mPresContext->DefaultBackgroundColor(), mCanvasBackgroundColor);