Bug 474201: always set the view manager's default background in nsCSSRendering::PaintBackground, use only the prescontext's default background in PresShell::Paint. r+sr=roc

--HG--
extra : rebase_source : 585e5e1803e98d25163fdcdf7f0aa758177e932c
This commit is contained in:
Zack Weinberg 2009-01-22 17:18:59 +13:00
Родитель d2f5ec869c
Коммит 5ebb54c102
2 изменённых файлов: 11 добавлений и 25 удалений

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

@ -889,9 +889,8 @@ nsCSSRendering::FindNonTransparentBackground(nsStyleContext* aContext,
* |FindBackground| returns true if a background should be painted, and
* the resulting style context to use for the background information
* will be filled in to |aBackground|. It fills in a boolean indicating
* whether the frame is the canvas frame to allow PaintBackground to
* ensure that it always paints something non-transparent for the
* canvas.
* whether the frame is the canvas frame, because PaintBackground must
* propagate that frame's background color to the view manager.
*/
// Returns true if aFrame is a canvas frame.
@ -1178,7 +1177,7 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
color = aForFrame->GetStyleBackground();
}
if (isCanvas && NS_GET_A(color->mBackgroundColor) == 255) {
if (isCanvas) {
nsIViewManager* vm = aPresContext->GetViewManager();
vm->SetDefaultBackgroundColor(color->mBackgroundColor);
}

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

@ -5352,38 +5352,25 @@ PresShell::Paint(nsIView* aView,
// Compute the backstop color for the view. This color must be
// totally transparent if the view is within a glass or transparent
// widget; otherwise, we compose all the view managers' default
// background colors in order to get something completely opaque.
// Nested view managers might not have an opaque default, but the
// root view manager must. See bug 467459.
// widget; otherwise, use the default in the prescontext, which will
// be opaque.
PRBool needTransparency = PR_FALSE;
nsIViewManager *lastMgr = mViewManager;
nscolor backgroundColor;
lastMgr->GetDefaultBackgroundColor(&backgroundColor);
for (nsIView *view = aView; view; view = view->GetParent()) {
if (view->HasWidget() &&
view->GetWidget()->GetTransparencyMode() != eTransparencyOpaque) {
backgroundColor = NS_RGBA(0,0,0,0);
needTransparency = PR_TRUE;
break;
}
if (NS_GET_A(backgroundColor) < 255) {
nsIViewManager *thisMgr = view->GetViewManager();
NS_ASSERTION(thisMgr, "view without view manager");
if (lastMgr != thisMgr) {
nscolor underColor;
thisMgr->GetDefaultBackgroundColor(&underColor);
backgroundColor = NS_ComposeColors(underColor, backgroundColor);
lastMgr = thisMgr;
}
}
}
NS_ASSERTION(needTransparency || NS_GET_A(backgroundColor) == 255,
"root view manager's default background isn't opaque");
nscolor backgroundColor;
if (needTransparency)
backgroundColor = NS_RGBA(0,0,0,0);
else
backgroundColor = mPresContext->DefaultBackgroundColor();
nsIFrame* frame = static_cast<nsIFrame*>(aView->GetClientData());
if (frame) {
nsLayoutUtils::PaintFrame(aRenderingContext, frame, aDirtyRegion,