if (nsnull != aMaxElementSize) { const nsStyleSpacing* tableSpacing; GetStyleData(eStyleStruct_Spacing , ((const nsStyleStruct *&)tableSpacing)); nsMargin borderPadding; GetTableBorder (borderPadding); borderPadding += aReflowState.reflowState.mComputedPadding; nscoord cellSpacing = GetCellSpacingX(); nscoord kidWidth = aKidMaxElementSize.width + borderPadding.left + borderPadding.right + cellSpacing*2; aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidWidth); aMaxElementSize->height += aKidMaxElementSize.height; }
void nsTableFrame::PlaceChild(nsIPresContext*        aPresContext,                              InnerTableReflowState& aReflowState,                              nsIFrame*              aKidFrame,                              nsHTMLReflowMetrics&   aDesiredSize,                              nscoord                aX,                              nscoord                aY,                              nsSize*                aMaxElementSize,                              nsSize&                aKidMaxElementSize){  // Place and size the child  FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, aX, aY, 0);  // Adjust the running y-offset  aReflowState.y += aDesiredSize.height;  // If our height is constrained, then update the available height  if (PR_FALSE == aReflowState.unconstrainedHeight) {    aReflowState.availSize.height -= aDesiredSize.height;  }  const nsStyleDisplay *childDisplay;  aKidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));  // We only allow a single footer frame, and the footer frame must occur before  // any body section row groups  if ((NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == childDisplay->mDisplay) &&      !aReflowState.footerFrame && !aReflowState.firstBodySection) {    aReflowState.footerFrame = aKidFrame;  }  else if (aReflowState.footerFrame) {    // put the non footer where the footer was    nsPoint origin;    aReflowState.footerFrame->GetOrigin(origin);    aKidFrame->MoveTo(aPresContext, origin.x, origin.y);    // put the footer below the non footer    nsSize size;    aReflowState.footerFrame->GetSize(size);    origin.y = aReflowState.y - size.height;    aReflowState.footerFrame->MoveTo(aPresContext, origin.x, origin.y);  }  //XXX: this should call into layout strategy to get the width field  if (nsnull != 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();    nscoord kidWidth = aKidMaxElementSize.width + borderPadding.left + borderPadding.right + cellSpacing*2;    aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidWidth);     aMaxElementSize->height += aKidMaxElementSize.height;  }}