NS_ASSERTION(nsnull==mPrevInFlow, "never ever call me on a continuing frame!"); nsTableCellMap* cellMap = GetCellMap(); if (!cellMap) { NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!"); return; }
NS_ASSERTION(!mPrevInFlow, "never ever call me on a continuing frame!");
void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,                                        const nsHTMLReflowState& aReflowState,                                       const nsSize& aMaxSize,                                        nsSize* aMaxElementSize){  NS_ASSERTION(nsnull==mPrevInFlow, "never ever call me on a continuing frame!");  nsTableCellMap* cellMap = GetCellMap();  if (!cellMap) {    NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!");    return;  }  PRInt32 numCols = cellMap->GetColCount();  if (numCols>mColumnWidthsLength)  {    PRInt32 priorColumnWidthsLength=mColumnWidthsLength;    if (0 == priorColumnWidthsLength) {      mColumnWidthsLength = numCols;    } else {      while (numCols>mColumnWidthsLength)        mColumnWidthsLength += kColumnWidthIncrement;    }    PRInt32 * newColumnWidthsArray = new PRInt32[mColumnWidthsLength];    nsCRT::memset (newColumnWidthsArray, 0, mColumnWidthsLength*sizeof(PRInt32));    if (mColumnWidths) {      nsCRT::memcpy (newColumnWidthsArray, mColumnWidths, priorColumnWidthsLength*sizeof(PRInt32));      delete [] mColumnWidths;    }    mColumnWidths = newColumnWidthsArray;  }  // need to figure out the overall table width constraint  // default case, get 100% of available space  PRInt32 maxWidth = CalcBorderBoxWidth(aReflowState);  // based on the compatibility mode, create a table layout strategy  nscoord boxWidth = CalcBorderBoxWidth(aReflowState);  if (nsnull == mTableLayoutStrategy) {    nsCompatibility mode;    aPresContext->GetCompatibilityMode(&mode);    if (!IsAutoLayout(&aReflowState))      mTableLayoutStrategy = new FixedTableLayoutStrategy(this);    else      mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);    mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);    mBits.mColumnWidthsValid=PR_TRUE;  }  // fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars  // reflow gets called twice and the 2nd time has the correct space available.  else if (!IsAutoLayout(&aReflowState)) {    mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);  }  mTableLayoutStrategy->BalanceColumnWidths(aPresContext, mStyleContext, aReflowState, maxWidth);  //Dump(PR_TRUE, PR_TRUE);  mBits.mColumnWidthsSet=PR_TRUE;  // if collapsing borders, compute the top and bottom edges now that we have column widths  if ((NS_STYLE_BORDER_COLLAPSE == GetBorderCollapseStyle()) && mBorderCollapser) {    mBorderCollapser->ComputeHorizontalBorders(aPresContext, 0, cellMap->GetRowCount()-1);  }}