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();
if (NS_GET_A(canvasColor.mBackgroundColor) == 0) {
nsIView* rootView;
vm->GetRootView(rootView);
if (!rootView->GetParent()) {
PRBool widgetIsTransparent = PR_FALSE;
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.
//
// 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())
// We don't want to draw a bg for glass windows either
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();
}
canvasColor.mBackgroundColor =
NS_ComposeColors(backColor, canvasColor.mBackgroundColor);
}
}