зеркало из https://github.com/mozilla/gecko-dev.git
reorder cellmaps if the rowgroup order might have changed bug 339130 r7sr=bzbarsky
This commit is contained in:
Родитель
e6259982ea
Коммит
70ec56f2d3
|
@ -81,7 +81,6 @@ nsTableCellMap::nsTableCellMap(nsTableFrame& aTableFrame,
|
|||
nsAutoVoidArray orderedRowGroups;
|
||||
PRUint32 numRowGroups;
|
||||
aTableFrame.OrderRowGroups(orderedRowGroups, numRowGroups);
|
||||
NS_ASSERTION(orderedRowGroups.Count() == (PRInt32) numRowGroups,"problem in OrderRowGroups");
|
||||
|
||||
for (PRUint32 rgX = 0; rgX < numRowGroups; rgX++) {
|
||||
nsTableRowGroupFrame* rgFrame =
|
||||
|
@ -299,6 +298,44 @@ nsTableCellMap::GetMapFor(nsTableRowGroupFrame& aRowGroup)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsTableCellMap::Synchronize(nsTableFrame* aTableFrame)
|
||||
{
|
||||
nsAutoVoidArray orderedRowGroups;
|
||||
nsAutoVoidArray maps;
|
||||
PRUint32 numRowGroups;
|
||||
PRInt32 mapIndex;
|
||||
|
||||
maps.Clear();
|
||||
aTableFrame->OrderRowGroups(orderedRowGroups, numRowGroups);
|
||||
if (!numRowGroups) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (PRUint32 rgX = 0; rgX < numRowGroups; rgX++) {
|
||||
nsTableRowGroupFrame* rgFrame =
|
||||
nsTableFrame::GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgX));
|
||||
if (rgFrame) {
|
||||
nsCellMap* map = GetMapFor(*rgFrame);
|
||||
if (map) {
|
||||
if (!maps.AppendElement(map)) {
|
||||
delete map;
|
||||
NS_WARNING("Could not AppendElement");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mapIndex = maps.Count() - 1;
|
||||
nsCellMap* nextMap = (nsCellMap*) maps.ElementAt(mapIndex);
|
||||
nextMap->SetNextSibling(nsnull);
|
||||
for (mapIndex-- ; mapIndex >= 0; mapIndex--) {
|
||||
nsCellMap* map = (nsCellMap*) maps.ElementAt(mapIndex);
|
||||
map->SetNextSibling(nextMap);
|
||||
nextMap = map;
|
||||
}
|
||||
mFirstMap = nextMap;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsTableCellMap::HasMoreThanOneCell(PRInt32 aRowIndex)
|
||||
{
|
||||
|
|
|
@ -94,6 +94,9 @@ public:
|
|||
|
||||
nsCellMap* GetMapFor(nsTableRowGroupFrame& aRowGroup);
|
||||
|
||||
/** synchronize the cellmaps with the rowgroups again **/
|
||||
void Synchronize(nsTableFrame* aTableFrame);
|
||||
|
||||
nsTableCellFrame* GetCellFrame(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
CellData& aData,
|
||||
|
|
|
@ -418,6 +418,8 @@ nsTableFrame::SetInitialChildList(nsIAtom* aListName,
|
|||
}
|
||||
else if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
|
||||
{
|
||||
NS_ASSERTION(nsLayoutAtoms::tableColGroupFrame == childFrame->GetType(),
|
||||
"This is not a colgroup");
|
||||
if (mColGroups.IsEmpty())
|
||||
mColGroups.SetFrames(childFrame);
|
||||
else
|
||||
|
@ -1110,7 +1112,7 @@ nsTableFrame::InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
|||
PRBool aConsiderSpans)
|
||||
{
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("insertRowsBefore firstRow=%d \n", aRowIndex);
|
||||
printf("=== insertRowsBefore firstRow=%d \n", aRowIndex);
|
||||
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
|
||||
#endif
|
||||
|
||||
|
@ -1142,7 +1144,7 @@ nsTableFrame::InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
|||
}
|
||||
}
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("insertRowsAfter \n");
|
||||
printf("=== insertRowsAfter \n");
|
||||
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
|
||||
#endif
|
||||
|
||||
|
@ -1172,7 +1174,7 @@ void nsTableFrame::RemoveRows(nsTableRowFrame& aFirstRowFrame,
|
|||
|
||||
PRInt32 firstRowIndex = aFirstRowFrame.GetRowIndex();
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("removeRowsBefore firstRow=%d numRows=%d\n", firstRowIndex, aNumRowsToRemove);
|
||||
printf("=== removeRowsBefore firstRow=%d numRows=%d\n", firstRowIndex, aNumRowsToRemove);
|
||||
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
|
||||
#endif
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
|
@ -1203,8 +1205,8 @@ void nsTableFrame::RemoveRows(nsTableRowFrame& aFirstRowFrame,
|
|||
}
|
||||
AdjustRowIndices(firstRowIndex, -aNumRowsToRemove);
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("removeRowsAfter\n");
|
||||
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
|
||||
printf("=== removeRowsAfter\n");
|
||||
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1275,7 +1277,7 @@ nsTableFrame::InsertRowGroups(nsIFrame* aFirstRowGroupFrame,
|
|||
nsIFrame* aLastRowGroupFrame)
|
||||
{
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("insertRowGroupsBefore");
|
||||
printf("=== insertRowGroupsBefore\n");
|
||||
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
|
||||
#endif
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
|
@ -1296,6 +1298,7 @@ nsTableFrame::InsertRowGroups(nsIFrame* aFirstRowGroupFrame,
|
|||
? nsnull : GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex - 1));
|
||||
// create and add the cell map for the row group
|
||||
cellMap->InsertGroupCellMap(*rgFrame, priorRG);
|
||||
cellMap->Synchronize(this);
|
||||
// collect the new row frames in an array and add them to the table
|
||||
PRInt32 numRows = CollectRows(kidFrame, rows);
|
||||
if (numRows > 0) {
|
||||
|
@ -1319,8 +1322,8 @@ nsTableFrame::InsertRowGroups(nsIFrame* aFirstRowGroupFrame,
|
|||
}
|
||||
}
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("insertRowGroupsAfter");
|
||||
Dump(PR_TRUE, PR_FALSE, PR_TRUE);
|
||||
printf("=== insertRowGroupsAfter\n");
|
||||
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2452,7 +2455,7 @@ nsTableFrame::AppendFrames(nsIAtom* aListName,
|
|||
}
|
||||
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("TableFrame::AppendFrames");
|
||||
printf("=== TableFrame::AppendFrames\n");
|
||||
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
|
||||
#endif
|
||||
SetNeedStrategyInit(PR_TRUE); // XXX assume the worse
|
||||
|
@ -2508,7 +2511,10 @@ nsTableFrame::InsertFrames(nsIAtom* aListName,
|
|||
}
|
||||
|
||||
AppendDirtyReflowCommand(this);
|
||||
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("=== TableFrame::InsertFrames\n");
|
||||
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2570,7 +2576,9 @@ nsTableFrame::RemoveFrame(nsIAtom* aListName,
|
|||
AdjustRowIndices(startRowIndex, -numRows);
|
||||
// remove the row group frame from the sibling chain
|
||||
mFrames.DestroyFrame(aOldFrame);
|
||||
|
||||
if (cellMap) {
|
||||
cellMap->Synchronize(this);
|
||||
}
|
||||
// XXX This could probably be optimized with much effort
|
||||
SetNeedStrategyInit(PR_TRUE);
|
||||
AppendDirtyReflowCommand(this);
|
||||
|
|
Загрузка…
Ссылка в новой задаче