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