Bug 473398. nsCSSRendering::PaintBackground should not try to fix up the canvas background color to be opaque. r+sr=roc

--HG--
extra : rebase_source : f2883c704bee9a4ba70c57598704ed7ba30628dc
This commit is contained in:
Zack Weinberg 2009-01-16 21:15:29 +13:00
Родитель ed9150bebf
Коммит 9a4b44c69d
1 изменённых файлов: 7 добавлений и 32 удалений

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

@ -1159,7 +1159,6 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
PRBool isCanvas;
const nsStyleBackground *color;
const nsStyleBorder* border = aForFrame->GetStyleBorder();
if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas)) {
// we don't want to bail out of moz-appearance is set on a root
@ -1178,40 +1177,16 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
color = aForFrame->GetStyleBackground();
}
if (!isCanvas) {
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
aDirtyRect, aBorderArea, *color, *border,
aUsePrintSettings, aBGClipRect);
return;
if (isCanvas && NS_GET_A(color->mBackgroundColor) == 255) {
nsIViewManager* vm = aPresContext->GetViewManager();
vm->SetDefaultBackgroundColor(color->mBackgroundColor);
}
nsStyleBackground canvasColor(*color);
nsIViewManager* vm = aPresContext->GetViewManager();
if (NS_GET_A(canvasColor.mBackgroundColor) < 255) {
// If the window is intended to be opaque, ensure that we always
// paint an opaque color for its root element, in case there's no
// background at all or a partly transparent image.
nsIView* rView;
vm->GetRootView(rView);
if (!rView->GetParent() &&
(!rView->HasWidget() ||
rView->GetWidget()->GetTransparencyMode() == eTransparencyOpaque)) {
nscolor backColor = aPresContext->DefaultBackgroundColor();
NS_ASSERTION(NS_GET_A(backColor) == 255,
"default background color is not opaque");
canvasColor.mBackgroundColor =
NS_ComposeColors(backColor, canvasColor.mBackgroundColor);
}
}
vm->SetDefaultBackgroundColor(canvasColor.mBackgroundColor);
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
aDirtyRect, aBorderArea, canvasColor,
*border, aUsePrintSettings, aBGClipRect);
aDirtyRect, aBorderArea, *color,
*aForFrame->GetStyleBorder(),
aUsePrintSettings, aBGClipRect);
}
static PRBool