diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 86fc228b554..4b0336fa7aa 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/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/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index 7359449cf51..bd20a7e8d5a 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/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/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index 7359449cf51..bd20a7e8d5a 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/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