mColGroups.AppendFrame(nsnull, f); if (!firstAppendedColGroup) { firstAppendedColGroup = f; nsIFrame* lastChild = mFrames.LastChild(); nsTableColGroupFrame* lastColGroup = (nsTableColGroupFrame*)GetFrameAtOrBefore(aPresContext, this, lastChild, nsLayoutAtoms::tableColGroupFrame); startColIndex = (lastColGroup) ? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;
nsTableColGroupFrame* lastColGroup; PRBool doAppend = nsTableColGroupFrame::GetLastRealColGroup(this, (nsIFrame**) &lastColGroup); PRInt32 startColIndex = (lastColGroup) ? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0; if (doAppend) {  mColGroups.AppendFrame(nsnull, f);
nsTableFrame::AppendFrames(nsIPresContext* aPresContext,                           nsIPresShell&   aPresShell,                           nsIAtom*        aListName,                           nsIFrame*       aFrameList){  PRInt32 startColIndex = 0;  // Because we actually have two child lists, one for col group frames and one  // for everything else, we need to look at each frame individually  nsIFrame* f = aFrameList;  nsIFrame* firstAppendedColGroup = nsnull;  while (f) {    nsIFrame* next;    // Get the next frame and disconnect this frame from its sibling    f->GetNextSibling(&next);    f->SetNextSibling(nsnull);    // See what kind of frame we have    const nsStyleDisplay *display;    f->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));    if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == display->mDisplay) {      // Append the new col group frame      mColGroups.AppendFrame(nsnull, f);      if (!firstAppendedColGroup) {        firstAppendedColGroup = f;        nsIFrame* lastChild = mFrames.LastChild();        nsTableColGroupFrame* lastColGroup =           (nsTableColGroupFrame*)GetFrameAtOrBefore(aPresContext, this, lastChild,                                                    nsLayoutAtoms::tableColGroupFrame);        startColIndex = (lastColGroup)           ? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;      }    } else if (IsRowGroup(display->mDisplay)) {      // insert the rows into the table      InsertRowGroups(*aPresContext, f, GetRowCount());      // Append the new row group frame to the sibling chain      mFrames.AppendFrame(nsnull, f);    } else {      // Nothing special to do, just add the frame to our child list      mFrames.AppendFrame(nsnull, f);    }    // Move to the next frame    f = next;  }  if (firstAppendedColGroup) {    InsertColGroups(*aPresContext, startColIndex, firstAppendedColGroup);  }  // We'll need to do a pass-1 layout of all cells in all the rows of the  // rowgroup. XXX - fix this  InvalidateFirstPassCache();  // Because the number of columns may have changed invalidate them  InvalidateColumnWidths();     // Mark the table as dirty and generate a reflow command targeted at the  // outer table frame  nsIReflowCommand* reflowCmd;  nsresult          rv;    mState |= NS_FRAME_IS_DIRTY;  rv = NS_NewHTMLReflowCommand(&reflowCmd, mParent, nsIReflowCommand::ReflowDirty);  if (NS_SUCCEEDED(rv)) {    // Add the reflow command    rv = aPresShell.AppendReflowCommand(reflowCmd);    NS_RELEASE(reflowCmd);  }  return NS_OK;}