From 9a4b44c69d4446485804377c6080a81223dfd501 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 16 Jan 2009 21:15:29 +1300 Subject: [PATCH] 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 --- layout/base/nsCSSRendering.cpp | 39 ++++++---------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 61f73df5526..7cdbc37511d 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -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