diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index b8c0a5ea433..608ef0730f3 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -686,6 +686,12 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0) = 0; + /* + * Does the frame paint its background. If not, then all or part of it will be + * painted by ancestors. + */ + virtual PRBool CanPaintBackground() { return PR_TRUE; } + /** * Event handling of GUI events. * diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 043507ebb2b..8e985b22636 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -552,8 +552,9 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, // See if the view should be hidden or visible PRBool viewIsVisible = PR_TRUE; PRBool viewHasTransparentContent = - (!hasBG || - (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)); + (!hasBG || + (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) || + !aFrame->CanPaintBackground()); if (isCanvas && viewHasTransparentContent) { nsIView* rootView; vm->GetRootView(rootView); diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index b8c0a5ea433..608ef0730f3 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -686,6 +686,12 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0) = 0; + /* + * Does the frame paint its background. If not, then all or part of it will be + * painted by ancestors. + */ + virtual PRBool CanPaintBackground() { return PR_TRUE; } + /** * Event handling of GUI events. * diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 043507ebb2b..8e985b22636 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -552,8 +552,9 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, // See if the view should be hidden or visible PRBool viewIsVisible = PR_TRUE; PRBool viewHasTransparentContent = - (!hasBG || - (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)); + (!hasBG || + (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) || + !aFrame->CanPaintBackground()); if (isCanvas && viewHasTransparentContent) { nsIView* rootView; vm->GetRootView(rootView); diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.h b/mozilla/layout/html/table/src/nsTableOuterFrame.h index eb8e7c6a520..1ba03e12c01 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.h +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.h @@ -134,6 +134,9 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); + // the outer table does not paint its entire background if it has margins and/or captions + virtual PRBool CanPaintBackground() { return PR_FALSE; } + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, diff --git a/mozilla/layout/tables/nsTableOuterFrame.h b/mozilla/layout/tables/nsTableOuterFrame.h index eb8e7c6a520..1ba03e12c01 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.h +++ b/mozilla/layout/tables/nsTableOuterFrame.h @@ -134,6 +134,9 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); + // the outer table does not paint its entire background if it has margins and/or captions + virtual PRBool CanPaintBackground() { return PR_FALSE; } + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsFramePaintLayer aWhichLayer,