insert new rowgroup cellmaps in the order predicted by OrderRowGroups, bug=317554 r/sr=roc

This commit is contained in:
bmlk%gmx.de 2005-12-16 19:10:56 +00:00
Родитель 772085a80e
Коммит e58b48020a
3 изменённых файлов: 57 добавлений и 29 удалений

Просмотреть файл

@ -2111,8 +2111,24 @@ void nsCellMap::RemoveCell(nsTableCellMap& aMap,
void nsCellMap::Dump(PRBool aIsBorderCollapse) const
{
printf("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this);
nsTableRowGroupFrame* rg = GetRowGroup();
const nsStyleDisplay* display = rg->GetStyleDisplay();
switch (display->mDisplay) {
case NS_STYLE_DISPLAY_TABLE_HEADER_GROUP:
printf(" thead ");
break;
case NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP:
printf(" tfoot ");
break;
case NS_STYLE_DISPLAY_TABLE_ROW_GROUP:
printf(" tbody ");
break;
default:
printf("HUH? wrong display type on rowgroup");
}
PRInt32 mapRowCount = mRows.Count();
printf(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount);
printf("mapRowCount=%d tableRowCount=%d\n", mapRowCount, mRowCount);
PRInt32 rowIndex, colIndex;
for (rowIndex = 0; rowIndex < mapRowCount; rowIndex++) {

Просмотреть файл

@ -203,6 +203,10 @@ protected:
friend class nsCellMap;
friend class BCMapCellIterator;
friend class BCMapBorderIterator;
/** Insert a row group cellmap after aPrevMap, if aPrefMap is null insert it
* at the beginning, the ordering of the cellmap corresponds to the ordering of
* rowgroups once OrderRowGroups has been called
*/
void InsertGroupCellMap(nsCellMap* aPrevMap,
nsCellMap& aNewMap);
void DeleteRightBottomBorders();

Просмотреть файл

@ -1270,46 +1270,54 @@ void
nsTableFrame::InsertRowGroups(nsIFrame* aFirstRowGroupFrame,
nsIFrame* aLastRowGroupFrame)
{
#ifdef DEBUG_TABLE_CELLMAP
printf("insertRowGroupsBefore");
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
#endif
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
nsAutoVoidArray orderedRowGroups;
PRUint32 numRowGroups;
OrderRowGroups(orderedRowGroups, numRowGroups);
nsAutoVoidArray rows;
for (nsIFrame* kidFrame = aFirstRowGroupFrame; kidFrame;
kidFrame = kidFrame->GetNextSibling()) {
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(kidFrame);
if (rgFrame) {
// get the prior row group in display order
PRUint32 rgIndex;
for (rgIndex = 0; rgIndex < numRowGroups; rgIndex++) {
if (GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex)) == rgFrame) {
// Loop over the rowgroups and check if some of them are new, if they are
// insert cellmaps in the order that is predefined by OrderRowGroups,
for (PRUint32 rgIndex = 0; rgIndex < numRowGroups; rgIndex++) {
nsIFrame* kidFrame = aFirstRowGroupFrame;
while (kidFrame) {
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(kidFrame);
if (GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex)) == rgFrame) {
nsTableRowGroupFrame* priorRG = (0 == rgIndex)
? nsnull : GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex - 1));
// create and add the cell map for the row group
cellMap->InsertGroupCellMap(*rgFrame, priorRG);
// collect the new row frames in an array and add them to the table
PRInt32 numRows = CollectRows(kidFrame, rows);
if (numRows > 0) {
PRInt32 rowIndex = 0;
if (priorRG) {
PRInt32 priorNumRows = priorRG->GetRowCount();
rowIndex = priorRG->GetStartRowIndex() + priorNumRows;
}
InsertRows(*rgFrame, rows, rowIndex, PR_TRUE);
rows.Clear();
}
break;
}
else {
if (kidFrame == aLastRowGroupFrame) {
break;
}
kidFrame = kidFrame->GetNextSibling();
}
nsTableRowGroupFrame* priorRG = (0 == rgIndex)
? nsnull : GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex - 1));
// create and add the cell map for the row group
cellMap->InsertGroupCellMap(*rgFrame, priorRG);
// collect the new row frames in an array and add them to the table
PRInt32 numRows = CollectRows(kidFrame, rows);
if (numRows > 0) {
PRInt32 rowIndex = 0;
if (priorRG) {
PRInt32 priorNumRows = priorRG->GetRowCount();
rowIndex = priorRG->GetStartRowIndex() + priorNumRows;
}
InsertRows(*rgFrame, rows, rowIndex, PR_TRUE);
rows.Clear();
}
}
if (kidFrame == aLastRowGroupFrame) {
break;
}
}
}
#ifdef DEBUG_TABLE_CELLMAP
printf("insertRowGroupsAfter");
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
#endif
}