mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 474369 - get rid of nsVoidArray, layout/tables part. r+sr=roc
This commit is contained in:
parent
7529ae2887
commit
b2f9b630db
@ -35,7 +35,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCellMap.h"
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
@ -101,9 +101,9 @@ nsTableCellMap::~nsTableCellMap()
|
||||
cellMap = next;
|
||||
}
|
||||
|
||||
PRInt32 colCount = mCols.Count();
|
||||
PRInt32 colCount = mCols.Length();
|
||||
for (PRInt32 colX = 0; colX < colCount; colX++) {
|
||||
nsColInfo* colInfo = (nsColInfo *)mCols.ElementAt(colX);
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
if (colInfo) {
|
||||
delete colInfo;
|
||||
}
|
||||
@ -120,9 +120,9 @@ nsTableCellMap::GetRightMostBorder(PRInt32 aRowIndex)
|
||||
{
|
||||
if (!mBCInfo) ABORT1(nsnull);
|
||||
|
||||
PRInt32 numRows = mBCInfo->mRightBorders.Count();
|
||||
PRInt32 numRows = mBCInfo->mRightBorders.Length();
|
||||
if (aRowIndex < numRows) {
|
||||
return (BCData*)mBCInfo->mRightBorders.ElementAt(aRowIndex);
|
||||
return mBCInfo->mRightBorders.ElementAt(aRowIndex);
|
||||
}
|
||||
|
||||
BCData* bcData;
|
||||
@ -143,9 +143,9 @@ nsTableCellMap::GetBottomMostBorder(PRInt32 aColIndex)
|
||||
{
|
||||
if (!mBCInfo) ABORT1(nsnull);
|
||||
|
||||
PRInt32 numCols = mBCInfo->mBottomBorders.Count();
|
||||
PRInt32 numCols = mBCInfo->mBottomBorders.Length();
|
||||
if (aColIndex < numCols) {
|
||||
return (BCData*)mBCInfo->mBottomBorders.ElementAt(aColIndex);
|
||||
return mBCInfo->mBottomBorders.ElementAt(aColIndex);
|
||||
}
|
||||
|
||||
BCData* bcData;
|
||||
@ -165,26 +165,23 @@ void
|
||||
nsTableCellMap::DeleteRightBottomBorders()
|
||||
{
|
||||
if (mBCInfo) {
|
||||
PRInt32 numCols = mBCInfo->mBottomBorders.Count();
|
||||
if (numCols > 0) {
|
||||
for (PRInt32 colX = numCols - 1; colX >= 0; colX--) {
|
||||
BCData* bcData = (BCData*)mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
mBCInfo->mBottomBorders.RemoveElementAt(colX);
|
||||
PRUint32 numCols = mBCInfo->mBottomBorders.Length();
|
||||
for (PRUint32 colX = 0; colX < numCols; colX++) {
|
||||
BCData* bcData = mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
}
|
||||
PRUint32 numRows = mBCInfo->mRightBorders.Count();
|
||||
if (numRows > 0) {
|
||||
for (PRInt32 rowX = numRows - 1; rowX >= 0; rowX--) {
|
||||
BCData* bcData = (BCData*)mBCInfo->mRightBorders.ElementAt(rowX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
mBCInfo->mRightBorders.RemoveElementAt(rowX);
|
||||
mBCInfo->mBottomBorders.Clear();
|
||||
|
||||
PRUint32 numRows = mBCInfo->mRightBorders.Length();
|
||||
for (PRUint32 rowX = 0; rowX < numRows; rowX++) {
|
||||
BCData* bcData = mBCInfo->mRightBorders.ElementAt(rowX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
}
|
||||
mBCInfo->mRightBorders.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,11 +426,11 @@ nsTableCellMap::GetCellFrame(PRInt32 aRowIndex,
|
||||
nsColInfo*
|
||||
nsTableCellMap::GetColInfoAt(PRInt32 aColIndex)
|
||||
{
|
||||
PRInt32 numColsToAdd = aColIndex + 1 - mCols.Count();
|
||||
PRInt32 numColsToAdd = aColIndex + 1 - mCols.Length();
|
||||
if (numColsToAdd > 0) {
|
||||
AddColsAtEnd(numColsToAdd); // XXX this could fail to add cols in theory
|
||||
}
|
||||
return (nsColInfo*)mCols.ElementAt(aColIndex);
|
||||
return mCols.ElementAt(aColIndex);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
@ -475,7 +472,7 @@ nsTableCellMap::AddColsAtEnd(PRUint32 aNumCols)
|
||||
for (PRUint32 numX = 1; numX <= aNumCols; numX++) {
|
||||
nsColInfo* colInfo = new nsColInfo();
|
||||
if (colInfo) {
|
||||
added = mCols.AppendElement(colInfo);
|
||||
added = mCols.AppendElement(colInfo) != nsnull;
|
||||
if (!added) {
|
||||
delete colInfo;
|
||||
NS_WARNING("Could not AppendElement");
|
||||
@ -484,7 +481,7 @@ nsTableCellMap::AddColsAtEnd(PRUint32 aNumCols)
|
||||
if (mBCInfo) {
|
||||
BCData* bcData = new BCData();
|
||||
if (bcData) {
|
||||
added = mBCInfo->mBottomBorders.AppendElement(bcData);
|
||||
added = mBCInfo->mBottomBorders.AppendElement(bcData) != nsnull;
|
||||
if (!added) {
|
||||
delete bcData;
|
||||
NS_WARNING("Could not AppendElement");
|
||||
@ -502,7 +499,7 @@ nsTableCellMap::RemoveColsAtEnd()
|
||||
PRInt32 numCols = GetColCount();
|
||||
PRInt32 lastGoodColIndex = mTableFrame.GetIndexOfLastRealCol();
|
||||
for (PRInt32 colX = numCols - 1; (colX >= 0) && (colX > lastGoodColIndex); colX--) {
|
||||
nsColInfo* colInfo = (nsColInfo*)mCols.ElementAt(colX);
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
if (colInfo) {
|
||||
if ((colInfo->mNumCellsOrig <= 0) && (colInfo->mNumCellsSpan <= 0)) {
|
||||
|
||||
@ -510,9 +507,9 @@ nsTableCellMap::RemoveColsAtEnd()
|
||||
mCols.RemoveElementAt(colX);
|
||||
|
||||
if (mBCInfo) {
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Count();
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Length();
|
||||
if (colX < count) {
|
||||
BCData* bcData = (BCData*)mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
BCData* bcData = mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
@ -534,13 +531,13 @@ nsTableCellMap::ClearCols()
|
||||
{
|
||||
PRInt32 numCols = GetColCount();
|
||||
for (PRInt32 colX = numCols - 1; (colX >= 0);colX--) {
|
||||
nsColInfo* colInfo = (nsColInfo*)mCols.ElementAt(colX);
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
delete colInfo;
|
||||
mCols.RemoveElementAt(colX);
|
||||
if (mBCInfo) {
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Count();
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Length();
|
||||
if (colX < count) {
|
||||
BCData* bcData = (BCData*)mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
BCData* bcData = mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
@ -550,13 +547,13 @@ nsTableCellMap::ClearCols()
|
||||
}
|
||||
}
|
||||
void
|
||||
nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
|
||||
nsVoidArray& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea)
|
||||
nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
|
||||
nsTArray<nsTableRowFrame*>& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
PRInt32 numNewRows = aRows.Count();
|
||||
PRInt32 numNewRows = aRows.Length();
|
||||
if ((numNewRows <= 0) || (aFirstRowIndex < 0)) ABORT0();
|
||||
|
||||
PRInt32 rowIndex = aFirstRowIndex;
|
||||
@ -572,11 +569,11 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
|
||||
#endif
|
||||
if (mBCInfo) {
|
||||
BCData* bcData;
|
||||
PRInt32 count = mBCInfo->mRightBorders.Count();
|
||||
PRInt32 count = mBCInfo->mRightBorders.Length();
|
||||
if (aFirstRowIndex < count) {
|
||||
for (PRInt32 rowX = aFirstRowIndex; rowX < aFirstRowIndex + numNewRows; rowX++) {
|
||||
bcData = new BCData(); if (!bcData) ABORT0();
|
||||
mBCInfo->mRightBorders.InsertElementAt(bcData, rowX);
|
||||
mBCInfo->mRightBorders.InsertElementAt(rowX, bcData);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -613,8 +610,8 @@ nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
|
||||
if (mBCInfo) {
|
||||
BCData* bcData;
|
||||
for (PRInt32 rowX = aFirstRowIndex + aNumRowsToRemove - 1; rowX >= aFirstRowIndex; rowX--) {
|
||||
if (rowX < mBCInfo->mRightBorders.Count()) {
|
||||
bcData = (BCData*)mBCInfo->mRightBorders.ElementAt(rowX);
|
||||
if (PRUint32(rowX) < mBCInfo->mRightBorders.Length()) {
|
||||
bcData = mBCInfo->mRightBorders.ElementAt(rowX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
@ -667,10 +664,10 @@ nsTableCellMap::AppendCell(nsTableCellFrame& aCellFrame,
|
||||
|
||||
|
||||
void
|
||||
nsTableCellMap::InsertCells(nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea)
|
||||
nsTableCellMap::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
PRInt32 rowIndex = aRowIndex;
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
@ -738,12 +735,12 @@ SetDamageArea(PRInt32 aXOrigin,
|
||||
}
|
||||
|
||||
void
|
||||
nsTableCellMap::RebuildConsideringCells(nsCellMap* aCellMap,
|
||||
nsVoidArray* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea)
|
||||
nsTableCellMap::RebuildConsideringCells(nsCellMap* aCellMap,
|
||||
nsTArray<nsTableCellFrame*>* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
PRInt32 numOrigCols = GetColCount();
|
||||
ClearCols();
|
||||
@ -764,11 +761,11 @@ nsTableCellMap::RebuildConsideringCells(nsCellMap* aCellMap,
|
||||
}
|
||||
|
||||
void
|
||||
nsTableCellMap::RebuildConsideringRows(nsCellMap* aCellMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsVoidArray* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea)
|
||||
nsTableCellMap::RebuildConsideringRows(nsCellMap* aCellMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsTArray<nsTableRowFrame*>* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
NS_PRECONDITION(!aRowsToInsert || aNumRowsToRemove == 0,
|
||||
"Can't handle both removing and inserting rows at once");
|
||||
@ -793,9 +790,9 @@ nsTableCellMap::RebuildConsideringRows(nsCellMap* aCellMap,
|
||||
PRInt32
|
||||
nsTableCellMap::GetNumCellsOriginatingInCol(PRInt32 aColIndex) const
|
||||
{
|
||||
PRInt32 colCount = mCols.Count();
|
||||
PRInt32 colCount = mCols.Length();
|
||||
if ((aColIndex >= 0) && (aColIndex < colCount)) {
|
||||
return ((nsColInfo *)mCols.ElementAt(aColIndex))->mNumCellsOrig;
|
||||
return (mCols.ElementAt(aColIndex))->mNumCellsOrig;
|
||||
}
|
||||
else {
|
||||
NS_ERROR("nsCellMap::GetNumCellsOriginatingInCol - bad col index");
|
||||
@ -811,13 +808,13 @@ nsTableCellMap::Dump(char* aString) const
|
||||
printf("%s \n", aString);
|
||||
printf("***** START TABLE CELL MAP DUMP ***** %p\n", (void*)this);
|
||||
// output col info
|
||||
PRInt32 colCount = mCols.Count();
|
||||
PRInt32 colCount = mCols.Length();
|
||||
printf ("cols array orig/span-> %p", (void*)this);
|
||||
for (PRInt32 colX = 0; colX < colCount; colX++) {
|
||||
nsColInfo* colInfo = (nsColInfo *)mCols.ElementAt(colX);
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
printf ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan);
|
||||
}
|
||||
printf(" cols in cache %d\n", mTableFrame.GetColCache().Count());
|
||||
printf(" cols in cache %d\n", mTableFrame.GetColCache().Length());
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
cellMap->Dump(nsnull != mBCInfo);
|
||||
@ -831,12 +828,12 @@ nsTableCellMap::Dump(char* aString) const
|
||||
PRBool segStart;
|
||||
PRPackedBool bevel;
|
||||
PRInt32 colIndex;
|
||||
PRInt32 numCols = mBCInfo->mBottomBorders.Count();
|
||||
PRInt32 numCols = mBCInfo->mBottomBorders.Length();
|
||||
for (PRInt32 i = 0; i <= 2; i++) {
|
||||
|
||||
printf("\n ");
|
||||
for (colIndex = 0; colIndex < numCols; colIndex++) {
|
||||
BCData* cd = (BCData*)mBCInfo->mBottomBorders.ElementAt(colIndex);;
|
||||
BCData* cd = mBCInfo->mBottomBorders.ElementAt(colIndex);
|
||||
if (cd) {
|
||||
if (0 == i) {
|
||||
size = cd->GetTopEdge(owner, segStart);
|
||||
@ -897,7 +894,7 @@ nsTableCellMap::GetIndexByRowAndColumn(PRInt32 aRow, PRInt32 aColumn) const
|
||||
{
|
||||
PRInt32 index = 0;
|
||||
|
||||
PRInt32 colCount = mCols.Count();
|
||||
PRInt32 colCount = mCols.Length();
|
||||
PRInt32 rowIndex = aRow;
|
||||
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
@ -938,7 +935,7 @@ nsTableCellMap::GetRowAndColumnByIndex(PRInt32 aIndex,
|
||||
*aRow = -1;
|
||||
*aColumn = -1;
|
||||
|
||||
PRInt32 colCount = mCols.Count();
|
||||
PRInt32 colCount = mCols.Length();
|
||||
|
||||
PRInt32 previousRows = 0;
|
||||
PRInt32 index = aIndex;
|
||||
@ -1003,9 +1000,9 @@ PRBool nsTableCellMap::ColIsSpannedInto(PRInt32 aColIndex) const
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
PRInt32 colCount = mCols.Count();
|
||||
PRInt32 colCount = mCols.Length();
|
||||
if ((aColIndex >= 0) && (aColIndex < colCount)) {
|
||||
result = ((nsColInfo *)mCols.ElementAt(aColIndex))->mNumCellsSpan != 0;
|
||||
result = (mCols.ElementAt(aColIndex))->mNumCellsSpan != 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -1332,7 +1329,7 @@ nsCellMap::GetIndexByRowAndColumn(PRInt32 aColCount,
|
||||
{
|
||||
PRInt32 index = -1;
|
||||
|
||||
if (aRow >= mRows.Length())
|
||||
if (PRUint32(aRow) >= mRows.Length())
|
||||
return index;
|
||||
|
||||
PRInt32 lastColsIdx = aColCount - 1;
|
||||
@ -1403,11 +1400,11 @@ void nsCellMap::GrowRow(CellDataArray& aRow,
|
||||
}
|
||||
|
||||
void
|
||||
nsCellMap::InsertRows(nsTableCellMap& aMap,
|
||||
nsVoidArray& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea)
|
||||
nsCellMap::InsertRows(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableRowFrame*>& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
PRInt32 numCols = aMap.GetColCount();
|
||||
NS_ASSERTION(aFirstRowIndex >= 0, "nsCellMap::InsertRows called with negative rowIndex");
|
||||
@ -1548,7 +1545,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
|
||||
// if the new cell could potentially span into other rows and collide with
|
||||
// originating cells there, we will play it safe and just rebuild the map
|
||||
if (aRebuildIfNecessary && (aRowIndex < mContentRowCount - 1) && (rowSpan > 1)) {
|
||||
nsAutoVoidArray newCellArray;
|
||||
nsAutoTArray<nsTableCellFrame*, 1> newCellArray;
|
||||
newCellArray.AppendElement(aCellFrame);
|
||||
aMap.RebuildConsideringCells(this, &newCellArray, aRowIndex, startColIndex, PR_TRUE, aDamageArea);
|
||||
return origData;
|
||||
@ -1702,9 +1699,9 @@ void nsCellMap::CollapseZeroColSpan(nsTableCellMap& aMap,
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCellMap::CellsSpanOut(nsVoidArray& aRows) const
|
||||
PRBool nsCellMap::CellsSpanOut(nsTArray<nsTableRowFrame*>& aRows) const
|
||||
{
|
||||
PRInt32 numNewRows = aRows.Count();
|
||||
PRInt32 numNewRows = aRows.Length();
|
||||
for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) {
|
||||
nsIFrame* rowFrame = (nsIFrame *) aRows.ElementAt(rowX);
|
||||
nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull);
|
||||
@ -1787,13 +1784,13 @@ PRBool nsCellMap::CellsSpanInOrOut(PRInt32 aStartRowIndex,
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void nsCellMap::InsertCells(nsTableCellMap& aMap,
|
||||
nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea)
|
||||
void nsCellMap::InsertCells(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
if (aCellFrames.Count() == 0) return;
|
||||
if (aCellFrames.Length() == 0) return;
|
||||
NS_ASSERTION(aColIndexBefore >= -1, "index out of range");
|
||||
PRInt32 numCols = aMap.GetColCount();
|
||||
if (aColIndexBefore >= numCols) {
|
||||
@ -1821,11 +1818,11 @@ void nsCellMap::InsertCells(nsTableCellMap& aMap,
|
||||
PRBool spansCauseRebuild = PR_FALSE;
|
||||
|
||||
// check that all cells have the same row span
|
||||
PRInt32 numNewCells = aCellFrames.Count();
|
||||
PRInt32 numNewCells = aCellFrames.Length();
|
||||
PRBool zeroRowSpan = PR_FALSE;
|
||||
PRInt32 rowSpan = 0;
|
||||
for (PRInt32 cellX = 0; cellX < numNewCells; cellX++) {
|
||||
nsTableCellFrame* cell = (nsTableCellFrame*) aCellFrames.ElementAt(cellX);
|
||||
nsTableCellFrame* cell = aCellFrames.ElementAt(cellX);
|
||||
PRInt32 rowSpan2 = GetRowSpanForNewCell(cell, aRowIndex, zeroRowSpan);
|
||||
if (rowSpan == 0) {
|
||||
rowSpan = rowSpan2;
|
||||
@ -1857,15 +1854,15 @@ void nsCellMap::InsertCells(nsTableCellMap& aMap,
|
||||
}
|
||||
|
||||
void
|
||||
nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
|
||||
nsVoidArray& aRowFrames,
|
||||
PRInt32 aStartRowIndexIn,
|
||||
nsRect& aDamageArea)
|
||||
nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableRowFrame*>& aRowFrames,
|
||||
PRInt32 aStartRowIndexIn,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
PRInt32 startRowIndex = (aStartRowIndexIn >= 0) ? aStartRowIndexIn : 0;
|
||||
NS_ASSERTION(PRUint32(startRowIndex) <= mRows.Length(), "caller should have grown cellmap before");
|
||||
|
||||
PRInt32 numNewRows = aRowFrames.Count();
|
||||
PRInt32 numNewRows = aRowFrames.Length();
|
||||
mContentRowCount += numNewRows;
|
||||
|
||||
PRInt32 endRowIndex = startRowIndex + numNewRows - 1;
|
||||
@ -1879,7 +1876,7 @@ nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
|
||||
|
||||
PRInt32 newRowIndex = 0;
|
||||
for (PRInt32 rowX = startRowIndex; rowX <= endRowIndex; rowX++) {
|
||||
nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowFrames.ElementAt(newRowIndex);
|
||||
nsTableRowFrame* rFrame = aRowFrames.ElementAt(newRowIndex);
|
||||
// append cells
|
||||
nsIFrame* cFrame = rFrame->GetFirstChild(nsnull);
|
||||
PRInt32 colIndex = 0;
|
||||
@ -1895,24 +1892,24 @@ nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
|
||||
SetDamageArea(0, startRowIndex, aMap.GetColCount(), 1 + endRowIndex - startRowIndex, aDamageArea);
|
||||
}
|
||||
|
||||
void nsCellMap::ExpandWithCells(nsTableCellMap& aMap,
|
||||
nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aRowSpan, // same for all cells
|
||||
PRBool aRowSpanIsZero,
|
||||
nsRect& aDamageArea)
|
||||
void nsCellMap::ExpandWithCells(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aRowSpan, // same for all cells
|
||||
PRBool aRowSpanIsZero,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
|
||||
PRInt32 endRowIndex = aRowIndex + aRowSpan - 1;
|
||||
PRInt32 startColIndex = aColIndex;
|
||||
PRInt32 endColIndex = aColIndex;
|
||||
PRInt32 numCells = aCellFrames.Count();
|
||||
PRInt32 numCells = aCellFrames.Length();
|
||||
PRInt32 totalColSpan = 0;
|
||||
|
||||
// add cellData entries for the space taken up by the new cells
|
||||
for (PRInt32 cellX = 0; cellX < numCells; cellX++) {
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*) aCellFrames.ElementAt(cellX);
|
||||
nsTableCellFrame* cellFrame = aCellFrames.ElementAt(cellX);
|
||||
CellData* origData = AllocCellData(cellFrame); // the originating cell
|
||||
if (!origData) return;
|
||||
|
||||
@ -1938,7 +1935,7 @@ void nsCellMap::ExpandWithCells(nsTableCellMap& aMap,
|
||||
// Pre-allocate all the cells we'll need in this array, setting
|
||||
// them to null.
|
||||
// Have to have the cast to get the template to do the right thing.
|
||||
PRUint32 insertionIndex = row.Length();
|
||||
PRInt32 insertionIndex = row.Length();
|
||||
if (insertionIndex > aColIndex) {
|
||||
insertionIndex = aColIndex;
|
||||
}
|
||||
@ -2281,11 +2278,11 @@ void nsCellMap::ShrinkWithoutCell(nsTableCellMap& aMap,
|
||||
}
|
||||
|
||||
void
|
||||
nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsVoidArray* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea)
|
||||
nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsTArray<nsTableRowFrame*>* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
|
||||
// copy the old cell map into a new array
|
||||
@ -2295,7 +2292,7 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
|
||||
PRInt32 rowNumberChange;
|
||||
if (aRowsToInsert) {
|
||||
rowNumberChange = aRowsToInsert->Count();
|
||||
rowNumberChange = aRowsToInsert->Length();
|
||||
} else {
|
||||
rowNumberChange = -aNumRowsToRemove;
|
||||
}
|
||||
@ -2340,9 +2337,9 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
rowX = aStartRowIndex;
|
||||
if (aRowsToInsert) {
|
||||
// add in the new cells and create rows if necessary
|
||||
PRInt32 numNewRows = aRowsToInsert->Count();
|
||||
PRInt32 numNewRows = aRowsToInsert->Length();
|
||||
for (PRInt32 newRowX = 0; newRowX < numNewRows; newRowX++) {
|
||||
nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowsToInsert->ElementAt(newRowX);
|
||||
nsTableRowFrame* rFrame = aRowsToInsert->ElementAt(newRowX);
|
||||
nsIFrame* cFrame = rFrame->GetFirstChild(nsnull);
|
||||
while (cFrame) {
|
||||
if (IS_TABLE_CELL(cFrame->GetType())) {
|
||||
@ -2387,21 +2384,22 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
SetDamageArea(0, 0, aMap.GetColCount(), GetRowCount(), aDamageArea);
|
||||
}
|
||||
|
||||
void nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
PRInt32 aNumOrigCols,
|
||||
nsVoidArray* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea)
|
||||
void
|
||||
nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
PRInt32 aNumOrigCols,
|
||||
nsTArray<nsTableCellFrame*>* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
|
||||
// copy the old cell map into a new array
|
||||
PRUint32 numOrigRows = mRows.Length();
|
||||
PRInt32 numOrigRows = mRows.Length();
|
||||
nsTArray<CellDataArray> origRows;
|
||||
mRows.SwapElements(origRows);
|
||||
|
||||
PRInt32 numNewCells = (aCellFrames) ? aCellFrames->Count() : 0;
|
||||
PRInt32 numNewCells = (aCellFrames) ? aCellFrames->Length() : 0;
|
||||
|
||||
// the new cells might extend the previous column number
|
||||
NS_ASSERTION(aNumOrigCols >= aColIndex, "Appending cells far beyond cellmap data?!");
|
||||
@ -2409,14 +2407,14 @@ void nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
|
||||
// build the new cell map. Hard to say what, if anything, we can preallocate
|
||||
// here... Should come back to that sometime, perhaps.
|
||||
PRUint32 rowX;
|
||||
PRInt32 rowX;
|
||||
for (rowX = 0; rowX < numOrigRows; rowX++) {
|
||||
const CellDataArray& row = origRows[rowX];
|
||||
for (PRInt32 colX = 0; colX < numCols; colX++) {
|
||||
if ((rowX == aRowIndex) && (colX == aColIndex)) {
|
||||
if (aInsert) { // put in the new cells
|
||||
for (PRInt32 cellX = 0; cellX < numNewCells; cellX++) {
|
||||
nsTableCellFrame* cell = (nsTableCellFrame*)aCellFrames->ElementAt(cellX);
|
||||
nsTableCellFrame* cell = aCellFrames->ElementAt(cellX);
|
||||
if (cell) {
|
||||
AppendCell(aMap, cell, rowX, PR_FALSE, aDamageArea);
|
||||
}
|
||||
@ -2436,7 +2434,7 @@ void nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
if (aInsert && numOrigRows <= aRowIndex) { // append the new cells below the last original row
|
||||
NS_ASSERTION (numOrigRows == aRowIndex, "Appending cells far beyond the last row");
|
||||
for (PRInt32 cellX = 0; cellX < numNewCells; cellX++) {
|
||||
nsTableCellFrame* cell = (nsTableCellFrame*)aCellFrames->ElementAt(cellX);
|
||||
nsTableCellFrame* cell = aCellFrames->ElementAt(cellX);
|
||||
if (cell) {
|
||||
AppendCell(aMap, cell, aRowIndex, PR_FALSE, aDamageArea);
|
||||
}
|
||||
@ -2452,7 +2450,7 @@ void nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
}
|
||||
}
|
||||
// expand the cellmap to cover empty content rows
|
||||
if (mRows.Length() < mContentRowCount) {
|
||||
if (mRows.Length() < PRUint32(mContentRowCount)) {
|
||||
Grow(aMap, mContentRowCount - mRows.Length());
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include "nscore.h"
|
||||
#include "celldata.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTPtrArray.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -48,6 +48,7 @@
|
||||
|
||||
class nsTableColFrame;
|
||||
class nsTableCellFrame;
|
||||
class nsTableRowFrame;
|
||||
class nsTableRowGroupFrame;
|
||||
class nsTableFrame;
|
||||
class nsCellMap;
|
||||
@ -74,9 +75,9 @@ enum Corner
|
||||
|
||||
struct BCInfo
|
||||
{
|
||||
nsVoidArray mRightBorders;
|
||||
nsVoidArray mBottomBorders;
|
||||
BCData mLowerRightCorner;
|
||||
nsTArray<BCData*> mRightBorders;
|
||||
nsTArray<BCData*> mBottomBorders;
|
||||
BCData mLowerRightCorner;
|
||||
};
|
||||
|
||||
class nsTableCellMap
|
||||
@ -128,21 +129,21 @@ public:
|
||||
PRBool aRebuildIfNecessary,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void InsertCells(nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea);
|
||||
void InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void RemoveCell(nsTableCellFrame* aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
nsRect& aDamageArea);
|
||||
/** Remove the previously gathered column information */
|
||||
void ClearCols();
|
||||
void InsertRows(nsTableRowGroupFrame& aRowGroup,
|
||||
nsVoidArray& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea);
|
||||
void InsertRows(nsTableRowGroupFrame& aRowGroup,
|
||||
nsTArray<nsTableRowFrame*>& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void RemoveRows(PRInt32 aFirstRowIndex,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
@ -201,12 +202,12 @@ public:
|
||||
|
||||
PRBool RowIsSpannedInto(PRInt32 aRowIndex, PRInt32 aNumEffCols) const;
|
||||
PRBool RowHasSpanningCells(PRInt32 aRowIndex, PRInt32 aNumEffCols) const;
|
||||
void RebuildConsideringCells(nsCellMap* aCellMap,
|
||||
nsVoidArray* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea);
|
||||
void RebuildConsideringCells(nsCellMap* aCellMap,
|
||||
nsTArray<nsTableCellFrame*>* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -217,11 +218,11 @@ protected:
|
||||
*
|
||||
* // XXXbz are both allowed to happen? That'd be a no-op...
|
||||
*/
|
||||
void RebuildConsideringRows(nsCellMap* aCellMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsVoidArray* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea);
|
||||
void RebuildConsideringRows(nsCellMap* aCellMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsTArray<nsTableRowFrame*>* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
public:
|
||||
PRBool ColIsSpannedInto(PRInt32 aColIndex) const;
|
||||
@ -277,11 +278,11 @@ protected:
|
||||
nsCellMap& aNewMap);
|
||||
void DeleteRightBottomBorders();
|
||||
|
||||
nsTableFrame& mTableFrame;
|
||||
nsAutoVoidArray mCols;
|
||||
nsCellMap* mFirstMap;
|
||||
nsTableFrame& mTableFrame;
|
||||
nsAutoTArray<nsColInfo*, 8> mCols;
|
||||
nsCellMap* mFirstMap;
|
||||
// border collapsing info
|
||||
BCInfo* mBCInfo;
|
||||
BCInfo* mBCInfo;
|
||||
};
|
||||
|
||||
/** nsCellMap is a support class for nsTablePart.
|
||||
@ -390,22 +391,22 @@ public:
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex);
|
||||
|
||||
void InsertCells(nsTableCellMap& aMap,
|
||||
nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea);
|
||||
void InsertCells(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void RemoveCell(nsTableCellMap& aMap,
|
||||
nsTableCellFrame* aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void InsertRows(nsTableCellMap& aMap,
|
||||
nsVoidArray& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea);
|
||||
void InsertRows(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableRowFrame*>& aRows,
|
||||
PRInt32 aFirstRowIndex,
|
||||
PRBool aConsiderSpans,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void RemoveRows(nsTableCellMap& aMap,
|
||||
PRInt32 aFirstRowIndex,
|
||||
@ -491,18 +492,18 @@ protected:
|
||||
|
||||
PRInt32 GetNumCellsIn(PRInt32 aColIndex) const;
|
||||
|
||||
void ExpandWithRows(nsTableCellMap& aMap,
|
||||
nsVoidArray& aRowFrames,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsRect& aDamageArea);
|
||||
void ExpandWithRows(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableRowFrame*>& aRowFrames,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void ExpandWithCells(nsTableCellMap& aMap,
|
||||
nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aRowSpan,
|
||||
PRBool aRowSpanIsZero,
|
||||
nsRect& aDamageArea);
|
||||
void ExpandWithCells(nsTableCellMap& aMap,
|
||||
nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aRowSpan,
|
||||
PRBool aRowSpanIsZero,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void ShrinkWithoutRows(nsTableCellMap& aMap,
|
||||
PRInt32 aFirstRowIndex,
|
||||
@ -523,21 +524,21 @@ protected:
|
||||
*
|
||||
* // XXXbz are both allowed to happen? That'd be a no-op...
|
||||
*/
|
||||
void RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsVoidArray* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea);
|
||||
void RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
PRInt32 aStartRowIndex,
|
||||
nsTArray<nsTableRowFrame*>* aRowsToInsert,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
void RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
PRInt32 aNumOrigCols,
|
||||
nsVoidArray* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea);
|
||||
void RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
PRInt32 aNumOrigCols,
|
||||
nsTArray<nsTableCellFrame*>* aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRBool aInsert,
|
||||
nsRect& aDamageArea);
|
||||
|
||||
PRBool CellsSpanOut(nsVoidArray& aNewRows) const;
|
||||
PRBool CellsSpanOut(nsTArray<nsTableRowFrame*>& aNewRows) const;
|
||||
|
||||
/** If a cell spans out of the area defined by aStartRowIndex, aEndRowIndex
|
||||
* and aStartColIndex, aEndColIndex the cellmap changes are more severe so
|
||||
@ -675,7 +676,7 @@ private:
|
||||
/* ----- inline methods ----- */
|
||||
inline PRInt32 nsTableCellMap::GetColCount() const
|
||||
{
|
||||
return mCols.Count();
|
||||
return mCols.Length();
|
||||
}
|
||||
|
||||
inline nsCellMap* nsCellMap::GetNextSibling() const
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nsIPercentHeightObserver.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsTableFrame;
|
||||
|
||||
@ -251,13 +252,6 @@ protected:
|
||||
*/
|
||||
virtual void GetSelfOverflow(nsRect& aOverflowArea);
|
||||
|
||||
private:
|
||||
|
||||
// All these methods are support methods for RecalcLayoutData
|
||||
nsIFrame* GetFrameAt(nsVoidArray* aList, PRInt32 aIndex);
|
||||
|
||||
protected:
|
||||
|
||||
friend class nsTableRowFrame;
|
||||
|
||||
PRUint32 mColIndex; // the starting column for this cell
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include "nscore.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsTablePainter.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsVoidArray;
|
||||
class nsTableCellFrame;
|
||||
|
||||
enum nsTableColType {
|
||||
@ -112,9 +112,6 @@ public:
|
||||
/** return the number of the columns the col represents. always >= 1 */
|
||||
PRInt32 GetSpan();
|
||||
|
||||
/** convenience method, calls into cellmap */
|
||||
nsVoidArray * GetCells();
|
||||
|
||||
/** convenience method, calls into cellmap */
|
||||
PRInt32 Count() const;
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsStyleContext.h"
|
||||
@ -398,7 +397,7 @@ void nsTableFrame::AttributeChangedFor(nsIFrame* aFrame,
|
||||
cellFrame->GetRowIndex(rowIndex);
|
||||
cellFrame->GetColIndex(colIndex);
|
||||
RemoveCell(cellFrame, rowIndex);
|
||||
nsAutoVoidArray cells;
|
||||
nsAutoTArray<nsTableCellFrame*, 1> cells;
|
||||
cells.AppendElement(cellFrame);
|
||||
InsertCells(cells, rowIndex, colIndex - 1);
|
||||
|
||||
@ -436,7 +435,7 @@ PRInt32 nsTableFrame::GetEffectiveColCount() const
|
||||
|
||||
PRInt32 nsTableFrame::GetIndexOfLastRealCol()
|
||||
{
|
||||
PRInt32 numCols = mColFrames.Count();
|
||||
PRInt32 numCols = mColFrames.Length();
|
||||
if (numCols > 0) {
|
||||
for (PRInt32 colX = numCols - 1; colX >= 0; colX--) {
|
||||
nsTableColFrame* colFrame = GetColFrame(colX);
|
||||
@ -454,9 +453,9 @@ nsTableColFrame*
|
||||
nsTableFrame::GetColFrame(PRInt32 aColIndex) const
|
||||
{
|
||||
NS_ASSERTION(!GetPrevInFlow(), "GetColFrame called on next in flow");
|
||||
PRInt32 numCols = mColFrames.Count();
|
||||
PRInt32 numCols = mColFrames.Length();
|
||||
if ((aColIndex >= 0) && (aColIndex < numCols)) {
|
||||
return (nsTableColFrame *)mColFrames.ElementAt(aColIndex);
|
||||
return mColFrames.ElementAt(aColIndex);
|
||||
}
|
||||
else {
|
||||
NS_ERROR("invalid col index");
|
||||
@ -616,16 +615,16 @@ void nsTableFrame::InsertColGroups(PRInt32 aStartColIndex,
|
||||
void nsTableFrame::InsertCol(nsTableColFrame& aColFrame,
|
||||
PRInt32 aColIndex)
|
||||
{
|
||||
mColFrames.InsertElementAt(&aColFrame, aColIndex);
|
||||
mColFrames.InsertElementAt(aColIndex, &aColFrame);
|
||||
nsTableColType insertedColType = aColFrame.GetColType();
|
||||
PRInt32 numCacheCols = mColFrames.Count();
|
||||
PRInt32 numCacheCols = mColFrames.Length();
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) {
|
||||
PRInt32 numMapCols = cellMap->GetColCount();
|
||||
if (numCacheCols > numMapCols) {
|
||||
PRBool removedFromCache = PR_FALSE;
|
||||
if (eColAnonymousCell != insertedColType) {
|
||||
nsTableColFrame* lastCol = (nsTableColFrame *)mColFrames.ElementAt(numCacheCols - 1);
|
||||
nsTableColFrame* lastCol = mColFrames.ElementAt(numCacheCols - 1);
|
||||
if (lastCol) {
|
||||
nsTableColType lastColType = lastCol->GetColType();
|
||||
if (eColAnonymousCell == lastColType) {
|
||||
@ -785,7 +784,7 @@ nsTableFrame::CreateAnonymousColFrames(nsTableColGroupFrame* aColGroupFrame,
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
PRInt32 startIndex = mColFrames.Count();
|
||||
PRInt32 startIndex = mColFrames.Length();
|
||||
PRInt32 lastIndex = startIndex + aNumColsToAdd - 1;
|
||||
|
||||
for (PRInt32 childX = startIndex; childX <= lastIndex; childX++) {
|
||||
@ -843,7 +842,7 @@ void
|
||||
nsTableFrame::MatchCellMapToColCache(nsTableCellMap* aCellMap)
|
||||
{
|
||||
PRInt32 numColsInMap = GetColCount();
|
||||
PRInt32 numColsInCache = mColFrames.Count();
|
||||
PRInt32 numColsInCache = mColFrames.Length();
|
||||
PRInt32 numColsToAdd = numColsInMap - numColsInCache;
|
||||
if (numColsToAdd > 0) {
|
||||
// this sets the child list, updates the col cache and cell map
|
||||
@ -901,9 +900,9 @@ nsTableFrame::AppendCell(nsTableCellFrame& aCellFrame,
|
||||
}
|
||||
}
|
||||
|
||||
void nsTableFrame::InsertCells(nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore)
|
||||
void nsTableFrame::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore)
|
||||
{
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) {
|
||||
@ -921,7 +920,7 @@ PRInt32
|
||||
nsTableFrame::DestroyAnonymousColFrames(PRInt32 aNumFrames)
|
||||
{
|
||||
// only remove cols that are of type eTypeAnonymous cell (they are at the end)
|
||||
PRInt32 endIndex = mColFrames.Count() - 1;
|
||||
PRInt32 endIndex = mColFrames.Length() - 1;
|
||||
PRInt32 startIndex = (endIndex - aNumFrames) + 1;
|
||||
PRInt32 numColsRemoved = 0;
|
||||
for (PRInt32 colX = endIndex; colX >= startIndex; colX--) {
|
||||
@ -975,9 +974,9 @@ nsTableFrame::GetStartRowIndex(nsTableRowGroupFrame& aRowGroupFrame)
|
||||
}
|
||||
|
||||
// this cannot extend beyond a single row group
|
||||
void nsTableFrame::AppendRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
PRInt32 aRowIndex,
|
||||
nsVoidArray& aRowFrames)
|
||||
void nsTableFrame::AppendRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
PRInt32 aRowIndex,
|
||||
nsTArray<nsTableRowFrame*>& aRowFrames)
|
||||
{
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) {
|
||||
@ -992,17 +991,17 @@ nsTableFrame::InsertRow(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aConsiderSpans)
|
||||
{
|
||||
nsAutoVoidArray rows;
|
||||
rows.AppendElement(&aRowFrame);
|
||||
nsAutoTArray<nsTableRowFrame*, 1> rows;
|
||||
rows.AppendElement((nsTableRowFrame*)&aRowFrame);
|
||||
return InsertRows(aRowGroupFrame, rows, aRowIndex, aConsiderSpans);
|
||||
}
|
||||
|
||||
// this cannot extend beyond a single row group
|
||||
PRInt32
|
||||
nsTableFrame::InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
nsVoidArray& aRowFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aConsiderSpans)
|
||||
nsTableFrame::InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
nsTArray<nsTableRowFrame*>& aRowFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aConsiderSpans)
|
||||
{
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("=== insertRowsBefore firstRow=%d \n", aRowIndex);
|
||||
@ -1014,7 +1013,7 @@ nsTableFrame::InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
if (cellMap) {
|
||||
nsRect damageArea(0,0,0,0);
|
||||
PRInt32 origNumRows = cellMap->GetRowCount();
|
||||
PRInt32 numNewRows = aRowFrames.Count();
|
||||
PRInt32 numNewRows = aRowFrames.Length();
|
||||
cellMap->InsertRows(aRowGroupFrame, aRowFrames, aRowIndex, aConsiderSpans, damageArea);
|
||||
MatchCellMapToColCache(cellMap);
|
||||
if (aRowIndex < origNumRows) {
|
||||
@ -1023,7 +1022,7 @@ nsTableFrame::InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
// assign the correct row indices to the new rows. If they were adjusted above
|
||||
// it may not have been done correctly because each row is constructed with index 0
|
||||
for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) {
|
||||
nsTableRowFrame* rowFrame = (nsTableRowFrame *) aRowFrames.ElementAt(rowX);
|
||||
nsTableRowFrame* rowFrame = aRowFrames.ElementAt(rowX);
|
||||
rowFrame->SetRowIndex(aRowIndex + rowX);
|
||||
}
|
||||
if (IsBorderCollapse()) {
|
||||
@ -1119,8 +1118,8 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame,
|
||||
|
||||
// collect the rows ancestors of aFrame
|
||||
PRInt32
|
||||
nsTableFrame::CollectRows(nsIFrame* aFrame,
|
||||
nsVoidArray& aCollection)
|
||||
nsTableFrame::CollectRows(nsIFrame* aFrame,
|
||||
nsTArray<nsTableRowFrame*>& aCollection)
|
||||
{
|
||||
if (!aFrame) return 0;
|
||||
PRInt32 numRows = 0;
|
||||
@ -1129,7 +1128,7 @@ nsTableFrame::CollectRows(nsIFrame* aFrame,
|
||||
nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull);
|
||||
while (childFrame) {
|
||||
if (nsGkAtoms::tableRowFrame == childFrame->GetType()) {
|
||||
aCollection.AppendElement(childFrame);
|
||||
aCollection.AppendElement(static_cast<nsTableRowFrame*>(childFrame));
|
||||
numRows++;
|
||||
}
|
||||
else {
|
||||
@ -1154,7 +1153,7 @@ nsTableFrame::InsertRowGroups(nsIFrame* aFirstRowGroupFrame,
|
||||
RowGroupArray orderedRowGroups;
|
||||
OrderRowGroups(orderedRowGroups);
|
||||
|
||||
nsAutoVoidArray rows;
|
||||
nsAutoTArray<nsTableRowFrame*, 8> rows;
|
||||
// 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,
|
||||
PRUint32 rgIndex;
|
||||
@ -2457,13 +2456,13 @@ nsTableFrame::RemoveFrame(nsIAtom* aListName,
|
||||
// remove the cols from the table
|
||||
PRInt32 colX;
|
||||
for (colX = lastColIndex; colX >= firstColIndex; colX--) {
|
||||
nsTableColFrame* colFrame = (nsTableColFrame*)mColFrames.SafeElementAt(colX);
|
||||
nsTableColFrame* colFrame = mColFrames.SafeElementAt(colX);
|
||||
if (colFrame) {
|
||||
RemoveCol(colGroup, colX, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 numAnonymousColsToAdd = GetColCount() - mColFrames.Count();
|
||||
PRInt32 numAnonymousColsToAdd = GetColCount() - mColFrames.Length();
|
||||
if (numAnonymousColsToAdd > 0) {
|
||||
// this sets the child list, updates the col cache and cell map
|
||||
CreateAnonymousColFrames(numAnonymousColsToAdd,
|
||||
@ -3818,7 +3817,7 @@ nsTableFrame::Dump(PRBool aDumpRows,
|
||||
// output col frame cache
|
||||
printf("\n col frame cache ->");
|
||||
for (colX = 0; colX < numCols; colX++) {
|
||||
nsTableColFrame* colFrame = (nsTableColFrame *)mColFrames.ElementAt(colX);
|
||||
nsTableColFrame* colFrame = mColFrames.ElementAt(colX);
|
||||
if (0 == (colX % 8)) {
|
||||
printf("\n");
|
||||
}
|
||||
@ -6048,7 +6047,7 @@ BCMapBorderIterator::SetNewRowGroup()
|
||||
isRepeatedHeader = PR_FALSE;
|
||||
isRepeatedFooter = PR_FALSE;
|
||||
|
||||
if (rowGroupIndex < rowGroups.Length()) {
|
||||
if (PRUint32(rowGroupIndex) < rowGroups.Length()) {
|
||||
prevRg = rg;
|
||||
rg = rowGroups[rowGroupIndex];
|
||||
fifRowGroupStart = ((nsTableRowGroupFrame*)rg->GetFirstInFlow())->GetStartRowIndex();
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define nsTableFrame_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTPtrArray.h"
|
||||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsStyleCoord.h"
|
||||
#include "nsStyleConsts.h"
|
||||
@ -484,26 +484,26 @@ public:
|
||||
virtual void AppendCell(nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex);
|
||||
|
||||
virtual void InsertCells(nsVoidArray& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore);
|
||||
virtual void InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRInt32 aColIndexBefore);
|
||||
|
||||
virtual void RemoveCell(nsTableCellFrame* aCellFrame,
|
||||
PRInt32 aRowIndex);
|
||||
|
||||
void AppendRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
PRInt32 aRowIndex,
|
||||
nsVoidArray& aRowFrames);
|
||||
void AppendRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
PRInt32 aRowIndex,
|
||||
nsTArray<nsTableRowFrame*>& aRowFrames);
|
||||
|
||||
PRInt32 InsertRow(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
nsIFrame& aFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aConsiderSpans);
|
||||
|
||||
PRInt32 InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
nsVoidArray& aFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aConsiderSpans);
|
||||
PRInt32 InsertRows(nsTableRowGroupFrame& aRowGroupFrame,
|
||||
nsTArray<nsTableRowFrame*>& aFrames,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aConsiderSpans);
|
||||
|
||||
virtual void RemoveRows(nsTableRowFrame& aFirstRowFrame,
|
||||
PRInt32 aNumRowsToRemove,
|
||||
@ -767,7 +767,7 @@ public:
|
||||
void ResetRowIndices(nsIFrame* aFirstRowGroupFrame = nsnull,
|
||||
nsIFrame* aLastRowGroupFrame = nsnull);
|
||||
|
||||
nsVoidArray& GetColCache();
|
||||
nsTArray<nsTableColFrame*>& GetColCache();
|
||||
|
||||
/** Return aFrame's child if aFrame is an nsScrollFrame, otherwise return aFrame
|
||||
*/
|
||||
@ -785,8 +785,8 @@ protected:
|
||||
void SetColumnDimensions(nscoord aHeight,
|
||||
const nsMargin& aReflowState);
|
||||
|
||||
PRInt32 CollectRows(nsIFrame* aFrame,
|
||||
nsVoidArray& aCollection);
|
||||
PRInt32 CollectRows(nsIFrame* aFrame,
|
||||
nsTArray<nsTableRowFrame*>& aCollection);
|
||||
|
||||
public: /* ----- Cell Map public methods ----- */
|
||||
|
||||
@ -847,7 +847,7 @@ protected:
|
||||
void DumpRowGroup(nsIFrame* aChildFrame);
|
||||
#endif
|
||||
// DATA MEMBERS
|
||||
nsAutoVoidArray mColFrames;
|
||||
nsAutoTPtrArray<nsTableColFrame, 8> mColFrames;
|
||||
|
||||
struct TableBits {
|
||||
PRUint32 mHaveReflowedColGroups:1; // have the col groups gotten their initial reflow
|
||||
@ -953,7 +953,7 @@ inline nsFrameList& nsTableFrame::GetColGroups()
|
||||
return static_cast<nsTableFrame*>(GetFirstInFlow())->mColGroups;
|
||||
}
|
||||
|
||||
inline nsVoidArray& nsTableFrame::GetColCache()
|
||||
inline nsTArray<nsTableColFrame*>& nsTableFrame::GetColCache()
|
||||
{
|
||||
return mColFrames;
|
||||
}
|
||||
|
@ -612,8 +612,8 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
|
||||
|
||||
PRInt32 colIndex;
|
||||
aCell->GetColIndex(colIndex);
|
||||
NS_ASSERTION(colIndex < mNumCols, "prevent array boundary violation");
|
||||
if (mNumCols <= colIndex)
|
||||
NS_ASSERTION(colIndex < PRInt32(mNumCols), "prevent array boundary violation");
|
||||
if (PRInt32(mNumCols) <= colIndex)
|
||||
return NS_OK;
|
||||
|
||||
//Paint column group background
|
||||
|
@ -235,11 +235,11 @@ nsTableRowFrame::InsertFrames(nsIAtom* aListName,
|
||||
// gather the new frames (only those which are cells) into an array
|
||||
nsIAtom* cellFrameType = (tableFrame->IsBorderCollapse()) ? nsGkAtoms::bcTableCellFrame : nsGkAtoms::tableCellFrame;
|
||||
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, cellFrameType);
|
||||
nsVoidArray cellChildren;
|
||||
nsTArray<nsTableCellFrame*> cellChildren;
|
||||
for (nsIFrame* childFrame = aFrameList; childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
if (IS_TABLE_CELL(childFrame->GetType())) {
|
||||
cellChildren.AppendElement(childFrame);
|
||||
cellChildren.AppendElement(static_cast<nsTableCellFrame*>(childFrame));
|
||||
}
|
||||
}
|
||||
// insert the cells into the cell map
|
||||
|
@ -1392,14 +1392,14 @@ nsTableRowGroupFrame::AppendFrames(nsIAtom* aListName,
|
||||
ClearRowCursor();
|
||||
|
||||
// collect the new row frames in an array
|
||||
nsAutoVoidArray rows;
|
||||
nsAutoTArray<nsTableRowFrame*, 8> rows;
|
||||
for (nsIFrame* rowFrame = aFrameList; rowFrame;
|
||||
rowFrame = rowFrame->GetNextSibling()) {
|
||||
if (nsGkAtoms::tableRowFrame == rowFrame->GetType()) {
|
||||
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW ==
|
||||
rowFrame->GetStyleDisplay()->mDisplay,
|
||||
"wrong display type on rowframe");
|
||||
rows.AppendElement(rowFrame);
|
||||
rows.AppendElement(static_cast<nsTableRowFrame*>(rowFrame));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1407,7 +1407,7 @@ nsTableRowGroupFrame::AppendFrames(nsIAtom* aListName,
|
||||
// Append the frames to the sibling chain
|
||||
mFrames.AppendFrames(nsnull, aFrameList);
|
||||
|
||||
if (rows.Count() > 0) {
|
||||
if (rows.Length() > 0) {
|
||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||
if (tableFrame) {
|
||||
tableFrame->AppendRows(*this, rowIndex, rows);
|
||||
@ -1437,7 +1437,7 @@ nsTableRowGroupFrame::InsertFrames(nsIAtom* aListName,
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// collect the new row frames in an array
|
||||
nsVoidArray rows;
|
||||
nsTArray<nsTableRowFrame*> rows;
|
||||
PRBool gotFirstRow = PR_FALSE;
|
||||
for (nsIFrame* rowFrame = aFrameList; rowFrame;
|
||||
rowFrame = rowFrame->GetNextSibling()) {
|
||||
@ -1445,7 +1445,7 @@ nsTableRowGroupFrame::InsertFrames(nsIAtom* aListName,
|
||||
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW ==
|
||||
rowFrame->GetStyleDisplay()->mDisplay,
|
||||
"wrong display type on rowframe");
|
||||
rows.AppendElement(rowFrame);
|
||||
rows.AppendElement(static_cast<nsTableRowFrame*>(rowFrame));
|
||||
if (!gotFirstRow) {
|
||||
((nsTableRowFrame*)rowFrame)->SetFirstInserted(PR_TRUE);
|
||||
gotFirstRow = PR_TRUE;
|
||||
@ -1458,7 +1458,7 @@ nsTableRowGroupFrame::InsertFrames(nsIAtom* aListName,
|
||||
// Insert the frames in the sibling chain
|
||||
mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
|
||||
|
||||
PRInt32 numRows = rows.Count();
|
||||
PRInt32 numRows = rows.Length();
|
||||
if (numRows > 0) {
|
||||
nsTableRowFrame* prevRow = (nsTableRowFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsGkAtoms::tableRowFrame);
|
||||
PRInt32 rowIndex = (prevRow) ? prevRow->GetRowIndex() + 1 : startRowIndex;
|
||||
|
Loading…
Reference in New Issue
Block a user