if (aKidFrame != aReflowState.footerFrame) { nsIFrame* kidFrame;
nscoord yInvalid = NS_UNCONSTRAINEDSIZE;   nsAutoVoidArray rowGroups; PRUint32 numRowGroups; OrderRowGroups(rowGroups, numRowGroups, nsnull); PRUint32 changeIndex; for (changeIndex = 0; changeIndex < numRowGroups; changeIndex++) { if (aKidFrame == rowGroups.ElementAt(changeIndex)) { break; } } changeIndex++;  for (PRUint32 rgX = changeIndex; rgX < numRowGroups; rgX++) { nsIFrame* kidFrame = (nsIFrame*)rowGroups.ElementAt(rgX);
nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext*        aPresContext,                                                 InnerTableReflowState& aReflowState,                                                 nsIFrame*              aKidFrame,                                                 nsSize*                aMaxElementSize,                                                 nscoord                aDeltaY){  NS_PRECONDITION(NS_UNCONSTRAINEDSIZE == aReflowState.reflowState.availableHeight,                  "we're not in galley mode");  // If it's the footer that was reflowed, then we don't need to adjust any of  // the frames, because the footer is the bottom most frame  if (aKidFrame != aReflowState.footerFrame) {    nsIFrame* kidFrame;    nsRect    kidRect;    PRBool    movedFooter = PR_FALSE;      // Move the frames that follow aKidFrame by aDeltaY, and update the running    // y-offset    for (aKidFrame->GetNextSibling(&kidFrame); kidFrame; kidFrame->GetNextSibling(&kidFrame)) {      nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(kidFrame);      if (!rgFrame) continue; // skip foreign frames      // See if it's the footer we're moving      if (kidFrame == aReflowState.footerFrame) {        movedFooter = PR_TRUE;      }        // Get the frame's bounding rect      kidFrame->GetRect(kidRect);        // Adjust the running y-offset      aReflowState.y += kidRect.height;      // Update the max element size      //XXX: this should call into layout strategy to get the width field      if (aMaxElementSize) {        const nsStyleSpacing* tableSpacing;        GetStyleData(eStyleStruct_Spacing , ((const nsStyleStruct *&)tableSpacing));        nsMargin borderPadding;        GetTableBorder (borderPadding); // gets the max border thickness for each edge        borderPadding += aReflowState.reflowState.mComputedPadding;        nscoord cellSpacing = GetCellSpacingX();        nsSize  kidMaxElementSize;        rgFrame->GetMaxElementSize(kidMaxElementSize);        nscoord kidWidth = kidMaxElementSize.width + borderPadding.left + borderPadding.right + cellSpacing*2;        aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidWidth);         aMaxElementSize->height += kidMaxElementSize.height;      }        // Adjust the y-origin if its position actually changed      if (aDeltaY != 0) {        kidRect.y += aDeltaY;        kidFrame->MoveTo(aPresContext, kidRect.x, kidRect.y);      }    }      // We also need to move the footer if there is one and we haven't already    // moved it    if (aReflowState.footerFrame && !movedFooter) {      aReflowState.footerFrame->GetRect(kidRect);            // Adjust the running y-offset      aReflowState.y += kidRect.height;        if (aDeltaY != 0) {        kidRect.y += aDeltaY;        aReflowState.footerFrame->MoveTo(aPresContext, kidRect.x, kidRect.y);      }    }    // Invalidate the area we offset. Note that we only repaint within    // our existing frame bounds.    // XXX It would be better to bitblt the row frames and not repaint,    // but we don't have such a view manager function yet...    aKidFrame->GetRect(kidRect);    if (kidRect.YMost() < mRect.height) {      nsRect  dirtyRect(0, kidRect.YMost(),                        mRect.width, mRect.height - kidRect.YMost());      Invalidate(aPresContext, dirtyRect);    }  }  return NS_OK;}