From eb5888e4447b071e97788054b4c95a22abe56c81 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Mon, 17 Jan 2000 17:45:17 +0000 Subject: [PATCH] b=21657. Changed row frame code to correctly determine if it's complete after an incremental reflow. Fixes crash when printing www.cnn.com --- layout/html/table/src/nsTableRowFrame.cpp | 16 ++++++++++++++++ layout/html/table/src/nsTableRowGroupFrame.cpp | 9 +++++++-- layout/tables/nsTableRowFrame.cpp | 16 ++++++++++++++++ layout/tables/nsTableRowGroupFrame.cpp | 9 +++++++-- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index a1a145079ce9..9ef301e659c6 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -1309,6 +1309,22 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext, { // pass reflow to unknown frame child // aDesiredSize does not change } + + // When returning whether we're complete we need to look at each of our cell + // frames. If any of them has a continuing frame, then we're not complete. We + // can't just return the status of the cell frame we just reflowed... + aStatus = NS_FRAME_COMPLETE; + if (mNextInFlow) { + for (nsIFrame* cell = mFrames.FirstChild(); cell; cell->GetNextSibling(&cell)) { + nsIFrame* contFrame; + + cell->GetNextInFlow(&contFrame); + if (contFrame) { + aStatus = NS_FRAME_NOT_COMPLETE; + break; + } + } + } return rv; } diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 2f93f3908c88..c1176427037a 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -1449,6 +1449,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresConte { nsresult rv; + // Recover the state as if aNextFrame is about to be reflowed RecoverState(aReflowState, aNextFrame, aDesiredSize.maxElementSize); @@ -1456,12 +1457,16 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresConte nsRect oldKidRect; aNextFrame->GetRect(oldKidRect); - // Pass along the reflow command + // Reflow the child giving it as much room as it wants. We'll deal with + // splitting later after final determination of rows heights taking into + // account cells with row spans... + nsSize kidAvailSize(aReflowState.availSize.width, NS_UNCONSTRAINEDSIZE); nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, - aNextFrame, aReflowState.availSize); + aNextFrame, kidAvailSize); nsSize kidMaxElementSize; nsHTMLReflowMetrics desiredSize(aDesiredSize.maxElementSize ? &kidMaxElementSize : nsnull); + // Pass along the reflow command rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, 0, aReflowState.y, 0, aStatus); diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index a1a145079ce9..9ef301e659c6 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -1309,6 +1309,22 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext, { // pass reflow to unknown frame child // aDesiredSize does not change } + + // When returning whether we're complete we need to look at each of our cell + // frames. If any of them has a continuing frame, then we're not complete. We + // can't just return the status of the cell frame we just reflowed... + aStatus = NS_FRAME_COMPLETE; + if (mNextInFlow) { + for (nsIFrame* cell = mFrames.FirstChild(); cell; cell->GetNextSibling(&cell)) { + nsIFrame* contFrame; + + cell->GetNextInFlow(&contFrame); + if (contFrame) { + aStatus = NS_FRAME_NOT_COMPLETE; + break; + } + } + } return rv; } diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 2f93f3908c88..c1176427037a 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1449,6 +1449,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresConte { nsresult rv; + // Recover the state as if aNextFrame is about to be reflowed RecoverState(aReflowState, aNextFrame, aDesiredSize.maxElementSize); @@ -1456,12 +1457,16 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext* aPresConte nsRect oldKidRect; aNextFrame->GetRect(oldKidRect); - // Pass along the reflow command + // Reflow the child giving it as much room as it wants. We'll deal with + // splitting later after final determination of rows heights taking into + // account cells with row spans... + nsSize kidAvailSize(aReflowState.availSize.width, NS_UNCONSTRAINEDSIZE); nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, - aNextFrame, aReflowState.availSize); + aNextFrame, kidAvailSize); nsSize kidMaxElementSize; nsHTMLReflowMetrics desiredSize(aDesiredSize.maxElementSize ? &kidMaxElementSize : nsnull); + // Pass along the reflow command rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, 0, aReflowState.y, 0, aStatus);