Bug 720142 - Use nsIntRect for table damage. r=bernd
authorMats Palmgren <matspal@gmail.com>
Sun, 22 Jan 2012 23:48:34 +0100
changeset 86310 67fb425e004bc562a297788e6c9e8f293eb7a284
parent 86309 7de99b312d6f702b1756483af25a6a8d52f18229
child 86311 d65285b0491765c83a7346c1ff21117e56d9dd61
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbernd
bugs720142
milestone12.0a1
Bug 720142 - Use nsIntRect for table damage. r=bernd
layout/tables/nsCellMap.cpp
layout/tables/nsCellMap.h
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableColFrame.cpp
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -42,17 +42,17 @@
 #include "nsTableRowGroupFrame.h"
 
 
 static void
 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");
   NS_ASSERTION(aWidth >= 0, "negative horizontal damage");
   NS_ASSERTION(aHeight >= 0, "negative vertical damage");
   aDamageArea.x      = aXOrigin;
   aDamageArea.y      = aYOrigin;
   aDamageArea.width  = aWidth;
@@ -486,17 +486,17 @@ nsTableCellMap::ClearCols()
   if (mBCInfo)
     mBCInfo->mBottomBorders.Clear();
 }
 void
 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();
 
   PRInt32 rowIndex = aFirstRowIndex;
   PRInt32 rgStartRowIndex = 0;
   nsCellMap* cellMap = mFirstMap;
   while (cellMap) {
@@ -533,17 +533,17 @@ nsTableCellMap::InsertRows(nsTableRowGro
 
   NS_ERROR("Attempt to insert row into wrong map.");
 }
 
 void
 nsTableCellMap::RemoveRows(PRInt32         aFirstRowIndex,
                            PRInt32         aNumRowsToRemove,
                            bool            aConsiderSpans,
-                           nsRect&         aDamageArea)
+                           nsIntRect&      aDamageArea)
 {
   PRInt32 rowIndex = aFirstRowIndex;
   PRInt32 rgStartRowIndex = 0;
   nsCellMap* cellMap = mFirstMap;
   while (cellMap) {
     PRInt32 rowCount = cellMap->GetRowCount();
     if (rowCount > rowIndex) {
       cellMap->RemoveRows(*this, rowIndex, aNumRowsToRemove, aConsiderSpans,
@@ -567,17 +567,17 @@ nsTableCellMap::RemoveRows(PRInt32      
 }
 
 
 
 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
   if (!rgFrame) return 0;
   rgFrame = rgFrame->GetParent();   // get the row group
   if (!rgFrame) return 0;
 
   CellData* result = nsnull;
@@ -602,17 +602,17 @@ nsTableCellMap::AppendCell(nsTableCellFr
   return result;
 }
 
 
 void
 nsTableCellMap::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
                             PRInt32                      aRowIndex,
                             PRInt32                      aColIndexBefore,
-                            nsRect&                      aDamageArea)
+                            nsIntRect&                   aDamageArea)
 {
   PRInt32 rowIndex = aRowIndex;
   PRInt32 rgStartRowIndex = 0;
   nsCellMap* cellMap = mFirstMap;
   while (cellMap) {
     PRInt32 rowCount = cellMap->GetRowCount();
     if (rowCount > rowIndex) {
       cellMap->InsertCells(*this, aCellFrames, rowIndex, aColIndexBefore,
@@ -627,17 +627,17 @@ nsTableCellMap::InsertCells(nsTArray<nsT
   Dump("after InsertCells");
 #endif
 }
 
 
 void
 nsTableCellMap::RemoveCell(nsTableCellFrame* aCellFrame,
                            PRInt32           aRowIndex,
-                           nsRect&           aDamageArea)
+                           nsIntRect&        aDamageArea)
 {
   if (!aCellFrame) ABORT0();
   NS_ASSERTION(aCellFrame == (nsTableCellFrame *)aCellFrame->GetFirstInFlow(),
                "invalid call on continuing frame");
   PRInt32 rowIndex = aRowIndex;
   PRInt32 rgStartRowIndex = 0;
   nsCellMap* cellMap = mFirstMap;
   while (cellMap) {
@@ -662,17 +662,17 @@ nsTableCellMap::RemoveCell(nsTableCellFr
 }
 
 void
 nsTableCellMap::RebuildConsideringCells(nsCellMap*                   aCellMap,
                                         nsTArray<nsTableCellFrame*>* aCellFrames,
                                         PRInt32                      aRowIndex,
                                         PRInt32                      aColIndex,
                                         bool                         aInsert,
-                                        nsRect&                      aDamageArea)
+                                        nsIntRect&                   aDamageArea)
 {
   PRInt32 numOrigCols = GetColCount();
   ClearCols();
   nsCellMap* cellMap = mFirstMap;
   PRInt32 rowCount = 0;
   while (cellMap) {
     if (cellMap == aCellMap) {
       cellMap->RebuildConsideringCells(*this, numOrigCols, aCellFrames,
@@ -688,17 +688,17 @@ nsTableCellMap::RebuildConsideringCells(
   SetDamageArea(0, 0, GetColCount(), rowCount, aDamageArea);
 }
 
 void
 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");
 
   PRInt32 numOrigCols = GetColCount();
   ClearCols();
   nsCellMap* cellMap = mFirstMap;
   PRInt32 rowCount = 0;
@@ -761,39 +761,39 @@ nsTableCellMap::Dump(char* aString) cons
     PRInt32 numCols = mBCInfo->mBottomBorders.Length();
     for (PRInt32 i = 0; i <= 2; i++) {
 
       printf("\n          ");
       for (colIndex = 0; colIndex < numCols; colIndex++) {
         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");
   }
   printf("***** END TABLE CELL MAP DUMP *****\n");
 }
 #endif
 
@@ -1023,32 +1023,32 @@ nsTableCellMap::SetBCBorderEdge(mozilla:
     lastIndex = xPos + aLength - 1;
     for (xIndex = xPos; xIndex <= lastIndex; xIndex++) {
       changed = aChanged && (xIndex == xPos);
       BCData* bcData = nsnull;
       cellData = (BCCellData*)aCellMap.GetDataAt(rgYPos, xIndex);
       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();
         }
         else {
           NS_ASSERTION(aSide == NS_SIDE_BOTTOM, "program error");
           // try the next non empty row group
           nsCellMap* cellMap = aCellMap.GetNextSibling();
           while (cellMap && (0 == cellMap->GetRowCount())) {
             cellMap = cellMap->GetNextSibling();
           }
           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);
             }
           }
           else { // must be at the end of the table
             bcData = GetBottomMostBorder(xIndex);
           }
@@ -1133,30 +1133,30 @@ nsTableCellMap::SetBCBorderCorner(Corner
     NS_ASSERTION(!aIsBottomRight, "should be handled before");
     bcData = GetRightMostBorder(yPos);
   }
   else {
     cellData = (BCCellData*)aCellMap.GetDataAt(rgYPos, xPos);
     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);
       }
       else {
         // try the next non empty row group
         nsCellMap* cellMap = aCellMap.GetNextSibling();
         while (cellMap && (0 == cellMap->GetRowCount())) {
           cellMap = cellMap->GetNextSibling();
         }
         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);
           }
         }
         else { // must be at the bottom of the table
           bcData = GetBottomMostBorder(xPos);
         }
       }
@@ -1353,17 +1353,17 @@ void nsCellMap::GrowRow(CellDataArray& a
 }
 
 void
 nsCellMap::InsertRows(nsTableCellMap&             aMap,
                       nsTArray<nsTableRowFrame*>& aRows,
                       PRInt32                     aFirstRowIndex,
                       bool                        aConsiderSpans,
                       PRInt32                     aRgFirstRowIndex,
-                      nsRect&                     aDamageArea)
+                      nsIntRect&                  aDamageArea)
 {
   PRInt32 numCols = aMap.GetColCount();
   NS_ASSERTION(aFirstRowIndex >= 0, "nsCellMap::InsertRows called with negative rowIndex");
   if (PRUint32(aFirstRowIndex) > mRows.Length()) {
     // create (aFirstRowIndex - mRows.Length()) empty rows up to aFirstRowIndex
     PRInt32 numEmptyRows = aFirstRowIndex - mRows.Length();
     if (!Grow(aMap, numEmptyRows)) {
       return;
@@ -1398,17 +1398,17 @@ nsCellMap::InsertRows(nsTableCellMap&   
 }
 
 void
 nsCellMap::RemoveRows(nsTableCellMap& aMap,
                       PRInt32         aFirstRowIndex,
                       PRInt32         aNumRowsToRemove,
                       bool            aConsiderSpans,
                       PRInt32         aRgFirstRowIndex,
-                      nsRect&         aDamageArea)
+                      nsIntRect&      aDamageArea)
 {
   PRInt32 numRows = mRows.Length();
   PRInt32 numCols = aMap.GetColCount();
 
   if (aFirstRowIndex >= numRows) {
     // reduce the content based row count based on the function arguments
     // as they are known to be real rows even if the cell map did not create
     // rows for them before.
@@ -1441,17 +1441,17 @@ nsCellMap::RemoveRows(nsTableCellMap& aM
 
 
 CellData*
 nsCellMap::AppendCell(nsTableCellMap&   aMap,
                       nsTableCellFrame* aCellFrame,
                       PRInt32           aRowIndex,
                       bool              aRebuildIfNecessary,
                       PRInt32           aRgFirstRowIndex,
-                      nsRect&           aDamageArea,
+                      nsIntRect&        aDamageArea,
                       PRInt32*          aColToBeginSearch)
 {
   NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
   PRInt32 origNumMapRows = mRows.Length();
   PRInt32 origNumCols = aMap.GetColCount();
   bool    zeroRowSpan = false;
   PRInt32 rowSpan = (aCellFrame) ? GetRowSpanForNewCell(aCellFrame, aRowIndex,
                                                         zeroRowSpan) : 1;
@@ -1751,17 +1751,17 @@ bool nsCellMap::CellsSpanInOrOut(PRInt32
   return false;
 }
 
 void nsCellMap::InsertCells(nsTableCellMap&              aMap,
                             nsTArray<nsTableCellFrame*>& aCellFrames,
                             PRInt32                      aRowIndex,
                             PRInt32                      aColIndexBefore,
                             PRInt32                      aRgFirstRowIndex,
-                            nsRect&                      aDamageArea)
+                            nsIntRect&                   aDamageArea)
 {
   if (aCellFrames.Length() == 0) return;
   NS_ASSERTION(aColIndexBefore >= -1, "index out of range");
   PRInt32 numCols = aMap.GetColCount();
   if (aColIndexBefore >= numCols) {
     NS_ERROR("Inserting instead of appending cells indicates a serious cellmap error");
     aColIndexBefore = numCols - 1;
   }
@@ -1822,17 +1822,17 @@ void nsCellMap::InsertCells(nsTableCellM
   }
 }
 
 void
 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");
 
   PRInt32 numNewRows  = aRowFrames.Length();
   mContentRowCount += numNewRows;
 
   PRInt32 endRowIndex = startRowIndex + numNewRows - 1;
@@ -1869,17 +1869,17 @@ nsCellMap::ExpandWithRows(nsTableCellMap
 
 void nsCellMap::ExpandWithCells(nsTableCellMap&              aMap,
                                 nsTArray<nsTableCellFrame*>& aCellFrames,
                                 PRInt32                      aRowIndex,
                                 PRInt32                      aColIndex,
                                 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;
   PRInt32 startColIndex = aColIndex;
   PRInt32 endColIndex = aColIndex;
   PRInt32 numCells = aCellFrames.Length();
   PRInt32 totalColSpan = 0;
 
@@ -1989,17 +1989,17 @@ void nsCellMap::ExpandWithCells(nsTableC
     }
   }
 }
 
 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;
   PRUint32 colCount = aMap.GetColCount();
   for (PRInt32 rowX = endRowIndex; rowX >= aStartRowIndex; --rowX) {
     CellDataArray& row = mRows[rowX];
     PRUint32 colX;
     for (colX = 0; colX < colCount; colX++) {
@@ -2169,17 +2169,17 @@ PRInt32 nsCellMap::GetRowSpan(PRInt32  a
   return rowSpan;
 }
 
 void nsCellMap::ShrinkWithoutCell(nsTableCellMap&   aMap,
                                   nsTableCellFrame& aCellFrame,
                                   PRInt32           aRowIndex,
                                   PRInt32           aColIndex,
                                   PRInt32           aRgFirstRowIndex,
-                                  nsRect&           aDamageArea)
+                                  nsIntRect&        aDamageArea)
 {
   NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
   PRUint32 colX, rowX;
 
   // get the rowspan and colspan from the cell map since the content may have changed
   bool zeroColSpan;
   PRUint32 numCols = aMap.GetColCount();
   PRInt32 rowSpan = GetRowSpan(aRowIndex, aColIndex, true);
@@ -2294,17 +2294,17 @@ nsCellMap::RebuildConsideringRows(nsTabl
 
   // aStartRowIndex might be after all existing rows so we should limit the
   // copy to the amount of exisiting rows
   PRUint32 copyEndRowIndex = NS_MIN(numOrigRows, PRUint32(aStartRowIndex));
 
   // 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.
   for ( ; rowX < copyEndRowIndex; rowX++) {
     const CellDataArray& row = origRows[rowX];
     PRUint32 numCols = row.Length();
     for (PRUint32 colX = 0; colX < numCols; colX++) {
       // put in the original cell from the cell map
@@ -2384,17 +2384,17 @@ nsCellMap::RebuildConsideringCells(nsTab
 
   // the new cells might extend the previous column number
   NS_ASSERTION(aNumOrigCols >= aColIndex, "Appending cells far beyond cellmap data?!");
   PRInt32 numCols = aInsert ? NS_MAX(aNumOrigCols, aColIndex + 1) : aNumOrigCols;
 
   // 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++) {
       if ((rowX == aRowIndex) && (colX == aColIndex)) {
         if (aInsert) { // put in the new cells
           for (PRInt32 cellX = 0; cellX < numNewCells; cellX++) {
             nsTableCellFrame* cell = aCellFrames->ElementAt(cellX);
             if (cell) {
@@ -2437,17 +2437,17 @@ nsCellMap::RebuildConsideringCells(nsTab
   }
 
 }
 
 void nsCellMap::RemoveCell(nsTableCellMap&   aMap,
                            nsTableCellFrame* aCellFrame,
                            PRInt32           aRowIndex,
                            PRInt32           aRgFirstRowIndex,
-                           nsRect&           aDamageArea)
+                           nsIntRect&        aDamageArea)
 {
   PRUint32 numRows = mRows.Length();
   if (PRUint32(aRowIndex) >= numRows) {
     NS_ERROR("bad arg in nsCellMap::RemoveCell");
     return;
   }
   PRInt32 numCols = aMap.GetColCount();
 
@@ -2615,25 +2615,25 @@ void nsCellMap::Dump(bool aIsBorderColla
       bool          bevel;
       for (PRInt32 i = 0; i <= 2; i++) {
         printf("\n          ");
         for (colIndex = 0; colIndex < colCount; colIndex++) {
           BCCellData* cd = (BCCellData *)row[colIndex];
           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);
             }
           }
         }
       }
     }
     printf("\n");
   }
 
--- a/layout/tables/nsCellMap.h
+++ b/layout/tables/nsCellMap.h
@@ -124,38 +124,38 @@ public:
   // this function creates a col if needed
   nsColInfo* GetColInfoAt(PRInt32 aColIndex);
 
   /** append the cellFrame at the end of the row at aRowIndex and return the col index
     */
   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;
 
   /** indicate whether the row has more than one cell that either originates
     * or is spanned from the rows above
     */
   bool HasMoreThanOneCell(PRInt32 aRowIndex) const;
@@ -204,32 +204,32 @@ public:
 
   bool RowIsSpannedInto(PRInt32 aRowIndex, PRInt32 aNumEffCols) const;
   bool RowHasSpanningCells(PRInt32 aRowIndex, PRInt32 aNumEffCols) const;
   void RebuildConsideringCells(nsCellMap*                   aCellMap,
                                nsTArray<nsTableCellFrame*>* aCellFrames,
                                PRInt32                      aRowIndex,
                                PRInt32                      aColIndex,
                                bool                         aInsert,
-                               nsRect&                      aDamageArea);
+                               nsIntRect&                   aDamageArea);
 
 protected:
   /**
    * Rebuild due to rows being inserted or deleted with cells spanning
    * into or out of the rows.  This function can only handle insertion
    * or deletion but NOT both.  So either aRowsToInsert must be null
    * or aNumRowsToRemove must be 0.
    *
    * // XXXbz are both allowed to happen?  That'd be a no-op...
    */
   void RebuildConsideringRows(nsCellMap*                  aCellMap,
                               PRInt32                     aStartRowIndex,
                               nsTArray<nsTableRowFrame*>* aRowsToInsert,
                               PRInt32                     aNumRowsToRemove,
-                              nsRect&                     aDamageArea);
+                              nsIntRect&                  aDamageArea);
 
 public:
   void ExpandZeroColSpans();
 
   void ResetTopStart(PRUint8    aSide,
                      nsCellMap& aCellMap,
                      PRUint32   aYPos,
                      PRUint32   aXPos,
@@ -374,17 +374,17 @@ public:
     * @return                   - a pointer to the celldata entry inserted into
     *                             the cellmap
     */
   CellData* AppendCell(nsTableCellMap&   aMap,
                        nsTableCellFrame* aCellFrame,
                        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
     * to by a zero colspan.  We handle this situation by collapsing the zero
     * colspan, since there is really no good way to deal with it (trying to
     * increase the number of columns to hold the new cell would just mean the
     * zero colspan needs to expand).
 
@@ -398,37 +398,37 @@ public:
                            PRInt32         aRowIndex,
                            PRInt32         aColIndex);
 
   void InsertCells(nsTableCellMap&              aMap,
                    nsTArray<nsTableCellFrame*>& aCellFrames,
                    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;
 
   /** return the number of rows in the table represented by this CellMap */
   PRInt32 GetRowCount(bool aConsiderDeadRowSpanRows = false) const;
 
   nsTableCellFrame* GetCellInfoAt(const nsTableCellMap& aMap,
@@ -500,39 +500,39 @@ protected:
                       PRInt32         aColIndex) const;
 
   PRInt32 GetNumCellsIn(PRInt32 aColIndex) const;
 
   void ExpandWithRows(nsTableCellMap&             aMap,
                       nsTArray<nsTableRowFrame*>& aRowFrames,
                       PRInt32                     aStartRowIndex,
                       PRInt32                     aRgFirstRowIndex,
-                      nsRect&                     aDamageArea);
+                      nsIntRect&                  aDamageArea);
 
   void ExpandWithCells(nsTableCellMap&              aMap,
                        nsTArray<nsTableCellFrame*>& aCellFrames,
                        PRInt32                      aRowIndex,
                        PRInt32                      aColIndex,
                        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
    * into or out of the rows.  This function can only handle insertion
    * or deletion but NOT both.  So either aRowsToInsert must be null
    * or aNumRowsToRemove must be 0.
    *
    * // XXXbz are both allowed to happen?  That'd be a no-op...
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -249,18 +249,18 @@ nsTableCellFrame::DidSetStyleContext(nsS
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (tableFrame->IsBorderCollapse() &&
       tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
     PRInt32 colIndex, rowIndex;
     GetColIndex(colIndex);
     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);
   }
 }
 
 
 NS_IMETHODIMP
 nsTableCellFrame::AppendFrames(ChildListID     aListID,
                                nsFrameList&    aFrameList)
@@ -770,17 +770,17 @@ nsTableCellFrame::IntrinsicWidthOffsets(
 #define PROBABLY_TOO_LARGE 1000000
 static
 void DebugCheckChildSize(nsIFrame*            aChild,
                          nsHTMLReflowMetrics& aMet,
                          nsSize&              aAvailSize)
 {
   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
 
 // the computed height for the cell, which descendants use for percent height calculations
 // it is the height (minus border, padding) of the cell's first in flow during its final
 // reflow without an unconstrained height.
 static nscoord
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -87,17 +87,17 @@ nsTableColFrame::SetColType(nsTableColTy
 nsTableColFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
 {
   if (!aOldStyleContext) //avoid this on init
     return;
      
   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);
   }
 }
 
 void nsTableColFrame::SetContinuousBCBorderWidth(PRUint8     aForSide,
                                                  BCPixelSize aPixelValue)
 {
   switch (aForSide) {
@@ -163,20 +163,21 @@ void nsTableColFrame::Dump(PRInt32 aInde
   case eColAnonymousColGroup:
     printf(" anonymous-colgroup ");
     break;
   case eColAnonymousCell: 
     printf(" anonymous-cell ");
     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;
 }
 #endif
 /* ----- global methods ----- */
 
 nsTableColFrame* 
 NS_NewTableColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -191,18 +191,18 @@ nsTableColGroupFrame::DidSetStyleContext
     return;
      
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (tableFrame->IsBorderCollapse() &&
       tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
     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);
   }
 }
 
 NS_IMETHODIMP
 nsTableColGroupFrame::AppendFrames(ChildListID     aListID,
                                    nsFrameList&    aFrameList)
 {
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -146,17 +146,17 @@ struct nsTableReflowState {
  ** nsTableFrame                                                               **
  ********************************************************************************/
 
 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;
   BCPixelSize mLeftBorderWidth;
   BCPixelSize mLeftCellBorderWidth;
   BCPixelSize mRightCellBorderWidth;
 };
 
@@ -585,17 +585,17 @@ void nsTableFrame::InsertCol(nsTableColF
       }
       if (!removedFromCache) {
         cellMap->AddColsAtEnd(1);
       }
     }
   }
   // 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);
   }
 }
 
 void nsTableFrame::RemoveCol(nsTableColGroupFrame* aColGroupFrame,
                              PRInt32               aColIndex,
                              bool                  aRemoveFromCache,
                              bool                  aRemoveFromCellMap)
@@ -606,17 +606,17 @@ void nsTableFrame::RemoveCol(nsTableColG
   if (aRemoveFromCellMap) {
     nsTableCellMap* cellMap = GetCellMap();
     if (cellMap) {
       AppendAnonymousColFrames(1);
     }
   }
   // 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);
   }
 }
 
 /** Get the cell map for this table frame.  It is not always mCellMap.
   * Only the firstInFlow has a legit cell map
   */
 nsTableCellMap* nsTableFrame::GetCellMap() const
@@ -776,32 +776,32 @@ nsTableFrame::DidResizeColumns()
 }
 
 void
 nsTableFrame::AppendCell(nsTableCellFrame& aCellFrame,
                          PRInt32           aRowIndex)
 {
   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()) {
       AddBCDamageArea(damageArea);
     }
   }
 }
 
 void nsTableFrame::InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
                                PRInt32                      aRowIndex,
                                PRInt32                      aColIndexBefore)
 {
   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()) {
       AddBCDamageArea(damageArea);
     }
   }
 }
 
@@ -831,17 +831,17 @@ nsTableFrame::DestroyAnonymousColFrames(
   return (aNumFrames - numColsRemoved);
 }
 
 void nsTableFrame::RemoveCell(nsTableCellFrame* aCellFrame,
                               PRInt32           aRowIndex)
 {
   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()) {
       AddBCDamageArea(damageArea);
     }
   }
 }
 
@@ -885,17 +885,17 @@ nsTableFrame::InsertRows(nsTableRowGroup
 #ifdef DEBUG_TABLE_CELLMAP
   printf("=== insertRowsBefore firstRow=%d \n", aRowIndex);
   Dump(true, false, true);
 #endif
 
   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);
     MatchCellMapToColCache(cellMap);
     if (aRowIndex < origNumRows) {
       AdjustRowIndices(aRowIndex, numNewRows);
     }
     // assign the correct row indices to the new rows. If they were adjusted above
@@ -939,17 +939,17 @@ void nsTableFrame::RemoveRows(nsTableRow
 
   PRInt32 firstRowIndex = aFirstRowFrame.GetRowIndex();
 #ifdef DEBUG_TABLE_CELLMAP
   printf("=== removeRowsBefore firstRow=%d numRows=%d\n", firstRowIndex, aNumRowsToRemove);
   Dump(true, false, true);
 #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()) {
       AddBCDamageArea(damageArea);
     }
   }
   AdjustRowIndices(firstRowIndex, -aNumRowsToRemove);
 #ifdef DEBUG_TABLE_CELLMAP
@@ -2297,17 +2297,17 @@ nsTableFrame::RemoveFrame(ChildListID   
     // remove the row group frame from the sibling chain
     mFrames.DestroyFrame(aOldFrame);
 
     // the removal of a row group changes the cellmap, the columns might change
     if (cellMap) {
       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);
     }
   }
   // for now, just bail and recalc all of the collapsing borders
   // as the cellmap changes we need to recalc
   if (IsBorderCollapse()) {
@@ -3785,17 +3785,17 @@ nsTableFrame::ColumnHasCellSpacingBefore
   VerifyNonNegativeDamageRect(r);                                       \
   NS_ASSERTION((r).XMost() <= GetColCount(),                            \
                "horizontal damage extends outside table");              \
   NS_ASSERTION((r).YMost() <= GetRowCount(),                            \
                "vertical damage extends outside table");
 #endif
 
 void
-nsTableFrame::AddBCDamageArea(const nsRect& aValue)
+nsTableFrame::AddBCDamageArea(const nsIntRect& aValue)
 {
   NS_ASSERTION(IsBorderCollapse(), "invalid AddBCDamageArea call");
 #ifdef DEBUG
   VerifyDamageRect(aValue);
 #endif
 
   SetNeedToCalcBCBorders(true);
   // Get the property
@@ -3836,17 +3836,17 @@ void
 nsTableFrame::SetFullBCDamageArea()
 {
   NS_ASSERTION(IsBorderCollapse(), "invalid SetFullBCDamageArea call");
 
   SetNeedToCalcBCBorders(true);
 
   BCPropertyData* value = GetBCProperty(true);
   if (value) {
-    value->mDamageArea = nsRect(0, 0, GetColCount(), GetRowCount());
+    value->mDamageArea = nsIntRect(0, 0, GetColCount(), GetRowCount());
   }
 }
 
 
 /* BCCellBorder represents a border segment which can be either a horizontal
  * or a vertical segment. For each segment we need to know the color, width,
  * style, who owns it and how long it is in cellmap coordinates.
  * Ownership of these segments is important to calculate which corners should
@@ -4052,17 +4052,17 @@ inline PRInt32 BCMapCellInfo::GetCellEnd
   return mColIndex + mColSpan - 1;
 }
 
 
 class BCMapCellIterator
 {
 public:
   BCMapCellIterator(nsTableFrame* aTableFrame,
-                    const nsRect& aDamageArea);
+                    const nsIntRect& aDamageArea);
 
   void First(BCMapCellInfo& aMapCellInfo);
 
   void Next(BCMapCellInfo& aMapCellInfo);
 
   void PeekRight(BCMapCellInfo& aRefInfo,
                  PRUint32     aRowIndex,
                  BCMapCellInfo& aAjaInfo);
@@ -4098,17 +4098,17 @@ private:
   PRInt32               mRowIndex;
   PRUint32              mNumTableCols;
   PRInt32               mColIndex;
   nsPoint               mAreaStart;
   nsPoint               mAreaEnd;
 };
 
 BCMapCellIterator::BCMapCellIterator(nsTableFrame* aTableFrame,
-                                     const nsRect& aDamageArea)
+                                     const nsIntRect& aDamageArea)
 :mTableFrame(aTableFrame)
 {
   mTableCellMap  = aTableFrame->GetCellMap();
 
   mAreaStart.x   = aDamageArea.x;
   mAreaStart.y   = aDamageArea.y;
   mAreaEnd.y     = aDamageArea.y + aDamageArea.height - 1;
   mAreaEnd.x     = aDamageArea.x + aDamageArea.width - 1;
@@ -4235,17 +4235,17 @@ BCMapCellIterator::SetNewRow(nsTableRowF
     PRInt32 rgRowIndex = mRowIndex - mRowGroupStart;
     if (PRUint32(rgRowIndex) >= mCellMap->mRows.Length())
       ABORT1(false);
     const nsCellMap::CellDataArray& row = mCellMap->mRows[rgRowIndex];
 
     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);
       }
       if (cellData && (cellData->IsOrig() || cellData->IsDead())) {
         break;
       }
     }
@@ -4331,17 +4331,17 @@ BCMapCellIterator::Next(BCMapCellInfo& a
   mIsNewRow = false;
   mColIndex++;
   while ((mRowIndex <= mAreaEnd.y) && !mAtEnd) {
     for (; mColIndex <= mAreaEnd.x; mColIndex++) {
       PRInt32 rgRowIndex = mRowIndex - mRowGroupStart;
       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,
                                                          damageArea));
         if (!cellData) ABORT0();
       }
       if (cellData && (cellData->IsOrig() || cellData->IsDead())) {
         aMapInfo.SetInfo(mRow, mColIndex, cellData, this);
@@ -4366,17 +4366,17 @@ BCMapCellIterator::PeekRight(BCMapCellIn
   aAjaInfo.ResetCellInfo();
   PRInt32 colIndex = aRefInfo.mColIndex + aRefInfo.mColSpan;
   PRUint32 rgRowIndex = aRowIndex - mRowGroupStart;
 
   BCCellData* cellData =
     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,
                                                      damageArea));
     if (!cellData) ABORT0();
   }
   nsTableRowFrame* row = nsnull;
   if (cellData->IsRowSpan()) {
@@ -4424,17 +4424,17 @@ BCMapCellIterator::PeekBottom(BCMapCellI
       nextRow = nextRow->GetNextRow(); if (!nextRow) ABORT0();
     }
   }
 
   BCCellData* cellData =
     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,
                                                     damageArea));
     if (!cellData) ABORT0();
   }
   if (cellData->IsColSpan()) {
     aColIndex -= cellData->GetColSpanOffset();
@@ -4959,17 +4959,17 @@ SetHorBorder(const BCCellBorder& aNewBor
   return startSeg;
 }
 
 // Make the damage area larger on the top and bottom by at least one row and on the left and right
 // at least one column. This is done so that adjacent elements are part of the border calculations.
 // 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();
 
   PRInt32 dStartX = aRect.x;
   PRInt32 dEndX   = aRect.XMost() - 1;
   PRInt32 dStartY = aRect.y;
   PRInt32 dEndY   = aRect.YMost() - 1;
@@ -5497,17 +5497,17 @@ nsTableFrame::CalcBCBorders()
 
   // Get the property holding the table damage area and border widths
   BCPropertyData* propData = GetBCProperty();
   if (!propData) ABORT0();
 
 
 
   // calculate an expanded damage area
-  nsRect damageArea(propData->mDamageArea);
+  nsIntRect damageArea(propData->mDamageArea);
   ExpandBCDamageArea(damageArea);
 
   // segments that are on the table border edges need
   // to be initialized only once
   bool tableBorderReset[4];
   for (PRUint32 sideX = NS_SIDE_TOP; sideX <= NS_SIDE_LEFT; sideX++) {
     tableBorderReset[sideX] = false;
   }
@@ -5949,17 +5949,17 @@ nsTableFrame::CalcBCBorders()
                                         info.GetCellEndColIndex() + 1);
           }
         }
       }
     }
   } // 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
 }
 
 class BCPaintBorderIterator;
 
 struct BCVerticalSeg
@@ -6060,17 +6060,23 @@ public:
 
 
   BCPaintBorderIterator(nsTableFrame* aTable);
   ~BCPaintBorderIterator() { if (mVerInfo) {
                               delete [] mVerInfo;
                            }}
   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);
   void AccumulateOrPaintVerticalSegment(nsRenderingContext& aRenderingContext);
   void ResetVerInfo();
   void StoreColumnWidth(PRInt32 aIndex);
   bool VerticalSegmentOwnsCorner();
 
@@ -6127,17 +6133,17 @@ public:
   bool                  IsTableBottomMost() {return (mRowIndex >= mNumTableRows) && !mTable->GetNextInFlow();}
   bool                  IsTableLeftMost()   {return (mColIndex == 0);}
   bool                  IsDamageAreaTopMost()    {return (mRowIndex == mDamageArea.y);}
   bool                  IsDamageAreaRightMost()  {return (mColIndex >= mDamageArea.XMost());}
   bool                  IsDamageAreaBottomMost() {return (mRowIndex >= mDamageArea.YMost());}
   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
                                             // respect to the table
   nscoord               mInitialOffsetY;    // offsetY of the first border with
                                             // respect to the table
   nscoord               mNextOffsetY;       // offsetY of the next segment
   BCVerticalSeg*        mVerInfo; // this array is used differently when
@@ -6169,17 +6175,17 @@ private:
 BCPaintBorderIterator::BCPaintBorderIterator(nsTableFrame* aTable)
 {
   mTable      = aTable;
   mVerInfo    = nsnull;
   nsMargin childAreaOffset = mTable->GetChildAreaOffset(nsnull);
   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();
 
   // Get the ordered row groups
   mTable->OrderRowGroups(mRowGroups);
   // initialize to a non existing index
   mRepeatedHeaderRowIndex = -99;
 
@@ -6187,32 +6193,26 @@ BCPaintBorderIterator::BCPaintBorderIter
                    NS_STYLE_DIRECTION_LTR;
   mColInc = (mTableIsLTR) ? 1 : -1;
 
   nsIFrame* bgFrame =
     nsCSSRendering::FindNonTransparentBackgroundFrame(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;
          rowFrame = rowFrame->GetNextRow()) {
       // conservatively estimate the half border widths outside the row
       nscoord topBorderHalf    = (mTable->GetPrevInFlow()) ? 0 :
        nsPresContext::CSSPixelsToAppUnits(rowFrame->GetTopBCBorderWidth() + 1);
       nscoord bottomBorderHalf = (mTable->GetNextInFlow()) ? 0 :
@@ -6307,19 +6307,19 @@ BCPaintBorderIterator::SetDamageArea(nsR
       nsTableColFrame* colFrame = mTableFirstInFlow->GetColFrame(column);
       if (!colFrame) ABORT1(false);
       nsSize size = colFrame->GetSize();
       mInitialOffsetX += mColInc * size.width;
     }
   }
   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];
   if (!mVerInfo)
     return false;
   return true;
 }
 
@@ -6652,18 +6652,18 @@ BCVerticalSeg::Start(BCPaintBorderIterat
                                aIter.mBCData->GetCorner(ownerSide, bevel) : 0;
 
   bool    topBevel        = (aVerSegWidth > 0) ? bevel : false;
   BCPixelSize maxHorSegHeight = NS_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
   nscoord offset          = CalcVerCornerOffset(ownerSide, cornerSubWidth,
                                                 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;
   mLength        = -offset;
   mWidth         = aVerSegWidth;
   mOwner         = aBorderOwner;
   mFirstCell     = aIter.mCell;
   mFirstRowGroup = aIter.mRg;
@@ -7064,20 +7064,20 @@ BCPaintBorderIterator::AccumulateOrPaint
     StoreColumnWidth(relColIndex);
   }
 
   BCBorderOwner borderOwner = eCellOwner;
   BCBorderOwner ignoreBorderOwner;
   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
     mHorSeg.mOffsetY = mNextOffsetY;
     mNextOffsetY     = mNextOffsetY + mRow->GetSize().height;
     mHorSeg.mOffsetX = mInitialOffsetX;
     mHorSeg.Start(*this, borderOwner, leftSegWidth, topSegHeight);
   }
@@ -7105,20 +7105,20 @@ BCPaintBorderIterator::AccumulateOrPaint
 void
 BCPaintBorderIterator::AccumulateOrPaintVerticalSegment(nsRenderingContext& aRenderingContext)
 {
   BCBorderOwner borderOwner = eCellOwner;
   BCBorderOwner ignoreBorderOwner;
   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];
   if (!verSeg.mCol) { // on the first damaged row and the first segment in the
                       // col
     verSeg.Initialize(*this);
     verSeg.Start(*this, borderOwner, verSegWidth, horSegHeight);
   }
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -287,17 +287,17 @@ public:
    *  continue along the length of the whole left side.
    *  see nsTablePainter about continuous borders
    */
   nscoord GetContinuousLeftBCBorderWidth() const;
   void SetContinuousLeftBCBorderWidth(nscoord aValue);
 
   friend class nsDelayedCalcBCBorders;
   
-  void AddBCDamageArea(const nsRect& aValue);
+  void AddBCDamageArea(const nsIntRect& aValue);
   bool BCRecalcNeeded(nsStyleContext* aOldStyleContext,
                         nsStyleContext* aNewStyleContext);
   void PaintBCBorders(nsRenderingContext& aRenderingContext,
                       const nsRect&        aDirtyRect);
 
   virtual void MarkIntrinsicWidthsDirty();
   // For border-collapse tables, the caller must not add padding and
   // border to the results of these functions.
@@ -695,17 +695,17 @@ public:
 protected:
 
   void SetBorderCollapse(bool aValue);
 
   BCPropertyData* GetBCProperty(bool aCreateIfNecessary = false) const;
   void SetFullBCDamageArea();
   void CalcBCBorders();
 
-  void ExpandBCDamageArea(nsRect& aRect) const;
+  void ExpandBCDamageArea(nsIntRect& aRect) const;
 
   void SetColumnDimensions(nscoord         aHeight,
                            const nsMargin& aReflowState);
 
   PRInt32 CollectRows(nsIFrame*                   aFrame,
                       nsTArray<nsTableRowFrame*>& aCollection);
 
 public: /* ----- Cell Map public methods ----- */
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -133,17 +133,17 @@ nsTableRowFrame::SetPctHeight(float  aPc
   nscoord height = NS_MAX(0, NSToCoordRound(aPctValue * 100.0f));
   if (HasPctHeight()) {
     if ((height > mStylePctHeight) || aForce) {
       mStylePctHeight = height;
     }
   }
   else {
     mStylePctHeight = height;
-    if (height > 0.0f) {
+    if (height > 0) {
       SetHasPctHeight(true);
     }
   }
 }
 
 /* ----------- nsTableRowFrame ---------- */
 
 NS_QUERYFRAME_HEAD(nsTableRowFrame)
@@ -188,17 +188,17 @@ nsTableRowFrame::Init(nsIContent*      a
 nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
 {
   if (!aOldStyleContext) //avoid this on init
     return;
      
   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);
   }
 }
 
 NS_IMETHODIMP
 nsTableRowFrame::AppendFrames(ChildListID     aListID,
                               nsFrameList&    aFrameList)
 {
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1373,18 +1373,18 @@ nsTableRowGroupFrame::Reflow(nsPresConte
 nsTableRowGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
 {
   if (!aOldStyleContext) //avoid this on init
     return;
      
   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);
   }
 }
 
 NS_IMETHODIMP
 nsTableRowGroupFrame::AppendFrames(ChildListID     aListID,
                                    nsFrameList&    aFrameList)
 {