const nsStyleDisplay* rowDisplay; rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay)); if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay) { CollapseRowGroupIfNecessary(aPresContext, rowFrame, aYTotalOffset, aYGroupOffset, aRowX); } else if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) { nsRect rowRect; rowFrame->GetRect(rowRect); if (collapseGroup || (NS_STYLE_VISIBILITY_COLLAPSE == rowDisplay->mVisible)) {
const nsStyleDisplay* rowDisplay = rowFrame->GetStyleDisplay(); if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) { const nsStyleVisibility* rowVis = rowFrame->GetStyleVisibility(); PRBool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible); if (collapseRow) { SetNeedToCollapseRows(PR_TRUE); } nsRect rowRect = rowFrame->GetRect(); if (collapseGroup || collapseRow) {
nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,                                          nsIFrame* aRowGroupFrame,                                          const nscoord& aYTotalOffset,                                          nscoord& aYGroupOffset, PRInt32& aRowX){  const nsStyleDisplay* groupDisplay;  aRowGroupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)groupDisplay));    PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupDisplay->mVisible);  nsIFrame* rowFrame;  aRowGroupFrame->FirstChild(aPresContext, nsnull, &rowFrame);  while (nsnull != rowFrame) {    const nsStyleDisplay* rowDisplay;    rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)rowDisplay));    if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay) {      CollapseRowGroupIfNecessary(aPresContext, rowFrame, aYTotalOffset, aYGroupOffset, aRowX);    }    else if (NS_STYLE_DISPLAY_TABLE_ROW == rowDisplay->mDisplay) {      nsRect rowRect;      rowFrame->GetRect(rowRect);      if (collapseGroup || (NS_STYLE_VISIBILITY_COLLAPSE == rowDisplay->mVisible)) {        aYGroupOffset += rowRect.height;        rowRect.height = 0;        rowFrame->SetRect(aPresContext, rowRect);        nsIFrame* cellFrame;        rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);        while (nsnull != cellFrame) {          const nsStyleDisplay* cellDisplay;          cellFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)cellDisplay));          if (NS_STYLE_DISPLAY_TABLE_CELL == cellDisplay->mDisplay) {            nsTableCellFrame* cFrame = (nsTableCellFrame*)cellFrame;            nsRect cRect;            cFrame->GetRect(cRect);            cRect.height -= rowRect.height;            cFrame->SetCollapseOffsetY(aPresContext, -aYGroupOffset);            cFrame->SetRect(aPresContext, cRect);          }          cellFrame->GetNextSibling(&cellFrame);        }        // check if a cell above spans into here        nsTableCellMap* cellMap = GetCellMap();        if (cellMap) {          PRInt32 numCols = cellMap->GetColCount();          nsTableCellFrame* lastCell = nsnull;          for (int colX = 0; colX < numCols; colX++) {            CellData* cellData = cellMap->GetCellAt(aRowX, colX);            if (cellData && cellData->IsSpan()) { // a cell above is spanning into here              // adjust the real cell's rect only once              nsTableCellFrame* realCell = nsnull;              if (cellData->IsRowSpan())                realCell = cellMap->GetCellFrame(aRowX, colX, *cellData, PR_TRUE);              if (realCell != lastCell) {                nsRect realRect;                realCell->GetRect(realRect);                realRect.height -= rowRect.height;                realCell->SetRect(aPresContext, realRect);              }              lastCell = realCell;            }          }        }      } else { // row is not collapsed but needs to be adjusted by those that are        rowRect.y -= aYGroupOffset;        rowFrame->SetRect(aPresContext, rowRect);      }      aRowX++;    }    rowFrame->GetNextSibling(&rowFrame);  } // end row frame while  nsRect groupRect;  aRowGroupFrame->GetRect(groupRect);  groupRect.height -= aYGroupOffset;  groupRect.y -= aYTotalOffset;  aRowGroupFrame->SetRect(aPresContext, groupRect);  return NS_OK;}