Bug 652914. If we are not printing background colors then don't even print the default background color. r=roc

This commit is contained in:
Timothy Nikkel 2011-09-06 13:46:15 -05:00
Родитель 1587312eda
Коммит 90d87b30d6
3 изменённых файлов: 20 добавлений и 28 удалений

Просмотреть файл

@ -1700,12 +1700,12 @@ DrawBackgroundColor(BackgroundClipState& aClipState, gfxContext *aCtx,
aCtx->Restore();
}
static nscolor
DetermineBackgroundColorInternal(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
nsIFrame* aFrame,
PRBool& aDrawBackgroundImage,
PRBool& aDrawBackgroundColor)
nscolor
nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
nsIFrame* aFrame,
PRBool& aDrawBackgroundImage,
PRBool& aDrawBackgroundColor)
{
aDrawBackgroundImage = PR_TRUE;
aDrawBackgroundColor = PR_TRUE;
@ -1737,20 +1737,6 @@ DetermineBackgroundColorInternal(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,
@ -2318,11 +2304,11 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
PRBool drawBackgroundImage;
PRBool drawBackgroundColor;
nscolor bgColor = DetermineBackgroundColorInternal(aPresContext,
aBackgroundSC,
aForFrame,
drawBackgroundImage,
drawBackgroundColor);
nscolor bgColor = DetermineBackgroundColor(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

Просмотреть файл

@ -211,7 +211,9 @@ struct nsCSSRendering {
static nscolor
DetermineBackgroundColor(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
nsIFrame* aFrame);
nsIFrame* aFrame,
PRBool& aDrawBackgroundImage,
PRBool& aDrawBackgroundColor);
/**
* Render the background for an element using css rendering rules

Просмотреть файл

@ -5846,10 +5846,14 @@ 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);
if (GetPresContext()->IsRootContentDocument() &&
rootStyleFrame,
drawBackgroundImage,
drawBackgroundColor);
if (drawBackgroundColor && GetPresContext()->IsRootContentDocument() &&
!IsTransparentContainerElement(mPresContext)) {
mCanvasBackgroundColor =
NS_ComposeColors(mPresContext->DefaultBackgroundColor(), mCanvasBackgroundColor);