From 0a13434a4da3214160475f877cabd42210937555 Mon Sep 17 00:00:00 2001 From: troy Date: Fri, 12 Jun 1998 04:11:41 +0000 Subject: [PATCH] Fixed some places where the reflow reason wasn't getting correctly set for the initial reflow --- layout/html/table/src/nsTableFrame.cpp | 4 +++- layout/html/table/src/nsTableOuterFrame.cpp | 15 +++++++++++---- layout/html/table/src/nsTableOuterFrame.h | 3 ++- layout/tables/nsTableFrame.cpp | 4 +++- layout/tables/nsTableOuterFrame.cpp | 15 +++++++++++---- layout/tables/nsTableOuterFrame.h | 3 ++- 6 files changed, 32 insertions(+), 12 deletions(-) diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 86fc228b554d..4b0336fa7aab 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -698,6 +698,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, nscoord rightInset = borderPadding.right; nscoord bottomInset = borderPadding.bottom; nscoord leftInset = borderPadding.left; + nsReflowReason reflowReason = eReflowReason_Resize; /* assumes that Table's children are in the following order: * Captions @@ -739,12 +740,13 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, kidDel = kid->GetDelegate(aPresContext); nsresult rv = kidDel->CreateFrame(aPresContext, kid, this, kidStyleContext, kidFrame); + reflowReason = eReflowReason_Initial; NS_RELEASE(kidDel); } nsSize maxKidElementSize(0,0); nsReflowState kidReflowState(kidFrame, aReflowState, availSize, - eReflowReason_Resize); + reflowReason); kidFrame->WillReflow(*aPresContext); result = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState); diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 7359449cf515..bd20a7e8d5aa 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -190,14 +190,17 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, } PRBool reflowMappedOK = PR_TRUE; + PRBool isInitialReflow = PR_FALSE; aStatus = NS_FRAME_COMPLETE; // Set up our kids. They're already present, on an overflow list, // or there are none so we'll create them now MoveOverflowToChildList(); - if (nsnull==mFirstChild) + if (nsnull==mFirstChild) { CreateChildFrames(aPresContext); + isInitialReflow = PR_TRUE; + } if (nsnull!=mPrevInFlow && nsnull==mInnerTableFrame) { // if I am a continuing frame, my inner table is my prev-in-flow's mInnerTableFrame's next-in-flow CreateInnerTableFrame(aPresContext); @@ -217,7 +220,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, if (PR_FALSE==IsFirstPassValid()) { mFirstPassValid = PR_TRUE; - aStatus = ResizeReflowCaptionsPass1(aPresContext, state); + aStatus = ResizeReflowCaptionsPass1(aPresContext, state, isInitialReflow); } @@ -1033,11 +1036,14 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext) nsReflowStatus nsTableOuterFrame::ResizeReflowCaptionsPass1(nsIPresContext* aPresContext, - OuterTableReflowState& aState) + OuterTableReflowState& aState, + PRBool aIsInitialReflow) { if (nsnull!=mCaptionFrames) { PRInt32 numCaptions = mCaptionFrames->Count(); + nsReflowReason reflowReason = aIsInitialReflow ? eReflowReason_Initial : + eReflowReason_Resize; for (PRInt32 captionIndex = 0; captionIndex < numCaptions; captionIndex++) { nsSize maxElementSize(0,0); @@ -1046,7 +1052,8 @@ nsTableOuterFrame::ResizeReflowCaptionsPass1(nsIPresContext* aPresContext, kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; nsTableCaptionFrame *captionFrame = (nsTableCaptionFrame *)mCaptionFrames->ElementAt(captionIndex); nsReflowStatus status; - nsReflowState reflowState(captionFrame, aState.reflowState, maxSize, eReflowReason_Resize); + nsReflowState reflowState(captionFrame, aState.reflowState, maxSize, + reflowReason); captionFrame->WillReflow(*aPresContext); captionFrame->Reflow(aPresContext, kidSize, reflowState, status); if (mMinCaptionWidthGetDelegate(aPresContext); nsresult rv = kidDel->CreateFrame(aPresContext, kid, this, kidStyleContext, kidFrame); + reflowReason = eReflowReason_Initial; NS_RELEASE(kidDel); } nsSize maxKidElementSize(0,0); nsReflowState kidReflowState(kidFrame, aReflowState, availSize, - eReflowReason_Resize); + reflowReason); kidFrame->WillReflow(*aPresContext); result = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState); diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 7359449cf515..bd20a7e8d5aa 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -190,14 +190,17 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, } PRBool reflowMappedOK = PR_TRUE; + PRBool isInitialReflow = PR_FALSE; aStatus = NS_FRAME_COMPLETE; // Set up our kids. They're already present, on an overflow list, // or there are none so we'll create them now MoveOverflowToChildList(); - if (nsnull==mFirstChild) + if (nsnull==mFirstChild) { CreateChildFrames(aPresContext); + isInitialReflow = PR_TRUE; + } if (nsnull!=mPrevInFlow && nsnull==mInnerTableFrame) { // if I am a continuing frame, my inner table is my prev-in-flow's mInnerTableFrame's next-in-flow CreateInnerTableFrame(aPresContext); @@ -217,7 +220,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext, if (PR_FALSE==IsFirstPassValid()) { mFirstPassValid = PR_TRUE; - aStatus = ResizeReflowCaptionsPass1(aPresContext, state); + aStatus = ResizeReflowCaptionsPass1(aPresContext, state, isInitialReflow); } @@ -1033,11 +1036,14 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext) nsReflowStatus nsTableOuterFrame::ResizeReflowCaptionsPass1(nsIPresContext* aPresContext, - OuterTableReflowState& aState) + OuterTableReflowState& aState, + PRBool aIsInitialReflow) { if (nsnull!=mCaptionFrames) { PRInt32 numCaptions = mCaptionFrames->Count(); + nsReflowReason reflowReason = aIsInitialReflow ? eReflowReason_Initial : + eReflowReason_Resize; for (PRInt32 captionIndex = 0; captionIndex < numCaptions; captionIndex++) { nsSize maxElementSize(0,0); @@ -1046,7 +1052,8 @@ nsTableOuterFrame::ResizeReflowCaptionsPass1(nsIPresContext* aPresContext, kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; nsTableCaptionFrame *captionFrame = (nsTableCaptionFrame *)mCaptionFrames->ElementAt(captionIndex); nsReflowStatus status; - nsReflowState reflowState(captionFrame, aState.reflowState, maxSize, eReflowReason_Resize); + nsReflowState reflowState(captionFrame, aState.reflowState, maxSize, + reflowReason); captionFrame->WillReflow(*aPresContext); captionFrame->Reflow(aPresContext, kidSize, reflowState, status); if (mMinCaptionWidth