From d8ba6d491902d712da8351d156d77a77c748c851 Mon Sep 17 00:00:00 2001 From: troy Date: Wed, 24 Jun 1998 16:35:21 +0000 Subject: [PATCH] Changed to make sure we link the child frame into the list of frames before we reflow it --- layout/html/table/src/nsTableCellFrame.cpp | 1 + layout/html/table/src/nsTableFrame.cpp | 49 ++++++++++--------- layout/html/table/src/nsTableOuterFrame.cpp | 6 +-- layout/html/table/src/nsTableRowFrame.cpp | 43 +++++++++------- .../html/table/src/nsTableRowGroupFrame.cpp | 18 ++++--- layout/tables/nsTableCellFrame.cpp | 1 + layout/tables/nsTableFrame.cpp | 49 ++++++++++--------- layout/tables/nsTableOuterFrame.cpp | 6 +-- layout/tables/nsTableRowFrame.cpp | 43 +++++++++------- layout/tables/nsTableRowGroupFrame.cpp | 18 ++++--- 10 files changed, 126 insertions(+), 108 deletions(-) diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index b90cdadf9ce9..2fefde9ab0a1 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -322,6 +322,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; nsReflowState kidReflowState(mFirstChild, aReflowState, availSize); mFirstChild->WillReflow(*aPresContext); + mFirstChild->MoveTo(leftInset, topInset); aStatus = ReflowChild(mFirstChild, aPresContext, kidSize, kidReflowState); if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT) diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 3a10ed6f75db..41a780104808 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -1223,12 +1223,27 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, this, kidStyleContext, kidFrame); reflowReason = eReflowReason_Initial; NS_RELEASE(kidDel); + + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + // Our first child + mFirstChild = kidFrame; + SetFirstContentOffset(kidFrame); + if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@ + } + mChildCount++; } nsSize maxKidElementSize(0,0); nsReflowState kidReflowState(kidFrame, aReflowState, availSize, reflowReason); + PRInt32 yCoord = y; + if (NS_UNCONSTRAINEDSIZE!=yCoord) + yCoord+= topInset; kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(leftInset, yCoord); result = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState); // Place the child since some of it's content fit in us. @@ -1236,9 +1251,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, printf ("%p: reflow of row group returned desired=%d,%d, max-element=%d,%d\n", this, kidSize.width, kidSize.height, kidMaxSize.width, kidMaxSize.height); } - PRInt32 yCoord = y; - if (NS_UNCONSTRAINEDSIZE!=yCoord) - yCoord+= topInset; kidFrame->SetRect(nsRect(leftInset, yCoord, kidSize.width, kidSize.height)); if (NS_UNCONSTRAINEDSIZE==kidSize.height) @@ -1252,17 +1264,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, maxSize.height = kidMaxSize.height; } - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - // Our first child (**blush**) - mFirstChild = kidFrame; - SetFirstContentOffset(kidFrame); - if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@ - } prevKidFrame = kidFrame; - mChildCount++; if (NS_FRAME_IS_NOT_COMPLETE(result)) { // If the child didn't finish layout then it means that it used @@ -2031,6 +2033,15 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, kidFrame); } + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + mFirstChild = kidFrame; // our first child + SetFirstContentOffset(kidFrame); + } + mChildCount++; + // Try to reflow the child into the available space. It might not // fit or might need continuing. nsReflowMetrics kidSize(pKidMaxElementSize); @@ -2038,6 +2049,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize, eReflowReason_Initial); kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(0, aState.y); nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize, kidReflowState); // Did the child fit? @@ -2057,8 +2069,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, // apply the bottom margin when we hit the next child (or // finish). //aState.y += topMargin; - nsRect kidRect (0, 0, kidSize.width, kidSize.height); - kidRect.y += aState.y; + nsRect kidRect (0, aState.y, kidSize.width, kidSize.height); const nsStyleDisplay *childDisplay; kidFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay)); if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay || @@ -2068,15 +2079,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize); } - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - mFirstChild = kidFrame; // our first child - SetFirstContentOffset(kidFrame); - } prevKidFrame = kidFrame; - mChildCount++; kidIndex++; // Did the child complete? diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index b5066b016901..8ac0450fa409 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -637,7 +637,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex if ((kidFrame == mFirstChild) || (aState.availSize.height > 0)) { // Reflow the child into the available space kidFrame->WillReflow(*aPresContext); - // XXX Set the origin... + kidFrame->MoveTo(kidMargin.left, aState.y); nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ? aState.innerTableMaxSize : aState.availSize, eReflowReason_Resize); @@ -662,9 +662,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex // Place the child after taking into account it's margin aState.y += topMargin; - nsRect kidRect (0, 0, kidSize.width, kidSize.height); - kidRect.x += kidMargin.left; - kidRect.y += aState.y; + nsRect kidRect (kidMargin.left, aState.y, kidSize.width, kidSize.height); PlaceChild(aState, kidFrame, kidRect, aMaxElementSize, kidMaxElementSize); if (bottomMargin < 0) { aState.prevMaxNegBottomMargin = -bottomMargin; diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index a785d46433d1..4f303a4a8b88 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -943,17 +943,40 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, maxTopMargin = PR_MAX(margin.top,maxTopMargin); maxBottomMargin = PR_MAX(margin.bottom,maxBottomMargin); + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + mFirstChild = kidFrame; // our first child + SetFirstContentOffset(kidFrame); + } + mChildCount++; + + // Compute the origin for the child frame + aState.x = margin.left; + // if we're constrained, compute the x offset where the cell should be put + if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width) + { + // Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1) + PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); + for (PRInt32 colIndex=0; colIndexGetColumnWidth(colIndex); + } + // Try to reflow the child into the available space. It might not // fit or might need continuing. nsReflowMetrics desiredSize(pKidMaxElementSize); desiredSize.width=desiredSize.height=desiredSize.ascent=desiredSize.descent=0; nsReflowStatus status; + + // Inform the child it's being reflowed + kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(aState.x, topMargin); if (NS_UNCONSTRAINEDSIZE == aState.availSize.width) { nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize, eReflowReason_Initial); // Reflow the child into the available space - kidFrame->WillReflow(*aPresContext); status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, &desiredSize, pKidMaxElementSize); ((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData); @@ -969,7 +992,6 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, NS_ASSERTION(0WillReflow(*aPresContext); status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); } if (nsnull!=pKidMaxElementSize) @@ -999,28 +1021,11 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, break; } - aState.x = margin.left; - // if we're constrained, compute the x offset where the cell should be put - if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width) - { - // Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1) - PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); - for (PRInt32 colIndex=0; colIndexGetColumnWidth(colIndex); - } // Place the child nsRect kidRect (aState.x, topMargin, desiredSize.width, desiredSize.height); PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize); - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - mFirstChild = kidFrame; // our first child - SetFirstContentOffset(kidFrame); - } prevKidFrame = kidFrame; - mChildCount++; kidIndex++; // Did the child complete? diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 9894abff93a8..663e37e9cfae 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -766,6 +766,15 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, kidFrame); } + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + mFirstChild = kidFrame; // our first child + SetFirstContentOffset(kidFrame); + } + mChildCount++; + // Try to reflow the child into the available space. It might not // fit or might need continuing. nsReflowMetrics kidSize(pKidMaxElementSize); @@ -773,6 +782,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize, eReflowReason_Initial); kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(0, aState.y); nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize, kidReflowState); @@ -793,15 +803,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, kidRect.y += aState.y; PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize); - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - mFirstChild = kidFrame; // our first child - SetFirstContentOffset(kidFrame); - } prevKidFrame = kidFrame; - mChildCount++; kidIndex++; // Did the child complete? diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index b90cdadf9ce9..2fefde9ab0a1 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -322,6 +322,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext, kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0; nsReflowState kidReflowState(mFirstChild, aReflowState, availSize); mFirstChild->WillReflow(*aPresContext); + mFirstChild->MoveTo(leftInset, topInset); aStatus = ReflowChild(mFirstChild, aPresContext, kidSize, kidReflowState); if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT) diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 3a10ed6f75db..41a780104808 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1223,12 +1223,27 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, this, kidStyleContext, kidFrame); reflowReason = eReflowReason_Initial; NS_RELEASE(kidDel); + + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + // Our first child + mFirstChild = kidFrame; + SetFirstContentOffset(kidFrame); + if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@ + } + mChildCount++; } nsSize maxKidElementSize(0,0); nsReflowState kidReflowState(kidFrame, aReflowState, availSize, reflowReason); + PRInt32 yCoord = y; + if (NS_UNCONSTRAINEDSIZE!=yCoord) + yCoord+= topInset; kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(leftInset, yCoord); result = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState); // Place the child since some of it's content fit in us. @@ -1236,9 +1251,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, printf ("%p: reflow of row group returned desired=%d,%d, max-element=%d,%d\n", this, kidSize.width, kidSize.height, kidMaxSize.width, kidMaxSize.height); } - PRInt32 yCoord = y; - if (NS_UNCONSTRAINEDSIZE!=yCoord) - yCoord+= topInset; kidFrame->SetRect(nsRect(leftInset, yCoord, kidSize.width, kidSize.height)); if (NS_UNCONSTRAINEDSIZE==kidSize.height) @@ -1252,17 +1264,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, maxSize.height = kidMaxSize.height; } - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - // Our first child (**blush**) - mFirstChild = kidFrame; - SetFirstContentOffset(kidFrame); - if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@ - } prevKidFrame = kidFrame; - mChildCount++; if (NS_FRAME_IS_NOT_COMPLETE(result)) { // If the child didn't finish layout then it means that it used @@ -2031,6 +2033,15 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, kidFrame); } + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + mFirstChild = kidFrame; // our first child + SetFirstContentOffset(kidFrame); + } + mChildCount++; + // Try to reflow the child into the available space. It might not // fit or might need continuing. nsReflowMetrics kidSize(pKidMaxElementSize); @@ -2038,6 +2049,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize, eReflowReason_Initial); kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(0, aState.y); nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize, kidReflowState); // Did the child fit? @@ -2057,8 +2069,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, // apply the bottom margin when we hit the next child (or // finish). //aState.y += topMargin; - nsRect kidRect (0, 0, kidSize.width, kidSize.height); - kidRect.y += aState.y; + nsRect kidRect (0, aState.y, kidSize.width, kidSize.height); const nsStyleDisplay *childDisplay; kidFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay)); if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay || @@ -2068,15 +2079,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize); } - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - mFirstChild = kidFrame; // our first child - SetFirstContentOffset(kidFrame); - } prevKidFrame = kidFrame; - mChildCount++; kidIndex++; // Did the child complete? diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index b5066b016901..8ac0450fa409 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -637,7 +637,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex if ((kidFrame == mFirstChild) || (aState.availSize.height > 0)) { // Reflow the child into the available space kidFrame->WillReflow(*aPresContext); - // XXX Set the origin... + kidFrame->MoveTo(kidMargin.left, aState.y); nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ? aState.innerTableMaxSize : aState.availSize, eReflowReason_Resize); @@ -662,9 +662,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex // Place the child after taking into account it's margin aState.y += topMargin; - nsRect kidRect (0, 0, kidSize.width, kidSize.height); - kidRect.x += kidMargin.left; - kidRect.y += aState.y; + nsRect kidRect (kidMargin.left, aState.y, kidSize.width, kidSize.height); PlaceChild(aState, kidFrame, kidRect, aMaxElementSize, kidMaxElementSize); if (bottomMargin < 0) { aState.prevMaxNegBottomMargin = -bottomMargin; diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index a785d46433d1..4f303a4a8b88 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -943,17 +943,40 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, maxTopMargin = PR_MAX(margin.top,maxTopMargin); maxBottomMargin = PR_MAX(margin.bottom,maxBottomMargin); + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + mFirstChild = kidFrame; // our first child + SetFirstContentOffset(kidFrame); + } + mChildCount++; + + // Compute the origin for the child frame + aState.x = margin.left; + // if we're constrained, compute the x offset where the cell should be put + if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width) + { + // Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1) + PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); + for (PRInt32 colIndex=0; colIndexGetColumnWidth(colIndex); + } + // Try to reflow the child into the available space. It might not // fit or might need continuing. nsReflowMetrics desiredSize(pKidMaxElementSize); desiredSize.width=desiredSize.height=desiredSize.ascent=desiredSize.descent=0; nsReflowStatus status; + + // Inform the child it's being reflowed + kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(aState.x, topMargin); if (NS_UNCONSTRAINEDSIZE == aState.availSize.width) { nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize, eReflowReason_Initial); // Reflow the child into the available space - kidFrame->WillReflow(*aPresContext); status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, &desiredSize, pKidMaxElementSize); ((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData); @@ -969,7 +992,6 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, NS_ASSERTION(0WillReflow(*aPresContext); status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState); } if (nsnull!=pKidMaxElementSize) @@ -999,28 +1021,11 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, break; } - aState.x = margin.left; - // if we're constrained, compute the x offset where the cell should be put - if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width) - { - // Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1) - PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); - for (PRInt32 colIndex=0; colIndexGetColumnWidth(colIndex); - } // Place the child nsRect kidRect (aState.x, topMargin, desiredSize.width, desiredSize.height); PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize); - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - mFirstChild = kidFrame; // our first child - SetFirstContentOffset(kidFrame); - } prevKidFrame = kidFrame; - mChildCount++; kidIndex++; // Did the child complete? diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 9894abff93a8..663e37e9cfae 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -766,6 +766,15 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, kidFrame); } + // Link child frame into the list of children + if (nsnull != prevKidFrame) { + prevKidFrame->SetNextSibling(kidFrame); + } else { + mFirstChild = kidFrame; // our first child + SetFirstContentOffset(kidFrame); + } + mChildCount++; + // Try to reflow the child into the available space. It might not // fit or might need continuing. nsReflowMetrics kidSize(pKidMaxElementSize); @@ -773,6 +782,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize, eReflowReason_Initial); kidFrame->WillReflow(*aPresContext); + kidFrame->MoveTo(0, aState.y); nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize, kidReflowState); @@ -793,15 +803,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, kidRect.y += aState.y; PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize); - // Link child frame into the list of children - if (nsnull != prevKidFrame) { - prevKidFrame->SetNextSibling(kidFrame); - } else { - mFirstChild = kidFrame; // our first child - SetFirstContentOffset(kidFrame); - } prevKidFrame = kidFrame; - mChildCount++; kidIndex++; // Did the child complete?