From f9aa023719f7f2ceaa98dbedee88d26fed5fdbdf Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Fri, 12 Dec 2003 23:00:54 +0000 Subject: [PATCH] Fix regressions of 'overflow: hidden' on various table display types. b=221140 r=bernd sr=roc a=asa --- layout/html/table/src/nsTableFrame.cpp | 8 +++++--- layout/html/table/src/nsTableOuterFrame.cpp | 11 ++++++----- layout/html/table/src/nsTableRowFrame.cpp | 7 +++++-- layout/html/table/src/nsTableRowGroupFrame.cpp | 8 +++++--- layout/tables/nsTableFrame.cpp | 8 +++++--- layout/tables/nsTableOuterFrame.cpp | 11 ++++++----- layout/tables/nsTableRowFrame.cpp | 7 +++++-- layout/tables/nsTableRowGroupFrame.cpp | 8 +++++--- 8 files changed, 42 insertions(+), 26 deletions(-) diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 6bc7047534b4..03ca2ebea84c 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -1387,18 +1387,20 @@ nsTableFrame::PaintChildren(nsIPresContext* aPresContext, PRUint32 aFlags) { - const nsStyleDisplay* disp = GetStyleDisplay(); + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; // If overflow is hidden then set the clip rect so that children don't // leak out of us. Note that because overflow'-clip' only applies to // the content area we do this after painting the border and background - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } nsHTMLContainerFrame::PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); } diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index db1ab9876bd7..d0ee517233df 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -337,14 +337,16 @@ nsTableOuterFrame::Paint(nsIPresContext* aPresContext, // the remaining code was copied from nsContainerFrame::PaintChildren since // it only paints the primary child list - const nsStyleDisplay* disp = GetStyleDisplay(); // Child elements have the opportunity to override the visibility property // of their parent and display even if the parent is hidden // If overflow is hidden then set the clip rect so that children // don't leak out of us - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } @@ -356,7 +358,7 @@ nsTableOuterFrame::Paint(nsIPresContext* aPresContext, PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, aWhichLayer); } - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); } @@ -1602,8 +1604,7 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext* aPresContext, nsRect* oldOverflowArea = GetOverflowAreaProperty(aPresContext); PRBool innerMoved = (innerRect.x != innerOrigin.x) || (innerRect.y != innerOrigin.y); - nsSize desSize = nsSize(aDesiredSize.width, - aDesiredSize.height); + nsSize desSize(aDesiredSize.width, aDesiredSize.height); InvalidateDamage(aPresContext, (PRUint8) NO_SIDE, desSize, innerMoved, PR_FALSE, oldOverflowArea); } diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index bb1e8d4e6b09..669867f11ee4 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -559,13 +559,16 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext* aPresContext, #endif // Standards mode background painting removed. See bug 4510 + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); } diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 2a4a8fb73aa7..2de8cdf057d0 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -206,13 +206,15 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext* aPresContext, #endif // Standards mode background painting removed. See bug 4510 - const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); } diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 6bc7047534b4..03ca2ebea84c 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1387,18 +1387,20 @@ nsTableFrame::PaintChildren(nsIPresContext* aPresContext, PRUint32 aFlags) { - const nsStyleDisplay* disp = GetStyleDisplay(); + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; // If overflow is hidden then set the clip rect so that children don't // leak out of us. Note that because overflow'-clip' only applies to // the content area we do this after painting the border and background - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } nsHTMLContainerFrame::PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); } diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index db1ab9876bd7..d0ee517233df 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -337,14 +337,16 @@ nsTableOuterFrame::Paint(nsIPresContext* aPresContext, // the remaining code was copied from nsContainerFrame::PaintChildren since // it only paints the primary child list - const nsStyleDisplay* disp = GetStyleDisplay(); // Child elements have the opportunity to override the visibility property // of their parent and display even if the parent is hidden // If overflow is hidden then set the clip rect so that children // don't leak out of us - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } @@ -356,7 +358,7 @@ nsTableOuterFrame::Paint(nsIPresContext* aPresContext, PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, aWhichLayer); } - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); } @@ -1602,8 +1604,7 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext* aPresContext, nsRect* oldOverflowArea = GetOverflowAreaProperty(aPresContext); PRBool innerMoved = (innerRect.x != innerOrigin.x) || (innerRect.y != innerOrigin.y); - nsSize desSize = nsSize(aDesiredSize.width, - aDesiredSize.height); + nsSize desSize(aDesiredSize.width, aDesiredSize.height); InvalidateDamage(aPresContext, (PRUint8) NO_SIDE, desSize, innerMoved, PR_FALSE, oldOverflowArea); } diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index bb1e8d4e6b09..669867f11ee4 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -559,13 +559,16 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext* aPresContext, #endif // Standards mode background painting removed. See bug 4510 + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); } diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 2a4a8fb73aa7..2de8cdf057d0 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -206,13 +206,15 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext* aPresContext, #endif // Standards mode background painting removed. See bug 4510 - const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + PRUint8 overflow = GetStyleDisplay()->mOverflow; + PRBool clip = overflow == NS_STYLE_OVERFLOW_HIDDEN || + overflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE; + if (clip) { aRenderingContext.PushState(); SetOverflowClipRect(aRenderingContext); } PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); - if (disp && (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow)) { + if (clip) { PRBool clipState; aRenderingContext.PopState(clipState); }