Fixed it so that we don't ignore painting child frames of a parent frame

thas has "visibility:hidden", because child elements can override their
parent's visibility


git-svn-id: svn://10.0.0.236/trunk@14928 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
troy%netscape.com 1998-11-19 03:52:29 +00:00
parent b01a5a7be7
commit 72f91661b7
10 changed files with 154 additions and 126 deletions

View File

@ -4986,6 +4986,8 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
// Only paint the border and background if we're visible
if (disp->mVisible) {
PRIntn skipSides = GetSkipSides();
const nsStyleColor* color = (const nsStyleColor*)
@ -4999,23 +5001,25 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
// Child elements have the opportunity to override the visibility
// property and display even if the parent is hidden
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
return NS_OK;
}

View File

@ -4986,6 +4986,8 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
// Only paint the border and background if we're visible
if (disp->mVisible) {
PRIntn skipSides = GetSkipSides();
const nsStyleColor* color = (const nsStyleColor*)
@ -4999,23 +5001,25 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
// Child elements have the opportunity to override the visibility
// property and display even if the parent is hidden
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
return NS_OK;
}

View File

@ -4986,6 +4986,8 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
// Only paint the border and background if we're visible
if (disp->mVisible) {
PRIntn skipSides = GetSkipSides();
const nsStyleColor* color = (const nsStyleColor*)
@ -4999,23 +5001,25 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
// Child elements have the opportunity to override the visibility
// property and display even if the parent is hidden
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
return NS_OK;
}

View File

@ -244,29 +244,29 @@ nsContainerFrame::PaintChildren(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
// Paint our children only if we are visible
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mVisible) {
PRBool clipState;
// 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) {
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// Child elements have the opportunity to override the visibility property
// of their parent and display even if the parent is hidden
PRBool clipState;
nsIFrame* kid = mFirstChild;
while (nsnull != kid) {
PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid);
kid->GetNextSibling(kid);
}
// 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) {
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
aRenderingContext.PopState(clipState);
}
nsIFrame* kid = mFirstChild;
while (nsnull != kid) {
PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid);
kid->GetNextSibling(kid);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
aRenderingContext.PopState(clipState);
}
}

View File

@ -102,10 +102,12 @@ nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
// Now paint the kids
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
}
// Now paint the kids. Note that child elements have the opportunity to
// override the visibility property and display even if their parent is
// hidden
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
return NS_OK;
}

View File

@ -4986,6 +4986,8 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
// Only paint the border and background if we're visible
if (disp->mVisible) {
PRIntn skipSides = GetSkipSides();
const nsStyleColor* color = (const nsStyleColor*)
@ -4999,23 +5001,25 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
// Child elements have the opportunity to override the visibility
// property and display even if the parent is hidden
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
return NS_OK;
}

View File

@ -4986,6 +4986,8 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
// Only paint the border and background if we're visible
if (disp->mVisible) {
PRIntn skipSides = GetSkipSides();
const nsStyleColor* color = (const nsStyleColor*)
@ -4999,23 +5001,25 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
// Child elements have the opportunity to override the visibility
// property and display even if the parent is hidden
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
return NS_OK;
}

View File

@ -4986,6 +4986,8 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
// Only paint the border and background if we're visible
if (disp->mVisible) {
PRIntn skipSides = GetSkipSides();
const nsStyleColor* color = (const nsStyleColor*)
@ -4999,23 +5001,25 @@ nsBlockFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// 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) {
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
// Child elements have the opportunity to override the visibility
// property and display even if the parent is hidden
PaintFloaters(aPresContext, aRenderingContext, aDirtyRect);
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
PRBool clipState;
aRenderingContext.PopState(clipState);
}
return NS_OK;
}

View File

@ -244,29 +244,29 @@ nsContainerFrame::PaintChildren(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
// Paint our children only if we are visible
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mVisible) {
PRBool clipState;
// 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) {
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
// Child elements have the opportunity to override the visibility property
// of their parent and display even if the parent is hidden
PRBool clipState;
nsIFrame* kid = mFirstChild;
while (nsnull != kid) {
PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid);
kid->GetNextSibling(kid);
}
// 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) {
aRenderingContext.PushState();
aRenderingContext.SetClipRect(nsRect(0, 0, mRect.width, mRect.height),
nsClipCombine_kIntersect, clipState);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
aRenderingContext.PopState(clipState);
}
nsIFrame* kid = mFirstChild;
while (nsnull != kid) {
PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid);
kid->GetNextSibling(kid);
}
if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) {
aRenderingContext.PopState(clipState);
}
}

View File

@ -102,10 +102,12 @@ nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext,
aDirtyRect, rect, *color, 0, 0);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *spacing, skipSides);
// Now paint the kids
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
}
// Now paint the kids. Note that child elements have the opportunity to
// override the visibility property and display even if their parent is
// hidden
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
return NS_OK;
}