From d9d3b6459dbed41d83d7d24ca236cebb85e57b97 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Sun, 31 Mar 2002 22:43:40 +0000 Subject: [PATCH] bug 130550 - Added nsIFrame::CanPaintBackground, to treat nsTableOuterFrame as transparent. a=asa, sr=attinasi, r=roc+moz git-svn-id: svn://10.0.0.236/trunk@117816 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/public/nsIFrame.h | 6 ++++++ mozilla/layout/generic/nsContainerFrame.cpp | 5 +++-- mozilla/layout/generic/nsIFrame.h | 6 ++++++ mozilla/layout/html/base/src/nsContainerFrame.cpp | 5 +++-- mozilla/layout/html/table/src/nsTableOuterFrame.h | 3 +++ mozilla/layout/tables/nsTableOuterFrame.h | 3 +++ 6 files changed, 24 insertions(+), 4 deletions(-) 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,