Report incomplete reflow status as appropriate when frame tree is too deep. (Bug 619021) r=roc a2.0=blocking

This commit is contained in:
L. David Baron 2011-01-11 17:09:22 -08:00
Родитель 798ba3541e
Коммит 4793ae3bb5
4 изменённых файлов: 21 добавлений и 11 удалений

Просмотреть файл

@ -993,8 +993,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// delete the line with the line cursor. // delete the line with the line cursor.
ClearLineCursor(); ClearLineCursor();
if (IsFrameTreeTooDeep(aReflowState, aMetrics)) { if (IsFrameTreeTooDeep(aReflowState, aMetrics, aStatus)) {
aStatus = NS_FRAME_COMPLETE;
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -4551,7 +4551,8 @@ nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
PRBool PRBool
nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState, nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
nsHTMLReflowMetrics& aMetrics) nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus)
{ {
if (aReflowState.mReflowDepth > MAX_FRAME_DEPTH) { if (aReflowState.mReflowDepth > MAX_FRAME_DEPTH) {
NS_WARNING("frame tree too deep; setting zero size and returning"); NS_WARNING("frame tree too deep; setting zero size and returning");
@ -4562,6 +4563,16 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
aMetrics.ascent = 0; aMetrics.ascent = 0;
aMetrics.mCarriedOutBottomMargin.Zero(); aMetrics.mCarriedOutBottomMargin.Zero();
aMetrics.mOverflowAreas.Clear(); aMetrics.mOverflowAreas.Clear();
if (GetNextInFlow()) {
// Reflow depth might vary between reflows, so we might have
// successfully reflowed and split this frame before. If so, we
// shouldn't delete its continuations.
aStatus = NS_FRAME_NOT_COMPLETE;
} else {
aStatus = NS_FRAME_COMPLETE;
}
return PR_TRUE; return PR_TRUE;
} }
mState &= ~NS_FRAME_TOO_DEEP_IN_FRAME_TREE; mState &= ~NS_FRAME_TOO_DEEP_IN_FRAME_TREE;

Просмотреть файл

@ -386,13 +386,14 @@ public:
*/ */
void CheckInvalidateSizeChange(nsHTMLReflowMetrics& aNewDesiredSize); void CheckInvalidateSizeChange(nsHTMLReflowMetrics& aNewDesiredSize);
// Helper function that tests if the frame tree is too deep; if it // Helper function that tests if the frame tree is too deep; if it is
// is it marks the frame as "unflowable" and zeros out the metrics // it marks the frame as "unflowable", zeroes out the metrics, sets
// and returns PR_TRUE. Otherwise, the frame is unmarked // the reflow status, and returns PR_TRUE. Otherwise, the frame is
// "unflowable" and the metrics are not touched and PR_FALSE is // unmarked "unflowable" and the metrics and reflow status are not
// returned. // touched and PR_FALSE is returned.
PRBool IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState, PRBool IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
nsHTMLReflowMetrics& aMetrics); nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus);
// Do the work for getting the parent style context frame so that // Do the work for getting the parent style context frame so that
// other frame's |GetParentStyleContextFrame| methods can call this // other frame's |GetParentStyleContextFrame| methods can call this

Просмотреть файл

@ -392,8 +392,7 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext,
} }
} }
if (IsFrameTreeTooDeep(aReflowState, aMetrics)) { if (IsFrameTreeTooDeep(aReflowState, aMetrics, aStatus)) {
aStatus = NS_FRAME_COMPLETE;
return NS_OK; return NS_OK;
} }