if (aColAvailWidth > 0) { aColAvailWidth += cellSpacing; } aCellAvailWidth = aColAvailWidth;
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) { cellSpacing += aCellSpacingX; }
CalcAvailWidth(nsTableFrame&     aTableFrame,               nscoord           aTableComputedWidth,               nsTableCellFrame& aCellFrame,               nscoord           aCellSpacingX,               nscoord&          aColAvailWidth,               nscoord&          aCellAvailWidth){  aColAvailWidth = aCellAvailWidth = 0;  // If the table will intialize the strategy, leave the avail width at   // 0 (at this point) in case the cell contains a % width frame. A constrained avail   // width forces a computed width, and % width frames inside the cell base their sizes on it.   // This can happen during an incremental reflow when multiple commands get coalesced  // at the row.  if (!aTableFrame.NeedStrategyInit()) {    PRInt32 colIndex;    aCellFrame.GetColIndex(colIndex);    PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);    nscoord cellSpacing = 0;    for (PRInt32 spanX = 0; spanX < colspan; spanX++) {      nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);      if (colWidth > 0) {        aColAvailWidth += colWidth;      }      if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {        cellSpacing += aCellSpacingX;      }    }    if (aColAvailWidth > 0) {      aColAvailWidth += cellSpacing;    }     aCellAvailWidth = aColAvailWidth;  }  nsFrameState  frameState;  aCellFrame.GetFrameState(&frameState);  // for a cell with a colspan > 1, use its fix width (if set) as the avail width   // if this is its initial reflow  if ((frameState & NS_FRAME_FIRST_REFLOW) && (aTableFrame.GetEffectiveColSpan(aCellFrame) > 1)) {    // see if the cell has a style width specified    const nsStylePosition* cellPosition;    aCellFrame.GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)cellPosition);    if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) {      // need to add padding into fixed width      nsMargin padding(0,0,0,0);      if (NS_UNCONSTRAINEDSIZE != aTableComputedWidth) {        padding = nsTableFrame::GetPadding(nsSize(aTableComputedWidth, 0), &aCellFrame);      }      nscoord fixWidth = cellPosition->mWidth.GetCoordValue() + padding.left + padding.right;      aCellAvailWidth = PR_MIN(aColAvailWidth, fixWidth);    }  }}