Bug 453566 - HTML element with rgba(0,0,0,0) background produces garbage on screen. r+sr=roc

This commit is contained in:
Zack Weinberg 2008-09-12 08:36:53 -07:00
Родитель 10b58f92ef
Коммит c3bcfd8995
1 изменённых файлов: 17 добавлений и 14 удалений

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

@ -1299,21 +1299,24 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
nsIViewManager* vm = aPresContext->GetViewManager(); nsIViewManager* vm = aPresContext->GetViewManager();
if (NS_GET_A(canvasColor.mBackgroundColor) == 0) { if (NS_GET_A(canvasColor.mBackgroundColor) < 255) {
nsIView* rootView; // If the window is intended to be opaque, ensure that we always
vm->GetRootView(rootView); // paint an opaque color for its root element, in case there's no
if (!rootView->GetParent()) { // background at all or a partly transparent image.
PRBool widgetIsTransparent = PR_FALSE; //
// The default background color from the prescontext is under user
// control, so it might not be opaque either.
nsIView* rView;
vm->GetRootView(rView);
if (!rView->GetParent() &&
(!rView->HasWidget() ||
rView->GetWidget()->GetTransparencyMode() == eTransparencyOpaque)) {
nscolor backColor =
NS_ComposeColors(NS_RGB(255,255,255),
aPresContext->DefaultBackgroundColor());
if (rootView->HasWidget()) canvasColor.mBackgroundColor =
// We don't want to draw a bg for glass windows either NS_ComposeColors(backColor, canvasColor.mBackgroundColor);
widgetIsTransparent = eTransparencyOpaque != rootView->GetWidget()->GetTransparencyMode();
if (!widgetIsTransparent) {
// Ensure that we always paint a color for the root (in case there's
// no background at all or a partly transparent image).
canvasColor.mBackgroundColor = aPresContext->DefaultBackgroundColor();
}
} }
} }