nsSize               kidMaxElementSize; nsHTMLReflowMetrics desiredSize(aDesiredSize.maxElementSize ? &kidMaxElementSize : nsnull, aDesiredSize.mFlags);
nsHTMLReflowMetrics desiredSize(nsnull);
NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext*        aPresContext,                                         nsHTMLReflowMetrics&   aDesiredSize,                                         InnerTableReflowState& aReflowState,                                         nsReflowStatus&        aStatus,                                         nsIFrame *             aNextFrame){  nsresult rv;  // Recover the state as if aNextFrame is about to be reflowed  RecoverState(aReflowState, aNextFrame, aDesiredSize.maxElementSize);  // Remember the old rect  nsRect  oldKidRect;  aNextFrame->GetRect(oldKidRect);  // Pass along the reflow command  nsSize               kidMaxElementSize;  nsHTMLReflowMetrics desiredSize(aDesiredSize.maxElementSize ? &kidMaxElementSize : nsnull,                                  aDesiredSize.mFlags);  nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState,                                   aNextFrame, aReflowState.availSize);  nscoord x = aReflowState.mBorderPadding.left;  nscoord y = aReflowState.mBorderPadding.top + aReflowState.y;  rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState,                   x, y, 0, aStatus);  // Place the row group frame. Don't use PlaceChild(), because it moves  // the footer frame as well. We'll adjust the footer frame later on in  // AdjustSiblingsAfterReflow()  nsRect  kidRect(x, y, desiredSize.width, desiredSize.height);  FinishReflowChild(aNextFrame, aPresContext, desiredSize, x, y, 0);  // Adjust the running y-offset  aReflowState.y += desiredSize.height + GetCellSpacingY();  // If our height is constrained, then update the available height  if (PR_FALSE == aReflowState.unconstrainedHeight) {    aReflowState.availSize.height -= desiredSize.height;  }  // Update the max element size  //XXX: this should call into layout strategy to get the width field  if (nsnull != aDesiredSize.maxElementSize)   {    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();    nscoord kidWidth = kidMaxElementSize.width + borderPadding.left + borderPadding.right + cellSpacing*2;    aDesiredSize.maxElementSize->width = PR_MAX(aDesiredSize.maxElementSize->width, kidWidth);     aDesiredSize.maxElementSize->height += kidMaxElementSize.height;  }  // If the column width info is valid, then adjust the row group frames  // that follow. Otherwise, return and we'll recompute the column widths  // and reflow all the row group frames  if (!NeedsReflow(aReflowState.reflowState)) {    // If the row group frame changed height, then damage the horizontal strip    // that was either added or went away    if (desiredSize.height != oldKidRect.height) {      nsRect  dirtyRect;      dirtyRect.x = 0;      dirtyRect.y = PR_MIN(oldKidRect.YMost(), kidRect.YMost());      dirtyRect.width = mRect.width;      dirtyRect.height = PR_MAX(oldKidRect.YMost(), kidRect.YMost()) -                         dirtyRect.y;      Invalidate(aPresContext, dirtyRect);    }    // Adjust the row groups that follow    AdjustSiblingsAfterReflow(aPresContext, aReflowState, aNextFrame,                              aDesiredSize.maxElementSize, desiredSize.height -                              oldKidRect.height);    // Return our size and our status    aDesiredSize.width = ComputeDesiredWidth(aReflowState.reflowState);    nscoord defaultHeight = aReflowState.y + aReflowState.mBorderPadding.top +                            aReflowState.mBorderPadding.bottom;    aDesiredSize.height = ComputeDesiredHeight(aPresContext, aReflowState.reflowState,                                               defaultHeight);    // XXX Is this needed?#if 0    AdjustForCollapsingRows(aPresContext, aDesiredSize.height);    AdjustForCollapsingCols(aPresContext, aDesiredSize.width);    // once horizontal borders are computed and all row heights are set,     // we need to fix up length of vertical edges    // XXX need to figure start row and end row correctly    if ((NS_STYLE_BORDER_COLLAPSE == GetBorderCollapseStyle()) && mBorderCollapser) {      mBorderCollapser->DidComputeHorizontalBorders(aPresContext, 0, 10000);    }#endif  }  return rv;}