diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 19014098e78..d63888fe7b5 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -106,6 +106,7 @@ #include "nsIPrintPreviewContext.h" #include "nsIDOMMutationEvent.h" #include "nsChildIterator.h" +#include "nsCSSRendering.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -9591,7 +9592,9 @@ SyncAndInvalidateView(nsIPresContext* aPresContext, const nsStyleBackground* bg; const nsStyleDisplay* disp; const nsStyleVisibility* vis; - aFrame->GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&) bg); + PRBool isCanvas; + PRBool hasBG = + nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas); aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) disp); aFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) vis); @@ -9599,8 +9602,10 @@ SyncAndInvalidateView(nsIPresContext* aPresContext, // See if the view should be hidden or visible PRBool viewIsVisible = PR_TRUE; - PRBool viewHasTransparentContent = (bg->mBackgroundFlags & - NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT; + PRBool viewHasTransparentContent = + !isCanvas && + (!hasBG || + (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)); if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) { viewIsVisible = PR_FALSE; diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 9529352dd62..46c3c74fdf8 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -2471,7 +2471,8 @@ FindElementBackground(nsIPresContext* aPresContext, { nsIFrame *parentFrame; aForFrame->GetParent(&parentFrame); - if (IsCanvasFrame(parentFrame)) { + // XXXldb We shouldn't have to null-check |parentFrame| here. + if (parentFrame && IsCanvasFrame(parentFrame)) { // Check that we're really the root (rather than in another child list). nsIFrame *childFrame; parentFrame->FirstChild(aPresContext, nsnull, &childFrame); @@ -2484,7 +2485,7 @@ FindElementBackground(nsIPresContext* aPresContext, nsCOMPtr content; aForFrame->GetContent(getter_AddRefs(content)); nsCOMPtr body = do_QueryInterface(content); - if (!body) + if (!body || !parentFrame) return PR_TRUE; // not frame for BODY element const nsStyleBackground *htmlBG; diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 659a9cf810d..cedf60d58aa 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -60,6 +60,7 @@ #include "nsIRegion.h" #include "nsGfxCIID.h" #include "nsIServiceManager.h" +#include "nsCSSRendering.h" static NS_DEFINE_CID(kRegionCID, NS_REGION_CID); @@ -513,7 +514,9 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, const nsStyleBackground* bg; const nsStyleVisibility* vis; const nsStyleDisplay* display; - aFrame->GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)bg); + PRBool isCanvas; + PRBool hasBG = + nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas); aFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); @@ -522,8 +525,10 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, // See if the view should be hidden or visible PRBool viewIsVisible = PR_TRUE; - PRBool viewHasTransparentContent = (bg->mBackgroundFlags & - NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT; + PRBool viewHasTransparentContent = + !isCanvas && + (!hasBG || + (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)); if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) { viewIsVisible = PR_FALSE; diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 659a9cf810d..cedf60d58aa 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -60,6 +60,7 @@ #include "nsIRegion.h" #include "nsGfxCIID.h" #include "nsIServiceManager.h" +#include "nsCSSRendering.h" static NS_DEFINE_CID(kRegionCID, NS_REGION_CID); @@ -513,7 +514,9 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, const nsStyleBackground* bg; const nsStyleVisibility* vis; const nsStyleDisplay* display; - aFrame->GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)bg); + PRBool isCanvas; + PRBool hasBG = + nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas); aFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); @@ -522,8 +525,10 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, // See if the view should be hidden or visible PRBool viewIsVisible = PR_TRUE; - PRBool viewHasTransparentContent = (bg->mBackgroundFlags & - NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT; + PRBool viewHasTransparentContent = + !isCanvas && + (!hasBG || + (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)); if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) { viewIsVisible = PR_FALSE; diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 19014098e78..d63888fe7b5 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -106,6 +106,7 @@ #include "nsIPrintPreviewContext.h" #include "nsIDOMMutationEvent.h" #include "nsChildIterator.h" +#include "nsCSSRendering.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -9591,7 +9592,9 @@ SyncAndInvalidateView(nsIPresContext* aPresContext, const nsStyleBackground* bg; const nsStyleDisplay* disp; const nsStyleVisibility* vis; - aFrame->GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&) bg); + PRBool isCanvas; + PRBool hasBG = + nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas); aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) disp); aFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) vis); @@ -9599,8 +9602,10 @@ SyncAndInvalidateView(nsIPresContext* aPresContext, // See if the view should be hidden or visible PRBool viewIsVisible = PR_TRUE; - PRBool viewHasTransparentContent = (bg->mBackgroundFlags & - NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT; + PRBool viewHasTransparentContent = + !isCanvas && + (!hasBG || + (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)); if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) { viewIsVisible = PR_FALSE; diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index 9529352dd62..46c3c74fdf8 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -2471,7 +2471,8 @@ FindElementBackground(nsIPresContext* aPresContext, { nsIFrame *parentFrame; aForFrame->GetParent(&parentFrame); - if (IsCanvasFrame(parentFrame)) { + // XXXldb We shouldn't have to null-check |parentFrame| here. + if (parentFrame && IsCanvasFrame(parentFrame)) { // Check that we're really the root (rather than in another child list). nsIFrame *childFrame; parentFrame->FirstChild(aPresContext, nsnull, &childFrame); @@ -2484,7 +2485,7 @@ FindElementBackground(nsIPresContext* aPresContext, nsCOMPtr content; aForFrame->GetContent(getter_AddRefs(content)); nsCOMPtr body = do_QueryInterface(content); - if (!body) + if (!body || !parentFrame) return PR_TRUE; // not frame for BODY element const nsStyleBackground *htmlBG; diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index c940d3ba9e4..71f48c68589 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -2598,8 +2598,10 @@ nsBoxFrame::CreateViewForFrame(nsIPresContext* aPresContext, PRBool autoZIndex = PR_FALSE; PRBool fixedBackgroundAttachment = PR_FALSE; - const nsStyleBackground* bg = (const nsStyleBackground*) - aStyleContext->GetStyleData(eStyleStruct_Background); + const nsStyleBackground* bg; + PRBool isCanvas; + PRBool hasBG = + nsCSSRendering::FindBackground(aPresContext, aFrame, &bg, &isCanvas); const nsStyleVisibility* vis = (const nsStyleVisibility*) aStyleContext->GetStyleData(eStyleStruct_Visibility); @@ -2611,7 +2613,7 @@ nsBoxFrame::CreateViewForFrame(nsIPresContext* aPresContext, } // See if the frame has a fixed background attachment - if (NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment) { + if (hasBG && NS_STYLE_BG_ATTACHMENT_FIXED == bg->mBackgroundAttachment) { aForce = PR_TRUE; fixedBackgroundAttachment = PR_TRUE; } @@ -2675,8 +2677,10 @@ nsBoxFrame::CreateViewForFrame(nsIPresContext* aPresContext, // See if the view should be hidden PRBool viewIsVisible = PR_TRUE; - PRBool viewHasTransparentContent = (bg->mBackgroundFlags & - NS_STYLE_BG_COLOR_TRANSPARENT) == NS_STYLE_BG_COLOR_TRANSPARENT; + PRBool viewHasTransparentContent = + !isCanvas && + (!hasBG || + (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)); if (NS_STYLE_VISIBILITY_COLLAPSE == vis->mVisible) { viewIsVisible = PR_FALSE;