diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 976c022cc43..078fc9eb360 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -43,6 +43,7 @@ #include "nsIView.h" #include "nsHTMLAtoms.h" #include "nsHTMLIIDs.h" +#include "nsIReflowCommand.h" #ifdef NS_DEBUG static PRBool gsDebug = PR_FALSE; @@ -1071,6 +1072,23 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, startTime = PR_IntervalNow(); } + if (eReflowReason_Incremental == aReflowState.reason) { + // XXX Deal with the case where the reflow command is targeted at us + nsIFrame* kidFrame; + aReflowState.reflowCommand->GetNext(kidFrame); + + // Pass along the reflow command + nsReflowMetrics desiredSize(nsnull); + // XXX Correctly compute the available space... + nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize); + kidFrame->WillReflow(*aPresContext); + aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); + + // XXX For the time being just fall through and treat it like a + // pass 2 reflow... + mPass = kPASS_SECOND; + } + if (PR_TRUE==NeedsReflow(aReflowState.maxSize)) { if (PR_FALSE==IsFirstPassValid()) @@ -2634,7 +2652,7 @@ PRBool nsTableFrame::SetCellLayoutData(nsIPresContext* aPresContext, result = firstInFlow->SetCellLayoutData(aPresContext, aData, aCell); else { - if (kPASS_FIRST==GetReflowPass()) + if ((kPASS_FIRST==GetReflowPass()) || (kPASS_INCREMENTAL==GetReflowPass())) { if (nsnull==mColumnLayoutData) { diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index be1d16507d8..0c0c6fde138 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -420,7 +420,7 @@ private: /** table reflow is a multi-pass operation. Use these constants to keep track of * which pass is currently being executed. */ - enum {kPASS_UNDEFINED=0, kPASS_FIRST=1, kPASS_SECOND=2, kPASS_THIRD=3}; + enum {kPASS_UNDEFINED=0, kPASS_FIRST=1, kPASS_SECOND=2, kPASS_THIRD=3, kPASS_INCREMENTAL=4}; nsVoidArray *mColumnLayoutData; // array of array of cellLayoutData's PRInt32 *mColumnWidths; // widths of each column diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index de21aa19799..615353c21c3 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -295,6 +295,7 @@ nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext* aPresContext, kidFrame->MoveTo(kidMargin.left, aState.y); nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ? aState.innerTableMaxSize : aState.availSize); + mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_INCREMENTAL); aStatus = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, pKidMaxElementSize, aState); @@ -307,6 +308,8 @@ nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext* aPresContext, aState.prevMaxPosBottomMargin = bottomMargin; } + // XXX We're not correctly dealing with maxElementSize... + // Adjust the frames that follow return AdjustSiblingsAfterReflow(aPresContext, aState, kidFrame, kidRect.YMost() - oldKidRect.YMost()); @@ -1078,8 +1081,12 @@ nsTableOuterFrame::ReflowChild( nsIFrame* aKidFrame, else { if (PR_TRUE==gsDebug) printf("reflowChild called with a table body\n"); - status = ((nsTableFrame*)aKidFrame)->ResizeReflowPass2(aPresContext, aDesiredSize, aKidReflowState, - mMinCaptionWidth, mMaxCaptionWidth); + if (eReflowReason_Incremental == aKidReflowState.reason) { + aKidFrame->Reflow(aPresContext, aDesiredSize, aKidReflowState, status); + } else { + status = ((nsTableFrame*)aKidFrame)->ResizeReflowPass2(aPresContext, aDesiredSize, aKidReflowState, + mMinCaptionWidth, mMaxCaptionWidth); + } } if (PR_TRUE==gsDebug) { diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 47ca194ffbd..d471a081ede 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -29,6 +29,7 @@ #include "nsColLayoutData.h" #include "nsIView.h" #include "nsIPtr.h" +#include "nsIReflowCommand.h" NS_DEF_PTR(nsIStyleContext); @@ -1051,67 +1052,94 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, PreReflowCheck(); #endif - // Initialize out parameter - if (nsnull != aDesiredSize.maxElementSize) { - aDesiredSize.maxElementSize->width = 0; - aDesiredSize.maxElementSize->height = 0; - } - - // Initialize our internal data - ResetMaxChildHeight(); - - PRBool reflowMappedOK = PR_TRUE; - - aStatus = NS_FRAME_COMPLETE; - - // Check for an overflow list - MoveOverflowToChildList(); - RowReflowState state(aPresContext, aReflowState); mContentParent->GetContentParent((nsIFrame*&)(state.tableFrame)); - // Reflow the existing frames - if (nsnull != mFirstChild) { - reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); - if (PR_FALSE == reflowMappedOK) { - aStatus = NS_FRAME_NOT_COMPLETE; - } - } + if (eReflowReason_Incremental == aReflowState.reason) { + // XXX Recover state + // XXX Deal with the case where the reflow command is targeted at us + nsIFrame* kidFrame; + aReflowState.reflowCommand->GetNext(kidFrame); - // Did we successfully relow our mapped children? - if (PR_TRUE == reflowMappedOK) { - // Any space left? - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < mContent->ChildCount()) { + // Pass along the reflow command. Reflow the child with an unconstrained + // width and get its maxElementSize + nsSize kidMaxElementSize; + nsReflowMetrics desiredSize(&kidMaxElementSize); + // XXX Correctly compute the available height... + nsSize availSpace(NS_UNCONSTRAINEDSIZE, aReflowState.maxSize.height); + nsReflowState kidReflowState(kidFrame, aReflowState, availSpace); + kidFrame->WillReflow(*aPresContext); + aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); + + // Update the cell layout data + nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, + &desiredSize, &kidMaxElementSize); + ((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData); + // XXX The equivalent of incrementally updating the column cache + state.tableFrame->SetCellLayoutData(aPresContext, kidLayoutData, (nsTableCellFrame*)kidFrame); + + // XXX Compute desired size... + + } else { + // Initialize out parameter + if (nsnull != aDesiredSize.maxElementSize) { + aDesiredSize.maxElementSize->width = 0; + aDesiredSize.maxElementSize->height = 0; + } + + // Initialize our internal data + ResetMaxChildHeight(); + + PRBool reflowMappedOK = PR_TRUE; + + aStatus = NS_FRAME_COMPLETE; + + // Check for an overflow list + MoveOverflowToChildList(); + + // Reflow the existing frames + if (nsnull != mFirstChild) { + reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + if (PR_FALSE == reflowMappedOK) { aStatus = NS_FRAME_NOT_COMPLETE; } - } else if (NextChildOffset() < mContent->ChildCount()) { - // Try and pull-up some children from a next-in-flow - if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { - // If we still have unmapped children then create some new frames + } + + // Did we successfully relow our mapped children? + if (PR_TRUE == reflowMappedOK) { + // Any space left? + if (state.availSize.height <= 0) { + // No space left. Don't try to pull-up children or reflow unmapped if (NextChildOffset() < mContent->ChildCount()) { - aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + aStatus = NS_FRAME_NOT_COMPLETE; + } + } else if (NextChildOffset() < mContent->ChildCount()) { + // Try and pull-up some children from a next-in-flow + if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { + // If we still have unmapped children then create some new frames + if (NextChildOffset() < mContent->ChildCount()) { + aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + } + } else { + // We were unable to pull-up all the existing frames from the + // next in flow + aStatus = NS_FRAME_NOT_COMPLETE; } - } else { - // We were unable to pull-up all the existing frames from the - // next in flow - aStatus = NS_FRAME_NOT_COMPLETE; } } + + if (NS_FRAME_IS_COMPLETE(aStatus)) { + // Don't forget to add in the bottom margin from our last child. + // Only add it in if there's room for it. + nscoord margin = state.prevMaxPosBottomMargin - + state.prevMaxNegBottomMargin; + } + + // Return our desired rect + aDesiredSize.width = state.x; + aDesiredSize.height = state.maxCellVertSpace; } - if (NS_FRAME_IS_COMPLETE(aStatus)) { - // Don't forget to add in the bottom margin from our last child. - // Only add it in if there's room for it. - nscoord margin = state.prevMaxPosBottomMargin - - state.prevMaxNegBottomMargin; - } - - // Return our desired rect - aDesiredSize.width = state.x; - aDesiredSize.height = state.maxCellVertSpace; - #ifdef NS_DEBUG PostReflowCheck(aStatus); #endif diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 6fef74a1d99..9894abff93a 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -26,6 +26,7 @@ #include "nsIContentDelegate.h" #include "nsIView.h" #include "nsIPtr.h" +#include "nsIReflowCommand.h" #ifdef NS_DEBUG static PRBool gsDebug1 = PR_FALSE; @@ -844,68 +845,85 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, PreReflowCheck(); #endif - // Initialize out parameter - if (nsnull != aDesiredSize.maxElementSize) { - aDesiredSize.maxElementSize->width = 0; - aDesiredSize.maxElementSize->height = 0; - } + if (eReflowReason_Incremental == aReflowState.reason) { + // XXX Recover state + // XXX Deal with the case where the reflow command is targeted at us + nsIFrame* kidFrame; + aReflowState.reflowCommand->GetNext(kidFrame); - PRBool reflowMappedOK = PR_TRUE; + // Pass along the reflow command + nsReflowMetrics desiredSize(nsnull); + // XXX Correctly compute the available space... + nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize); + kidFrame->WillReflow(*aPresContext); + aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); - aStatus = NS_FRAME_COMPLETE; + // XXX Compute desired size... - // Check for an overflow list - MoveOverflowToChildList(); - - RowGroupReflowState state(aPresContext, aReflowState); - - // Reflow the existing frames - if (nsnull != mFirstChild) { - reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); - if (PR_FALSE == reflowMappedOK) { - aStatus = NS_FRAME_NOT_COMPLETE; + } else { + // Initialize out parameter + if (nsnull != aDesiredSize.maxElementSize) { + aDesiredSize.maxElementSize->width = 0; + aDesiredSize.maxElementSize->height = 0; } - } - - // Did we successfully reflow our mapped children? - if (PR_TRUE == reflowMappedOK) { - // Any space left? - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < mContent->ChildCount()) { + + PRBool reflowMappedOK = PR_TRUE; + + aStatus = NS_FRAME_COMPLETE; + + // Check for an overflow list + MoveOverflowToChildList(); + + RowGroupReflowState state(aPresContext, aReflowState); + + // Reflow the existing frames + if (nsnull != mFirstChild) { + reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + if (PR_FALSE == reflowMappedOK) { aStatus = NS_FRAME_NOT_COMPLETE; } - } else if (NextChildOffset() < mContent->ChildCount()) { - // Try and pull-up some children from a next-in-flow - if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { - // If we still have unmapped children then create some new frames + } + + // Did we successfully reflow our mapped children? + if (PR_TRUE == reflowMappedOK) { + // Any space left? + if (state.availSize.height <= 0) { + // No space left. Don't try to pull-up children or reflow unmapped if (NextChildOffset() < mContent->ChildCount()) { - aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + aStatus = NS_FRAME_NOT_COMPLETE; + } + } else if (NextChildOffset() < mContent->ChildCount()) { + // Try and pull-up some children from a next-in-flow + if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { + // If we still have unmapped children then create some new frames + if (NextChildOffset() < mContent->ChildCount()) { + aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + } + } else { + // We were unable to pull-up all the existing frames from the + // next in flow + aStatus = NS_FRAME_NOT_COMPLETE; } - } else { - // We were unable to pull-up all the existing frames from the - // next in flow - aStatus = NS_FRAME_NOT_COMPLETE; } } - } - - if (NS_FRAME_IS_COMPLETE(aStatus)) { - // Don't forget to add in the bottom margin from our last child. - // Only add it in if there's room for it. - nscoord margin = state.prevMaxPosBottomMargin - - state.prevMaxNegBottomMargin; - if (state.availSize.height >= margin) { - state.y += margin; + + if (NS_FRAME_IS_COMPLETE(aStatus)) { + // Don't forget to add in the bottom margin from our last child. + // Only add it in if there's room for it. + nscoord margin = state.prevMaxPosBottomMargin - + state.prevMaxNegBottomMargin; + if (state.availSize.height >= margin) { + state.y += margin; + } } + + // Return our desired rect + //NS_ASSERTION(0GetNext(kidFrame); + + // Pass along the reflow command + nsReflowMetrics desiredSize(nsnull); + // XXX Correctly compute the available space... + nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize); + kidFrame->WillReflow(*aPresContext); + aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); + + // XXX For the time being just fall through and treat it like a + // pass 2 reflow... + mPass = kPASS_SECOND; + } + if (PR_TRUE==NeedsReflow(aReflowState.maxSize)) { if (PR_FALSE==IsFirstPassValid()) @@ -2634,7 +2652,7 @@ PRBool nsTableFrame::SetCellLayoutData(nsIPresContext* aPresContext, result = firstInFlow->SetCellLayoutData(aPresContext, aData, aCell); else { - if (kPASS_FIRST==GetReflowPass()) + if ((kPASS_FIRST==GetReflowPass()) || (kPASS_INCREMENTAL==GetReflowPass())) { if (nsnull==mColumnLayoutData) { diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index be1d16507d8..0c0c6fde138 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -420,7 +420,7 @@ private: /** table reflow is a multi-pass operation. Use these constants to keep track of * which pass is currently being executed. */ - enum {kPASS_UNDEFINED=0, kPASS_FIRST=1, kPASS_SECOND=2, kPASS_THIRD=3}; + enum {kPASS_UNDEFINED=0, kPASS_FIRST=1, kPASS_SECOND=2, kPASS_THIRD=3, kPASS_INCREMENTAL=4}; nsVoidArray *mColumnLayoutData; // array of array of cellLayoutData's PRInt32 *mColumnWidths; // widths of each column diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index de21aa19799..615353c21c3 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -295,6 +295,7 @@ nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext* aPresContext, kidFrame->MoveTo(kidMargin.left, aState.y); nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ? aState.innerTableMaxSize : aState.availSize); + mInnerTableFrame->SetReflowPass(nsTableFrame::kPASS_INCREMENTAL); aStatus = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, pKidMaxElementSize, aState); @@ -307,6 +308,8 @@ nsresult nsTableOuterFrame::IncrementalReflow(nsIPresContext* aPresContext, aState.prevMaxPosBottomMargin = bottomMargin; } + // XXX We're not correctly dealing with maxElementSize... + // Adjust the frames that follow return AdjustSiblingsAfterReflow(aPresContext, aState, kidFrame, kidRect.YMost() - oldKidRect.YMost()); @@ -1078,8 +1081,12 @@ nsTableOuterFrame::ReflowChild( nsIFrame* aKidFrame, else { if (PR_TRUE==gsDebug) printf("reflowChild called with a table body\n"); - status = ((nsTableFrame*)aKidFrame)->ResizeReflowPass2(aPresContext, aDesiredSize, aKidReflowState, - mMinCaptionWidth, mMaxCaptionWidth); + if (eReflowReason_Incremental == aKidReflowState.reason) { + aKidFrame->Reflow(aPresContext, aDesiredSize, aKidReflowState, status); + } else { + status = ((nsTableFrame*)aKidFrame)->ResizeReflowPass2(aPresContext, aDesiredSize, aKidReflowState, + mMinCaptionWidth, mMaxCaptionWidth); + } } if (PR_TRUE==gsDebug) { diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 47ca194ffbd..d471a081ede 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -29,6 +29,7 @@ #include "nsColLayoutData.h" #include "nsIView.h" #include "nsIPtr.h" +#include "nsIReflowCommand.h" NS_DEF_PTR(nsIStyleContext); @@ -1051,67 +1052,94 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, PreReflowCheck(); #endif - // Initialize out parameter - if (nsnull != aDesiredSize.maxElementSize) { - aDesiredSize.maxElementSize->width = 0; - aDesiredSize.maxElementSize->height = 0; - } - - // Initialize our internal data - ResetMaxChildHeight(); - - PRBool reflowMappedOK = PR_TRUE; - - aStatus = NS_FRAME_COMPLETE; - - // Check for an overflow list - MoveOverflowToChildList(); - RowReflowState state(aPresContext, aReflowState); mContentParent->GetContentParent((nsIFrame*&)(state.tableFrame)); - // Reflow the existing frames - if (nsnull != mFirstChild) { - reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); - if (PR_FALSE == reflowMappedOK) { - aStatus = NS_FRAME_NOT_COMPLETE; - } - } + if (eReflowReason_Incremental == aReflowState.reason) { + // XXX Recover state + // XXX Deal with the case where the reflow command is targeted at us + nsIFrame* kidFrame; + aReflowState.reflowCommand->GetNext(kidFrame); - // Did we successfully relow our mapped children? - if (PR_TRUE == reflowMappedOK) { - // Any space left? - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < mContent->ChildCount()) { + // Pass along the reflow command. Reflow the child with an unconstrained + // width and get its maxElementSize + nsSize kidMaxElementSize; + nsReflowMetrics desiredSize(&kidMaxElementSize); + // XXX Correctly compute the available height... + nsSize availSpace(NS_UNCONSTRAINEDSIZE, aReflowState.maxSize.height); + nsReflowState kidReflowState(kidFrame, aReflowState, availSpace); + kidFrame->WillReflow(*aPresContext); + aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); + + // Update the cell layout data + nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, + &desiredSize, &kidMaxElementSize); + ((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData); + // XXX The equivalent of incrementally updating the column cache + state.tableFrame->SetCellLayoutData(aPresContext, kidLayoutData, (nsTableCellFrame*)kidFrame); + + // XXX Compute desired size... + + } else { + // Initialize out parameter + if (nsnull != aDesiredSize.maxElementSize) { + aDesiredSize.maxElementSize->width = 0; + aDesiredSize.maxElementSize->height = 0; + } + + // Initialize our internal data + ResetMaxChildHeight(); + + PRBool reflowMappedOK = PR_TRUE; + + aStatus = NS_FRAME_COMPLETE; + + // Check for an overflow list + MoveOverflowToChildList(); + + // Reflow the existing frames + if (nsnull != mFirstChild) { + reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + if (PR_FALSE == reflowMappedOK) { aStatus = NS_FRAME_NOT_COMPLETE; } - } else if (NextChildOffset() < mContent->ChildCount()) { - // Try and pull-up some children from a next-in-flow - if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { - // If we still have unmapped children then create some new frames + } + + // Did we successfully relow our mapped children? + if (PR_TRUE == reflowMappedOK) { + // Any space left? + if (state.availSize.height <= 0) { + // No space left. Don't try to pull-up children or reflow unmapped if (NextChildOffset() < mContent->ChildCount()) { - aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + aStatus = NS_FRAME_NOT_COMPLETE; + } + } else if (NextChildOffset() < mContent->ChildCount()) { + // Try and pull-up some children from a next-in-flow + if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { + // If we still have unmapped children then create some new frames + if (NextChildOffset() < mContent->ChildCount()) { + aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + } + } else { + // We were unable to pull-up all the existing frames from the + // next in flow + aStatus = NS_FRAME_NOT_COMPLETE; } - } else { - // We were unable to pull-up all the existing frames from the - // next in flow - aStatus = NS_FRAME_NOT_COMPLETE; } } + + if (NS_FRAME_IS_COMPLETE(aStatus)) { + // Don't forget to add in the bottom margin from our last child. + // Only add it in if there's room for it. + nscoord margin = state.prevMaxPosBottomMargin - + state.prevMaxNegBottomMargin; + } + + // Return our desired rect + aDesiredSize.width = state.x; + aDesiredSize.height = state.maxCellVertSpace; } - if (NS_FRAME_IS_COMPLETE(aStatus)) { - // Don't forget to add in the bottom margin from our last child. - // Only add it in if there's room for it. - nscoord margin = state.prevMaxPosBottomMargin - - state.prevMaxNegBottomMargin; - } - - // Return our desired rect - aDesiredSize.width = state.x; - aDesiredSize.height = state.maxCellVertSpace; - #ifdef NS_DEBUG PostReflowCheck(aStatus); #endif diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 6fef74a1d99..9894abff93a 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -26,6 +26,7 @@ #include "nsIContentDelegate.h" #include "nsIView.h" #include "nsIPtr.h" +#include "nsIReflowCommand.h" #ifdef NS_DEBUG static PRBool gsDebug1 = PR_FALSE; @@ -844,68 +845,85 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext, PreReflowCheck(); #endif - // Initialize out parameter - if (nsnull != aDesiredSize.maxElementSize) { - aDesiredSize.maxElementSize->width = 0; - aDesiredSize.maxElementSize->height = 0; - } + if (eReflowReason_Incremental == aReflowState.reason) { + // XXX Recover state + // XXX Deal with the case where the reflow command is targeted at us + nsIFrame* kidFrame; + aReflowState.reflowCommand->GetNext(kidFrame); - PRBool reflowMappedOK = PR_TRUE; + // Pass along the reflow command + nsReflowMetrics desiredSize(nsnull); + // XXX Correctly compute the available space... + nsReflowState kidReflowState(kidFrame, aReflowState, aReflowState.maxSize); + kidFrame->WillReflow(*aPresContext); + aStatus = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); - aStatus = NS_FRAME_COMPLETE; + // XXX Compute desired size... - // Check for an overflow list - MoveOverflowToChildList(); - - RowGroupReflowState state(aPresContext, aReflowState); - - // Reflow the existing frames - if (nsnull != mFirstChild) { - reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); - if (PR_FALSE == reflowMappedOK) { - aStatus = NS_FRAME_NOT_COMPLETE; + } else { + // Initialize out parameter + if (nsnull != aDesiredSize.maxElementSize) { + aDesiredSize.maxElementSize->width = 0; + aDesiredSize.maxElementSize->height = 0; } - } - - // Did we successfully reflow our mapped children? - if (PR_TRUE == reflowMappedOK) { - // Any space left? - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < mContent->ChildCount()) { + + PRBool reflowMappedOK = PR_TRUE; + + aStatus = NS_FRAME_COMPLETE; + + // Check for an overflow list + MoveOverflowToChildList(); + + RowGroupReflowState state(aPresContext, aReflowState); + + // Reflow the existing frames + if (nsnull != mFirstChild) { + reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + if (PR_FALSE == reflowMappedOK) { aStatus = NS_FRAME_NOT_COMPLETE; } - } else if (NextChildOffset() < mContent->ChildCount()) { - // Try and pull-up some children from a next-in-flow - if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { - // If we still have unmapped children then create some new frames + } + + // Did we successfully reflow our mapped children? + if (PR_TRUE == reflowMappedOK) { + // Any space left? + if (state.availSize.height <= 0) { + // No space left. Don't try to pull-up children or reflow unmapped if (NextChildOffset() < mContent->ChildCount()) { - aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + aStatus = NS_FRAME_NOT_COMPLETE; + } + } else if (NextChildOffset() < mContent->ChildCount()) { + // Try and pull-up some children from a next-in-flow + if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { + // If we still have unmapped children then create some new frames + if (NextChildOffset() < mContent->ChildCount()) { + aStatus = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize); + } + } else { + // We were unable to pull-up all the existing frames from the + // next in flow + aStatus = NS_FRAME_NOT_COMPLETE; } - } else { - // We were unable to pull-up all the existing frames from the - // next in flow - aStatus = NS_FRAME_NOT_COMPLETE; } } - } - - if (NS_FRAME_IS_COMPLETE(aStatus)) { - // Don't forget to add in the bottom margin from our last child. - // Only add it in if there's room for it. - nscoord margin = state.prevMaxPosBottomMargin - - state.prevMaxNegBottomMargin; - if (state.availSize.height >= margin) { - state.y += margin; + + if (NS_FRAME_IS_COMPLETE(aStatus)) { + // Don't forget to add in the bottom margin from our last child. + // Only add it in if there's room for it. + nscoord margin = state.prevMaxPosBottomMargin - + state.prevMaxNegBottomMargin; + if (state.availSize.height >= margin) { + state.y += margin; + } } + + // Return our desired rect + //NS_ASSERTION(0