Changed inline and block reflow code to reset reflow state's isTopOfPage

data member based on whether IsAdjacentWithTop() is true
This commit is contained in:
troy%netscape.com 1998-12-12 17:59:30 +00:00
parent b76ea91da7
commit e0814be9c7
12 changed files with 50 additions and 21 deletions

View File

@ -2191,7 +2191,7 @@ nsBaseIBFrame::ReflowBlockFrame(nsBlockReflowState& aState,
nsRect availSpace(availX, aState.mY, availWidth, availHeight);
WillReflowFrame(aState, aLine, frame);
nsReflowStatus frameReflowStatus;
rv = brc.ReflowBlock(frame, availSpace, frameReflowStatus);
rv = brc.ReflowBlock(frame, availSpace, aState.IsAdjacentWithTop(), frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}
@ -2340,7 +2340,8 @@ nsBaseIBFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// Reflow the inline frame
nsReflowStatus frameReflowStatus;
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, frameReflowStatus);
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, aState.IsAdjacentWithTop(),
frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -71,7 +71,9 @@ nsBlockReflowContext::ComputeMarginsFor(nsIPresContext& aPresContext,
}
nsresult
nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace,
nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
const nsRect& aSpace,
PRBool aIsAdjacentWithTop,
nsReflowStatus& aFrameReflowStatus)
{
nsresult rv = NS_OK;
@ -123,6 +125,9 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace,
reflowState.mRunInFrame = mRunInFrame;
reflowState.mCompactMarginWidth = mCompactMarginWidth;
reflowState.reason = reason;
if (!aIsAdjacentWithTop) {
reflowState.isTopOfPage = PR_FALSE; // make sure this is cleared
}
mLineLayout.SetUnderstandsWhiteSpace(PR_FALSE);
// Let frame know that we are reflowing it

View File

@ -47,7 +47,9 @@ public:
mCompactMarginWidth = aCompactMarginWidth;
}
nsresult ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace,
nsresult ReflowBlock(nsIFrame* aFrame,
const nsRect& aSpace,
PRBool aIsAdjacentWithTop,
nsReflowStatus& aReflowStatus);
PRBool PlaceBlock(PRBool aForceFit, PRBool aApplyTopMargin,

View File

@ -2191,7 +2191,7 @@ nsBaseIBFrame::ReflowBlockFrame(nsBlockReflowState& aState,
nsRect availSpace(availX, aState.mY, availWidth, availHeight);
WillReflowFrame(aState, aLine, frame);
nsReflowStatus frameReflowStatus;
rv = brc.ReflowBlock(frame, availSpace, frameReflowStatus);
rv = brc.ReflowBlock(frame, availSpace, aState.IsAdjacentWithTop(), frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}
@ -2340,7 +2340,8 @@ nsBaseIBFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// Reflow the inline frame
nsReflowStatus frameReflowStatus;
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, frameReflowStatus);
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, aState.IsAdjacentWithTop(),
frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -2191,7 +2191,7 @@ nsBaseIBFrame::ReflowBlockFrame(nsBlockReflowState& aState,
nsRect availSpace(availX, aState.mY, availWidth, availHeight);
WillReflowFrame(aState, aLine, frame);
nsReflowStatus frameReflowStatus;
rv = brc.ReflowBlock(frame, availSpace, frameReflowStatus);
rv = brc.ReflowBlock(frame, availSpace, aState.IsAdjacentWithTop(), frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}
@ -2340,7 +2340,8 @@ nsBaseIBFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// Reflow the inline frame
nsReflowStatus frameReflowStatus;
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, frameReflowStatus);
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, aState.IsAdjacentWithTop(),
frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -2191,7 +2191,7 @@ nsBaseIBFrame::ReflowBlockFrame(nsBlockReflowState& aState,
nsRect availSpace(availX, aState.mY, availWidth, availHeight);
WillReflowFrame(aState, aLine, frame);
nsReflowStatus frameReflowStatus;
rv = brc.ReflowBlock(frame, availSpace, frameReflowStatus);
rv = brc.ReflowBlock(frame, availSpace, aState.IsAdjacentWithTop(), frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}
@ -2340,7 +2340,8 @@ nsBaseIBFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// Reflow the inline frame
nsReflowStatus frameReflowStatus;
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, frameReflowStatus);
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, aState.IsAdjacentWithTop(),
frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -71,7 +71,9 @@ nsBlockReflowContext::ComputeMarginsFor(nsIPresContext& aPresContext,
}
nsresult
nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace,
nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
const nsRect& aSpace,
PRBool aIsAdjacentWithTop,
nsReflowStatus& aFrameReflowStatus)
{
nsresult rv = NS_OK;
@ -123,6 +125,9 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace,
reflowState.mRunInFrame = mRunInFrame;
reflowState.mCompactMarginWidth = mCompactMarginWidth;
reflowState.reason = reason;
if (!aIsAdjacentWithTop) {
reflowState.isTopOfPage = PR_FALSE; // make sure this is cleared
}
mLineLayout.SetUnderstandsWhiteSpace(PR_FALSE);
// Let frame know that we are reflowing it

View File

@ -47,7 +47,9 @@ public:
mCompactMarginWidth = aCompactMarginWidth;
}
nsresult ReflowBlock(nsIFrame* aFrame, const nsRect& aSpace,
nsresult ReflowBlock(nsIFrame* aFrame,
const nsRect& aSpace,
PRBool aIsAdjacentWithTop,
nsReflowStatus& aReflowStatus);
PRBool PlaceBlock(PRBool aForceFit, PRBool aApplyTopMargin,

View File

@ -2191,7 +2191,7 @@ nsBaseIBFrame::ReflowBlockFrame(nsBlockReflowState& aState,
nsRect availSpace(availX, aState.mY, availWidth, availHeight);
WillReflowFrame(aState, aLine, frame);
nsReflowStatus frameReflowStatus;
rv = brc.ReflowBlock(frame, availSpace, frameReflowStatus);
rv = brc.ReflowBlock(frame, availSpace, aState.IsAdjacentWithTop(), frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}
@ -2340,7 +2340,8 @@ nsBaseIBFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// Reflow the inline frame
nsReflowStatus frameReflowStatus;
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, frameReflowStatus);
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, aState.IsAdjacentWithTop(),
frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -2191,7 +2191,7 @@ nsBaseIBFrame::ReflowBlockFrame(nsBlockReflowState& aState,
nsRect availSpace(availX, aState.mY, availWidth, availHeight);
WillReflowFrame(aState, aLine, frame);
nsReflowStatus frameReflowStatus;
rv = brc.ReflowBlock(frame, availSpace, frameReflowStatus);
rv = brc.ReflowBlock(frame, availSpace, aState.IsAdjacentWithTop(), frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}
@ -2340,7 +2340,8 @@ nsBaseIBFrame::ReflowInlineFrame(nsBlockReflowState& aState,
// Reflow the inline frame
nsReflowStatus frameReflowStatus;
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, frameReflowStatus);
nsresult rv = aState.mInlineReflow->ReflowFrame(aFrame, aState.IsAdjacentWithTop(),
frameReflowStatus);
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -233,7 +233,9 @@ nsInlineReflow::SetFrame(nsIFrame* aFrame)
}
nsresult
nsInlineReflow::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus)
nsInlineReflow::ReflowFrame(nsIFrame* aFrame,
PRBool aIsAdjacentWithTop,
nsReflowStatus& aReflowStatus)
{
nsSize innerMaxElementSize;
nsHTMLReflowMetrics metrics(mComputeMaxElementSize
@ -264,7 +266,7 @@ nsInlineReflow::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus)
// Reflow the frame. If the frame must be placed somewhere else
// then we return immediately.
if (ReflowFrame(metrics, aReflowStatus)) {
if (ReflowFrame(aIsAdjacentWithTop, metrics, aReflowStatus)) {
// See if we can place the frame. If we can't fit it, then we
// return now.
if (CanPlaceFrame(metrics, aReflowStatus)) {
@ -380,7 +382,8 @@ nsInlineReflow::ComputeAvailableSize()
* Reflow the frame, choosing the appropriate reflow method.
*/
PRBool
nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
nsInlineReflow::ReflowFrame(PRBool aIsAdjacentWithTop,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus)
{
PerFrameData* pfd = mFrameData;
@ -408,6 +411,9 @@ nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
mFrameAvailSize);
reflowState.lineLayout = &mLineLayout;
reflowState.reason = reason;
if (!aIsAdjacentWithTop) {
reflowState.isTopOfPage = PR_FALSE; // make sure this is cleared
}
mLineLayout.SetUnderstandsWhiteSpace(PR_FALSE);
// Capture this state *before* we reflow the frame in case it clears

View File

@ -50,7 +50,9 @@ public:
void UpdateBand(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
PRBool aPlacedLeftFloater);
nsresult ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus);
nsresult ReflowFrame(nsIFrame* aFrame,
PRBool aIsAdjacentWithTop,
nsReflowStatus& aReflowStatus);
void VerticalAlignFrames(nsRect& aLineBox,
nscoord& aMaxAscent,
@ -105,7 +107,8 @@ protected:
PRBool ComputeAvailableSize();
PRBool ReflowFrame(nsHTMLReflowMetrics& aMetrics,
PRBool ReflowFrame(PRBool aIsAsjacentWithTop,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus);
PRBool CanPlaceFrame(nsHTMLReflowMetrics& aMetrics,