Bug 720142 - Use nsIntRect for table damage. r=bernd

This commit is contained in:
Mats Palmgren 2012-01-22 23:48:34 +01:00
parent 1b0a6be9dc
commit 1aca4ac3f0
9 changed files with 109 additions and 108 deletions

View File

@ -47,7 +47,7 @@ SetDamageArea(PRInt32 aXOrigin,
PRInt32 aYOrigin,
PRInt32 aWidth,
PRInt32 aHeight,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
NS_ASSERTION(aXOrigin >= 0, "negative col index");
NS_ASSERTION(aYOrigin >= 0, "negative row index");
@ -491,7 +491,7 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame* aParent,
nsTArray<nsTableRowFrame*>& aRows,
PRInt32 aFirstRowIndex,
bool aConsiderSpans,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRInt32 numNewRows = aRows.Length();
if ((numNewRows <= 0) || (aFirstRowIndex < 0)) ABORT0();
@ -538,7 +538,7 @@ void
nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
bool aConsiderSpans,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRInt32 rowIndex = aFirstRowIndex;
PRInt32 rgStartRowIndex = 0;
@ -572,7 +572,7 @@ CellData*
nsTableCellMap::AppendCell(nsTableCellFrame& aCellFrame,
PRInt32 aRowIndex,
bool aRebuildIfNecessary,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
NS_ASSERTION(&aCellFrame == aCellFrame.GetFirstInFlow(), "invalid call on continuing frame");
nsIFrame* rgFrame = aCellFrame.GetParent(); // get the row
@ -607,7 +607,7 @@ void
nsTableCellMap::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
PRInt32 aRowIndex,
PRInt32 aColIndexBefore,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRInt32 rowIndex = aRowIndex;
PRInt32 rgStartRowIndex = 0;
@ -632,7 +632,7 @@ nsTableCellMap::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
void
nsTableCellMap::RemoveCell(nsTableCellFrame* aCellFrame,
PRInt32 aRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
if (!aCellFrame) ABORT0();
NS_ASSERTION(aCellFrame == (nsTableCellFrame *)aCellFrame->GetFirstInFlow(),
@ -667,7 +667,7 @@ nsTableCellMap::RebuildConsideringCells(nsCellMap* aCellMap,
PRInt32 aRowIndex,
PRInt32 aColIndex,
bool aInsert,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRInt32 numOrigCols = GetColCount();
ClearCols();
@ -693,7 +693,7 @@ nsTableCellMap::RebuildConsideringRows(nsCellMap* aCellMap,
PRInt32 aStartRowIndex,
nsTArray<nsTableRowFrame*>* aRowsToInsert,
PRInt32 aNumRowsToRemove,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
NS_PRECONDITION(!aRowsToInsert || aNumRowsToRemove == 0,
"Can't handle both removing and inserting rows at once");
@ -766,29 +766,29 @@ nsTableCellMap::Dump(char* aString) const
BCData& cd = mBCInfo->mBottomBorders.ElementAt(colIndex);
if (0 == i) {
size = cd.GetTopEdge(owner, segStart);
printf("t=%d%X%d ", size, owner, segStart);
printf("t=%d%X%d ", PRInt32(size), owner, segStart);
}
else if (1 == i) {
size = cd.GetLeftEdge(owner, segStart);
printf("l=%d%X%d ", size, owner, segStart);
printf("l=%d%X%d ", PRInt32(size), owner, segStart);
}
else {
size = cd.GetCorner(side, bevel);
printf("c=%d%X%d ", size, side, bevel);
printf("c=%d%X%d ", PRInt32(size), side, bevel);
}
}
BCData& cd = mBCInfo->mLowerRightCorner;
if (0 == i) {
size = cd.GetTopEdge(owner, segStart);
printf("t=%d%X%d ", size, owner, segStart);
printf("t=%d%X%d ", PRInt32(size), owner, segStart);
}
else if (1 == i) {
size = cd.GetLeftEdge(owner, segStart);
printf("l=%d%X%d ", size, owner, segStart);
printf("l=%d%X%d ", PRInt32(size), owner, segStart);
}
else {
size = cd.GetCorner(side, bevel);
printf("c=%d%X%d ", size, side, bevel);
printf("c=%d%X%d ", PRInt32(size), side, bevel);
}
}
printf("\n");
@ -1028,7 +1028,7 @@ nsTableCellMap::SetBCBorderEdge(mozilla::css::Side aSide,
if (!cellData) {
PRInt32 numRgRows = aCellMap.GetRowCount();
if (yPos < numRgRows) { // add a dead cell data
nsRect damageArea;
nsIntRect damageArea;
cellData = (BCCellData*)aCellMap.AppendCell(*this, nsnull, rgYPos,
false, 0, damageArea);
if (!cellData) ABORT0();
@ -1043,7 +1043,7 @@ nsTableCellMap::SetBCBorderEdge(mozilla::css::Side aSide,
if (cellMap) {
cellData = (BCCellData*)cellMap->GetDataAt(0, xIndex);
if (!cellData) { // add a dead cell
nsRect damageArea;
nsIntRect damageArea;
cellData = (BCCellData*)cellMap->AppendCell(*this, nsnull, 0,
false, 0,
damageArea);
@ -1138,7 +1138,7 @@ nsTableCellMap::SetBCBorderCorner(Corner aCorner,
if (!cellData) {
PRInt32 numRgRows = aCellMap.GetRowCount();
if (yPos < numRgRows) { // add a dead cell data
nsRect damageArea;
nsIntRect damageArea;
cellData = (BCCellData*)aCellMap.AppendCell(*this, nsnull, rgYPos,
false, 0, damageArea);
}
@ -1151,7 +1151,7 @@ nsTableCellMap::SetBCBorderCorner(Corner aCorner,
if (cellMap) {
cellData = (BCCellData*)cellMap->GetDataAt(0, xPos);
if (!cellData) { // add a dead cell
nsRect damageArea;
nsIntRect damageArea;
cellData = (BCCellData*)cellMap->AppendCell(*this, nsnull, 0,
false, 0, damageArea);
}
@ -1358,7 +1358,7 @@ nsCellMap::InsertRows(nsTableCellMap& aMap,
PRInt32 aFirstRowIndex,
bool aConsiderSpans,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRInt32 numCols = aMap.GetColCount();
NS_ASSERTION(aFirstRowIndex >= 0, "nsCellMap::InsertRows called with negative rowIndex");
@ -1403,7 +1403,7 @@ nsCellMap::RemoveRows(nsTableCellMap& aMap,
PRInt32 aNumRowsToRemove,
bool aConsiderSpans,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRInt32 numRows = mRows.Length();
PRInt32 numCols = aMap.GetColCount();
@ -1446,7 +1446,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
PRInt32 aRowIndex,
bool aRebuildIfNecessary,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea,
nsIntRect& aDamageArea,
PRInt32* aColToBeginSearch)
{
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
@ -1756,7 +1756,7 @@ void nsCellMap::InsertCells(nsTableCellMap& aMap,
PRInt32 aRowIndex,
PRInt32 aColIndexBefore,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
if (aCellFrames.Length() == 0) return;
NS_ASSERTION(aColIndexBefore >= -1, "index out of range");
@ -1827,7 +1827,7 @@ nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
nsTArray<nsTableRowFrame*>& aRowFrames,
PRInt32 aStartRowIndexIn,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRInt32 startRowIndex = (aStartRowIndexIn >= 0) ? aStartRowIndexIn : 0;
NS_ASSERTION(PRUint32(startRowIndex) <= mRows.Length(), "caller should have grown cellmap before");
@ -1874,7 +1874,7 @@ void nsCellMap::ExpandWithCells(nsTableCellMap& aMap,
PRInt32 aRowSpan, // same for all cells
bool aRowSpanIsZero,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
PRInt32 endRowIndex = aRowIndex + aRowSpan - 1;
@ -1994,7 +1994,7 @@ void nsCellMap::ShrinkWithoutRows(nsTableCellMap& aMap,
PRInt32 aStartRowIndex,
PRInt32 aNumRowsToRemove,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
PRInt32 endRowIndex = aStartRowIndex + aNumRowsToRemove - 1;
@ -2174,7 +2174,7 @@ void nsCellMap::ShrinkWithoutCell(nsTableCellMap& aMap,
PRInt32 aRowIndex,
PRInt32 aColIndex,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
PRUint32 colX, rowX;
@ -2299,7 +2299,7 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
// rowX keeps track of where we are in mRows while setting up the
// new cellmap.
PRUint32 rowX = 0;
nsRect damageArea;
nsIntRect damageArea;
// put back the rows before the affected ones just as before. Note that we
// can't just copy the old rows in bit-for-bit, because they might be
// spanning out into the rows we're adding/removing.
@ -2389,7 +2389,7 @@ 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.
PRInt32 rowX;
nsRect damageArea;
nsIntRect damageArea;
for (rowX = 0; rowX < numOrigRows; rowX++) {
const CellDataArray& row = origRows[rowX];
for (PRInt32 colX = 0; colX < numCols; colX++) {
@ -2442,7 +2442,7 @@ void nsCellMap::RemoveCell(nsTableCellMap& aMap,
nsTableCellFrame* aCellFrame,
PRInt32 aRowIndex,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea)
nsIntRect& aDamageArea)
{
PRUint32 numRows = mRows.Length();
if (PRUint32(aRowIndex) >= numRows) {
@ -2620,15 +2620,15 @@ void nsCellMap::Dump(bool aIsBorderCollapse) const
if (cd) {
if (0 == i) {
size = cd->mData.GetTopEdge(owner, segStart);
printf("t=%d%d%d ", size, owner, segStart);
printf("t=%d%d%d ", PRInt32(size), owner, segStart);
}
else if (1 == i) {
size = cd->mData.GetLeftEdge(owner, segStart);
printf("l=%d%d%d ", size, owner, segStart);
printf("l=%d%d%d ", PRInt32(size), owner, segStart);
}
else {
size = cd->mData.GetCorner(side, bevel);
printf("c=%d%d%d ", size, side, bevel);
printf("c=%d%d%d ", PRInt32(size), side, bevel);
}
}
}

View File

@ -129,28 +129,28 @@ public:
CellData* AppendCell(nsTableCellFrame& aCellFrame,
PRInt32 aRowIndex,
bool aRebuildIfNecessary,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
PRInt32 aRowIndex,
PRInt32 aColIndexBefore,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void RemoveCell(nsTableCellFrame* aCellFrame,
PRInt32 aRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
/** Remove the previously gathered column information */
void ClearCols();
void InsertRows(nsTableRowGroupFrame* aRowGroup,
nsTArray<nsTableRowFrame*>& aRows,
PRInt32 aFirstRowIndex,
bool aConsiderSpans,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void RemoveRows(PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
bool aConsiderSpans,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
@ -209,7 +209,7 @@ public:
PRInt32 aRowIndex,
PRInt32 aColIndex,
bool aInsert,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
protected:
/**
@ -224,7 +224,7 @@ protected:
PRInt32 aStartRowIndex,
nsTArray<nsTableRowFrame*>* aRowsToInsert,
PRInt32 aNumRowsToRemove,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
public:
void ExpandZeroColSpans();
@ -379,7 +379,7 @@ public:
PRInt32 aRowIndex,
bool aRebuildIfNecessary,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea,
nsIntRect& aDamageArea,
PRInt32* aBeginSearchAtCol = nsnull);
/** Function to be called when a cell is added at a location which is spanned
@ -403,27 +403,27 @@ public:
PRInt32 aRowIndex,
PRInt32 aColIndexBefore,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void RemoveCell(nsTableCellMap& aMap,
nsTableCellFrame* aCellFrame,
PRInt32 aRowIndex,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void InsertRows(nsTableCellMap& aMap,
nsTArray<nsTableRowFrame*>& aRows,
PRInt32 aFirstRowIndex,
bool aConsiderSpans,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void RemoveRows(nsTableCellMap& aMap,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
bool aConsiderSpans,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
@ -505,7 +505,7 @@ protected:
nsTArray<nsTableRowFrame*>& aRowFrames,
PRInt32 aStartRowIndex,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void ExpandWithCells(nsTableCellMap& aMap,
nsTArray<nsTableCellFrame*>& aCellFrames,
@ -514,20 +514,20 @@ protected:
PRInt32 aRowSpan,
bool aRowSpanIsZero,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void ShrinkWithoutRows(nsTableCellMap& aMap,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
void ShrinkWithoutCell(nsTableCellMap& aMap,
nsTableCellFrame& aCellFrame,
PRInt32 aRowIndex,
PRInt32 aColIndex,
PRInt32 aRgFirstRowIndex,
nsRect& aDamageArea);
nsIntRect& aDamageArea);
/**
* Rebuild due to rows being inserted or deleted with cells spanning

View File

@ -254,8 +254,8 @@ nsTableCellFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
GetRowIndex(rowIndex);
// row span needs to be clamped as we do not create rows in the cellmap
// which do not have cells originating in them
nsRect damageArea(colIndex, rowIndex, GetColSpan(), NS_MIN(GetRowSpan(),
tableFrame->GetRowCount() - rowIndex));
nsIntRect damageArea(colIndex, rowIndex, GetColSpan(),
NS_MIN(GetRowSpan(), tableFrame->GetRowCount() - rowIndex));
tableFrame->AddBCDamageArea(damageArea);
}
}
@ -775,7 +775,7 @@ void DebugCheckChildSize(nsIFrame* aChild,
{
if ((aMet.width < 0) || (aMet.width > PROBABLY_TOO_LARGE)) {
printf("WARNING: cell content %p has large width %d \n",
static_cast<void*>(aChild), aMet.width);
static_cast<void*>(aChild), PRInt32(aMet.width));
}
}
#endif

View File

@ -92,7 +92,7 @@ nsTableColFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
nsRect damageArea = nsRect(GetColIndex(), 0, 1, tableFrame->GetRowCount());
nsIntRect damageArea(GetColIndex(), 0, 1, tableFrame->GetRowCount());
tableFrame->AddBCDamageArea(damageArea);
}
}
@ -168,10 +168,11 @@ void nsTableColFrame::Dump(PRInt32 aIndent)
break;
}
printf("\nm:%d c:%d(%c) p:%f sm:%d sc:%d sp:%f f:%d",
mMinCoord, mPrefCoord, mHasSpecifiedCoord ? 's' : 'u', mPrefPercent,
mSpanMinCoord, mSpanPrefCoord,
PRInt32(mMinCoord), PRInt32(mPrefCoord),
mHasSpecifiedCoord ? 's' : 'u', mPrefPercent,
PRInt32(mSpanMinCoord), PRInt32(mSpanPrefCoord),
mSpanPrefPercent,
GetFinalWidth());
PRInt32(GetFinalWidth()));
printf("\n%s**END COL DUMP** ", indent);
delete [] indent;
}

View File

@ -196,8 +196,8 @@ nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
PRInt32 colCount = GetColCount();
if (!colCount)
return; // this is a degenerated colgroup
nsRect damageArea(GetFirstColumn()->GetColIndex(), 0, colCount,
tableFrame->GetRowCount());
nsIntRect damageArea(GetFirstColumn()->GetColIndex(), 0, colCount,
tableFrame->GetRowCount());
tableFrame->AddBCDamageArea(damageArea);
}
}

View File

@ -151,7 +151,7 @@ struct BCPropertyData
BCPropertyData() : mTopBorderWidth(0), mRightBorderWidth(0),
mBottomBorderWidth(0), mLeftBorderWidth(0),
mLeftCellBorderWidth(0), mRightCellBorderWidth(0) {}
nsRect mDamageArea;
nsIntRect mDamageArea;
BCPixelSize mTopBorderWidth;
BCPixelSize mRightBorderWidth;
BCPixelSize mBottomBorderWidth;
@ -590,7 +590,7 @@ void nsTableFrame::InsertCol(nsTableColFrame& aColFrame,
}
// for now, just bail and recalc all of the collapsing borders
if (IsBorderCollapse()) {
nsRect damageArea(aColIndex, 0, 1, GetRowCount());
nsIntRect damageArea(aColIndex, 0, 1, GetRowCount());
AddBCDamageArea(damageArea);
}
}
@ -611,7 +611,7 @@ void nsTableFrame::RemoveCol(nsTableColGroupFrame* aColGroupFrame,
}
// for now, just bail and recalc all of the collapsing borders
if (IsBorderCollapse()) {
nsRect damageArea(0, 0, GetColCount(), GetRowCount());
nsIntRect damageArea(0, 0, GetColCount(), GetRowCount());
AddBCDamageArea(damageArea);
}
}
@ -781,7 +781,7 @@ nsTableFrame::AppendCell(nsTableCellFrame& aCellFrame,
{
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
nsRect damageArea(0,0,0,0);
nsIntRect damageArea(0,0,0,0);
cellMap->AppendCell(aCellFrame, aRowIndex, true, damageArea);
MatchCellMapToColCache(cellMap);
if (IsBorderCollapse()) {
@ -796,7 +796,7 @@ void nsTableFrame::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
{
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
nsRect damageArea(0,0,0,0);
nsIntRect damageArea(0,0,0,0);
cellMap->InsertCells(aCellFrames, aRowIndex, aColIndexBefore, damageArea);
MatchCellMapToColCache(cellMap);
if (IsBorderCollapse()) {
@ -836,7 +836,7 @@ void nsTableFrame::RemoveCell(nsTableCellFrame* aCellFrame,
{
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
nsRect damageArea(0,0,0,0);
nsIntRect damageArea(0,0,0,0);
cellMap->RemoveCell(aCellFrame, aRowIndex, damageArea);
MatchCellMapToColCache(cellMap);
if (IsBorderCollapse()) {
@ -890,7 +890,7 @@ nsTableFrame::InsertRows(nsTableRowGroupFrame* aRowGroupFrame,
PRInt32 numColsToAdd = 0;
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
nsRect damageArea(0,0,0,0);
nsIntRect damageArea(0,0,0,0);
PRInt32 origNumRows = cellMap->GetRowCount();
PRInt32 numNewRows = aRowFrames.Length();
cellMap->InsertRows(aRowGroupFrame, aRowFrames, aRowIndex, aConsiderSpans, damageArea);
@ -944,7 +944,7 @@ void nsTableFrame::RemoveRows(nsTableRowFrame& aFirstRowFrame,
#endif
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
nsRect damageArea(0,0,0,0);
nsIntRect damageArea(0,0,0,0);
cellMap->RemoveRows(firstRowIndex, aNumRowsToRemove, aConsiderSpans, damageArea);
MatchCellMapToColCache(cellMap);
if (IsBorderCollapse()) {
@ -2302,7 +2302,7 @@ nsTableFrame::RemoveFrame(ChildListID aListID,
cellMap->Synchronize(this);
// Create an empty slice
ResetRowIndices(nsFrameList::Slice(mFrames, nsnull, nsnull));
nsRect damageArea;
nsIntRect damageArea;
cellMap->RebuildConsideringCells(nsnull, nsnull, 0, 0, false, damageArea);
MatchCellMapToColCache(cellMap);
@ -3790,7 +3790,7 @@ nsTableFrame::ColumnHasCellSpacingBefore(PRInt32 aColIndex) const
#endif
void
nsTableFrame::AddBCDamageArea(const nsRect& aValue)
nsTableFrame::AddBCDamageArea(const nsIntRect& aValue)
{
NS_ASSERTION(IsBorderCollapse(), "invalid AddBCDamageArea call");
#ifdef DEBUG
@ -3841,7 +3841,7 @@ nsTableFrame::SetFullBCDamageArea()
BCPropertyData* value = GetBCProperty(true);
if (value) {
value->mDamageArea = nsRect(0, 0, GetColCount(), GetRowCount());
value->mDamageArea = nsIntRect(0, 0, GetColCount(), GetRowCount());
}
}
@ -4057,7 +4057,7 @@ class BCMapCellIterator
{
public:
BCMapCellIterator(nsTableFrame* aTableFrame,
const nsRect& aDamageArea);
const nsIntRect& aDamageArea);
void First(BCMapCellInfo& aMapCellInfo);
@ -4103,7 +4103,7 @@ private:
};
BCMapCellIterator::BCMapCellIterator(nsTableFrame* aTableFrame,
const nsRect& aDamageArea)
const nsIntRect& aDamageArea)
:mTableFrame(aTableFrame)
{
mTableCellMap = aTableFrame->GetCellMap();
@ -4240,7 +4240,7 @@ BCMapCellIterator::SetNewRow(nsTableRowFrame* aRow)
for (mColIndex = mAreaStart.x; mColIndex <= mAreaEnd.x; mColIndex++) {
CellData* cellData = row.SafeElementAt(mColIndex);
if (!cellData) { // add a dead cell data
nsRect damageArea;
nsIntRect damageArea;
cellData = mCellMap->AppendCell(*mTableCellMap, nsnull, rgRowIndex,
false, 0, damageArea);
if (!cellData) ABORT1(false);
@ -4336,7 +4336,7 @@ BCMapCellIterator::Next(BCMapCellInfo& aMapInfo)
BCCellData* cellData =
static_cast<BCCellData*>(mCellMap->GetDataAt(rgRowIndex, mColIndex));
if (!cellData) { // add a dead cell data
nsRect damageArea;
nsIntRect damageArea;
cellData =
static_cast<BCCellData*>(mCellMap->AppendCell(*mTableCellMap, nsnull,
rgRowIndex, false, 0,
@ -4371,7 +4371,7 @@ BCMapCellIterator::PeekRight(BCMapCellInfo& aRefInfo,
static_cast<BCCellData*>(mCellMap->GetDataAt(rgRowIndex, colIndex));
if (!cellData) { // add a dead cell data
NS_ASSERTION(colIndex < mTableCellMap->GetColCount(), "program error");
nsRect damageArea;
nsIntRect damageArea;
cellData =
static_cast<BCCellData*>(mCellMap->AppendCell(*mTableCellMap, nsnull,
rgRowIndex, false, 0,
@ -4429,7 +4429,7 @@ BCMapCellIterator::PeekBottom(BCMapCellInfo& aRefInfo,
static_cast<BCCellData*>(cellMap->GetDataAt(rgRowIndex, aColIndex));
if (!cellData) { // add a dead cell data
NS_ASSERTION(rgRowIndex < cellMap->GetRowCount(), "program error");
nsRect damageArea;
nsIntRect damageArea;
cellData =
static_cast<BCCellData*>(cellMap->AppendCell(*mTableCellMap, nsnull,
rgRowIndex, false, 0,
@ -4964,7 +4964,7 @@ SetHorBorder(const BCCellBorder& aNewBorder,
// The extra segments and borders outside the actual damage area will not be updated in the cell map,
// because they in turn would need info from adjacent segments outside the damage area to be accurate.
void
nsTableFrame::ExpandBCDamageArea(nsRect& aRect) const
nsTableFrame::ExpandBCDamageArea(nsIntRect& aRect) const
{
PRInt32 numRows = GetRowCount();
PRInt32 numCols = GetColCount();
@ -5502,7 +5502,7 @@ nsTableFrame::CalcBCBorders()
// calculate an expanded damage area
nsRect damageArea(propData->mDamageArea);
nsIntRect damageArea(propData->mDamageArea);
ExpandBCDamageArea(damageArea);
// segments that are on the table border edges need
@ -5954,7 +5954,7 @@ nsTableFrame::CalcBCBorders()
} // for (iter.First(info); info.mCell; iter.Next(info)) {
// reset the bc flag and damage area
SetNeedToCalcBCBorders(false);
propData->mDamageArea.x = propData->mDamageArea.y = propData->mDamageArea.width = propData->mDamageArea.height = 0;
propData->mDamageArea = nsIntRect(0,0,0,0);
#ifdef DEBUG_TABLE_CELLMAP
mCellMap->Dump();
#endif
@ -6065,7 +6065,13 @@ public:
}}
void Reset();
bool SetDamageArea(nsRect aDirtyRect);
/**
* Determine the damage area in terms of rows and columns and finalize
* mInitialOffsetX and mInitialOffsetY.
* @param aDirtyRect - dirty rect in table coordinates
* @return - true if we need to paint something given dirty rect
*/
bool SetDamageArea(const nsRect& aDamageRect);
void First();
void Next();
void AccumulateOrPaintHorizontalSegment(nsRenderingContext& aRenderingContext);
@ -6132,7 +6138,7 @@ public:
bool IsDamageAreaLeftMost() {return (mColIndex == mDamageArea.x);}
PRInt32 GetRelativeColIndex() {return (mColIndex - mDamageArea.x);}
nsRect mDamageArea; // damageArea in cellmap coordinates
nsIntRect mDamageArea; // damageArea in cellmap coordinates
bool IsAfterRepeatedHeader() { return !mIsRepeatedHeader && (mRowIndex == (mRepeatedHeaderRowIndex + 1));}
bool StartRepeatedFooter() {return mIsRepeatedFooter && (mRowIndex == mRgFirstRowIndex) && (mRowIndex != mDamageArea.y);}
nscoord mInitialOffsetX; // offsetX of the first border with
@ -6174,7 +6180,7 @@ BCPaintBorderIterator::BCPaintBorderIterator(nsTableFrame* aTable)
mTableFirstInFlow = (nsTableFrame*) mTable->GetFirstInFlow();
mTableCellMap = mTable->GetCellMap();
// y position of first row in damage area
mInitialOffsetY = (mTable->GetPrevInFlow()) ? 0 : childAreaOffset.top;
mInitialOffsetY = mTable->GetPrevInFlow() ? 0 : childAreaOffset.top;
mNumTableRows = mTable->GetRowCount();
mNumTableCols = mTable->GetColCount();
@ -6192,22 +6198,16 @@ BCPaintBorderIterator::BCPaintBorderIterator(nsTableFrame* aTable)
mTableBgColor = bgFrame->GetStyleBackground();
}
/**
* determine the damage area in terms of rows and columns and finalize
mInitialOffsetY and mInitialOffsetY
@param aDirtyRect - dirty rect in table coordinates
@return - do we need to paint at all
*/
bool
BCPaintBorderIterator::SetDamageArea(nsRect aDirtyRect)
BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
{
PRUint32 startRowIndex, endRowIndex, startColIndex, endColIndex;
startRowIndex = endRowIndex = startColIndex = endColIndex = 0;
bool done = false;
bool haveIntersect = false;
// find startRowIndex, endRowIndex, startRowY
PRInt32 rowY = mInitialOffsetY;
// find startRowIndex, endRowIndex
nscoord rowY = mInitialOffsetY;
for (PRUint32 rgX = 0; rgX < mRowGroups.Length() && !done; rgX++) {
nsTableRowGroupFrame* rgFrame = mRowGroups[rgX];
for (nsTableRowFrame* rowFrame = rgFrame->GetFirstRow(); rowFrame;
@ -6312,9 +6312,9 @@ BCPaintBorderIterator::SetDamageArea(nsRect aDirtyRect)
}
if (!haveIntersect)
return false;
mDamageArea = nsRect(startColIndex, startRowIndex,
1 + NS_ABS(PRInt32(endColIndex - startColIndex)),
1 + endRowIndex - startRowIndex);
mDamageArea = nsIntRect(startColIndex, startRowIndex,
1 + NS_ABS(PRInt32(endColIndex - startColIndex)),
1 + endRowIndex - startRowIndex);
Reset();
mVerInfo = new BCVerticalSeg[mDamageArea.width + 1];
@ -6657,8 +6657,8 @@ BCVerticalSeg::Start(BCPaintBorderIterator& aIter,
maxHorSegHeight, true,
topBevel);
mTopBevelOffset = (topBevel) ?
nsPresContext::CSSPixelsToAppUnits(maxHorSegHeight): 0;
mTopBevelOffset = topBevel ?
nsPresContext::CSSPixelsToAppUnits(maxHorSegHeight): 0;
// XXX this assumes that only corners where 2 segments join can be beveled
mTopBevelSide = (aHorSegHeight > 0) ? NS_SIDE_RIGHT : NS_SIDE_LEFT;
mOffsetY += offset;
@ -7069,10 +7069,10 @@ BCPaintBorderIterator::AccumulateOrPaintHorizontalSegment(nsRenderingContext& aR
bool isSegStart = true;
bool ignoreSegStart;
nscoord leftSegWidth = (mBCData) ? mBCData->GetLeftEdge(ignoreBorderOwner,
ignoreSegStart) : 0;
nscoord topSegHeight = (mBCData) ? mBCData->GetTopEdge(borderOwner,
isSegStart) : 0;
nscoord leftSegWidth =
mBCData ? mBCData->GetLeftEdge(ignoreBorderOwner, ignoreSegStart) : 0;
nscoord topSegHeight =
mBCData ? mBCData->GetTopEdge(borderOwner, isSegStart) : 0;
if (mIsNewRow || (IsDamageAreaLeftMost() && IsDamageAreaBottomMost())) {
// reset for every new row and on the bottom of the last row
@ -7110,10 +7110,10 @@ BCPaintBorderIterator::AccumulateOrPaintVerticalSegment(nsRenderingContext& aRen
bool isSegStart = true;
bool ignoreSegStart;
nscoord verSegWidth = (mBCData) ? mBCData->GetLeftEdge(borderOwner,
isSegStart) : 0;
nscoord horSegHeight = (mBCData) ? mBCData->GetTopEdge(ignoreBorderOwner,
ignoreSegStart) : 0;
nscoord verSegWidth =
mBCData ? mBCData->GetLeftEdge(borderOwner, isSegStart) : 0;
nscoord horSegHeight =
mBCData ? mBCData->GetTopEdge(ignoreBorderOwner, ignoreSegStart) : 0;
PRInt32 relColIndex = GetRelativeColIndex();
BCVerticalSeg& verSeg = mVerInfo[relColIndex];

View File

@ -292,7 +292,7 @@ public:
friend class nsDelayedCalcBCBorders;
void AddBCDamageArea(const nsRect& aValue);
void AddBCDamageArea(const nsIntRect& aValue);
bool BCRecalcNeeded(nsStyleContext* aOldStyleContext,
nsStyleContext* aNewStyleContext);
void PaintBCBorders(nsRenderingContext& aRenderingContext,
@ -700,7 +700,7 @@ protected:
void SetFullBCDamageArea();
void CalcBCBorders();
void ExpandBCDamageArea(nsRect& aRect) const;
void ExpandBCDamageArea(nsIntRect& aRect) const;
void SetColumnDimensions(nscoord aHeight,
const nsMargin& aReflowState);

View File

@ -138,7 +138,7 @@ nsTableRowFrame::SetPctHeight(float aPctValue,
}
else {
mStylePctHeight = height;
if (height > 0.0f) {
if (height > 0) {
SetHasPctHeight(true);
}
}
@ -193,7 +193,7 @@ nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
nsRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
nsIntRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
tableFrame->AddBCDamageArea(damageArea);
}
}

View File

@ -1378,8 +1378,8 @@ nsTableRowGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
nsRect damageArea(0, GetStartRowIndex(), tableFrame->GetColCount(),
GetRowCount());
nsIntRect damageArea(0, GetStartRowIndex(), tableFrame->GetColCount(),
GetRowCount());
tableFrame->AddBCDamageArea(damageArea);
}
}