Bug 574621. Make sure top level content documents get an opaque background. (patch modified to review comments by romaxa) r=tnikkel

This commit is contained in:
Robert O'Callahan 2010-07-29 14:12:46 -05:00
Родитель 76898108ba
Коммит b6f426f863
1 изменённых файлов: 9 добавлений и 4 удалений

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

@ -5786,17 +5786,22 @@ void PresShell::UpdateCanvasBackground()
// If we have a frame tree and it has style information that
// specifies the background color of the canvas, update our local
// cache of that color.
nsIFrame* rootFrame = FrameConstructor()->GetRootElementStyleFrame();
if (rootFrame) {
nsIFrame* rootStyleFrame = FrameConstructor()->GetRootElementStyleFrame();
if (rootStyleFrame) {
nsStyleContext* bgStyle =
nsCSSRendering::FindRootFrameBackground(rootFrame);
nsCSSRendering::FindRootFrameBackground(rootStyleFrame);
// XXX We should really be passing the canvasframe, not the root element
// style frame but we don't have access to the canvasframe here. It isn't
// a problem because only a few frames can return something other than true
// and none of them would be a canvas frame or root element style frame.
mCanvasBackgroundColor =
nsCSSRendering::DetermineBackgroundColor(GetPresContext(), bgStyle,
rootFrame);
rootStyleFrame);
if (nsLayoutUtils::GetCrossDocParentFrame(FrameManager()->GetRootFrame()) &&
!nsContentUtils::IsChildOfSameType(mDocument)) {
mCanvasBackgroundColor =
NS_ComposeColors(mPresContext->DefaultBackgroundColor(), mCanvasBackgroundColor);
}
}
// If the root element of the document (ie html) has style 'display: none'