2011-06-03 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2011 20:59:40 +0000 (20:59 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2011 20:59:40 +0000 (20:59 +0000)
        Reviewed by Eric Seidel.

        Switch paintBackgroundsBehindCell to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=62031

        Switching paintBackgroundsBehindCell to take an IntPoint representing
        the paint offset instead of a pair of ints.

        No new tests as this is simple refactoring.

        * rendering/RenderTableCell.cpp:
        (WebCore::RenderTableCell::paintBackgroundsBehindCell):
        (WebCore::RenderTableCell::paintBoxDecorations):
        * rendering/RenderTableCell.h:
        * rendering/RenderTableRow.cpp:
        (WebCore::RenderTableRow::paint):
        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::paintCell):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88051 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableSection.cpp

index 868a8b88ead02c852f4bd127b0d6e7dc11e1522f..4d8fe7e93ed2c26facc38f41ed39eac73ba78968 100644 (file)
@@ -1,3 +1,24 @@
+2011-06-03  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Switch paintBackgroundsBehindCell to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=62031
+
+        Switching paintBackgroundsBehindCell to take an IntPoint representing
+        the paint offset instead of a pair of ints.
+
+        No new tests as this is simple refactoring.
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintBackgroundsBehindCell):
+        (WebCore::RenderTableCell::paintBoxDecorations):
+        * rendering/RenderTableCell.h:
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::paint):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::paintCell):
+
 2011-06-03  Levi Weintraub  <leviw@chromium.org>
 
         Reviewed by Eric Seidel.
index 8878480f80b920db1948224a1727b278d4579172..9324711c910782fb1356ce591673a3382a8aabf8 100644 (file)
@@ -961,7 +961,7 @@ void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, con
     }
 }
 
-void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, int ty, RenderObject* backgroundObject)
+void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, const IntPoint& paintOffset, RenderObject* backgroundObject)
 {
     if (!paintInfo.shouldPaintWithinRoot(this))
         return;
@@ -976,13 +976,9 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, i
     if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstChild())
         return;
 
-    if (backgroundObject != this) {
-        tx += x();
-        ty += y();
-    }
-
-    int w = width();
-    int h = height();
+    IntPoint adjustedPaintOffset = paintOffset;
+    if (backgroundObject != this)
+        adjustedPaintOffset.move(location());
 
     Color c = backgroundObject->style()->visitedDependentColor(CSSPropertyBackgroundColor);
     const FillLayer* bgLayer = backgroundObject->style()->backgroundLayers();
@@ -993,11 +989,11 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, i
         bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == this || backgroundObject == parent()) && tableElt->collapseBorders();
         GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip);
         if (shouldClip) {
-            IntRect clipRect(tx + borderLeft(), ty + borderTop(),
-                w - borderLeft() - borderRight(), h - borderTop() - borderBottom());
+            IntRect clipRect(adjustedPaintOffset.x() + borderLeft(), adjustedPaintOffset.y() + borderTop(),
+                width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
             paintInfo.context->clip(clipRect);
         }
-        paintFillLayers(paintInfo, c, bgLayer, IntRect(tx, ty, w, h), BackgroundBleedNone, CompositeSourceOver, backgroundObject);
+        paintFillLayers(paintInfo, c, bgLayer, IntRect(adjustedPaintOffset, size()), BackgroundBleedNone, CompositeSourceOver, backgroundObject);
     }
 }
 
@@ -1014,7 +1010,7 @@ void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, const IntPoint&
     paintBoxShadow(paintInfo.context, paintRect, style(), Normal);
     
     // Paint our cell background.
-    paintBackgroundsBehindCell(paintInfo, paintOffset.x(), paintOffset.y(), this);
+    paintBackgroundsBehindCell(paintInfo, paintOffset, this);
 
     paintBoxShadow(paintInfo.context, paintRect, style(), Inset);
 
index 6b8beb3347d4e248989a820863279e1b3d01433d..e57846fbef4e340704a81789cad8a29ddc3b073d 100644 (file)
@@ -96,7 +96,7 @@ public:
 
     virtual void paint(PaintInfo&, int tx, int ty);
 
-    void paintBackgroundsBehindCell(PaintInfo&, int tx, int ty, RenderObject* backgroundObject);
+    void paintBackgroundsBehindCell(PaintInfo&, const IntPoint&, RenderObject* backgroundObject);
 
     int cellBaselinePosition() const;
 
index a34d7b99837b3fafd1eae31f13f6a94c6b41b07a..bf433b5d5241b31221cb73633cb86bd13f17f78a 100644 (file)
@@ -218,7 +218,7 @@ void RenderTableRow::paint(PaintInfo& paintInfo, int tx, int ty)
             // Paint the row background behind the cell.
             if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackground) {
                 RenderTableCell* cell = toRenderTableCell(child);
-                cell->paintBackgroundsBehindCell(paintInfo, tx, ty, this);
+                cell->paintBackgroundsBehindCell(paintInfo, IntPoint(tx, ty), this);
             }
             if (!toRenderBox(child)->hasSelfPaintingLayer())
                 child->paint(paintInfo, tx, ty);
index ee57d6d2a1908f95eb2448add9d2a96b5d11b902..f8557a934271eee3c240ce17de802102201ef284 100644 (file)
@@ -933,16 +933,16 @@ void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo,
         // the stack, since we have already opened a transparency layer (potentially) for the table row group.
         // Note that we deliberately ignore whether or not the cell has a layer, since these backgrounds paint "behind" the
         // cell.
-        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), colGroup);
-        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), col);
+        cell->paintBackgroundsBehindCell(paintInfo, cellPoint, colGroup);
+        cell->paintBackgroundsBehindCell(paintInfo, cellPoint, col);
 
         // Paint the row group next.
-        cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), this);
+        cell->paintBackgroundsBehindCell(paintInfo, cellPoint, this);
 
         // Paint the row next, but only if it doesn't have a layer.  If a row has a layer, it will be responsible for
         // painting the row background for the cell.
         if (!row->hasSelfPaintingLayer())
-            cell->paintBackgroundsBehindCell(paintInfo, cellPoint.x(), cellPoint.y(), row);
+            cell->paintBackgroundsBehindCell(paintInfo, cellPoint, row);
     }
     if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()) || paintInfo.phase == PaintPhaseCollapsedTableBorders)
         cell->paint(paintInfo, cellPoint.x(), cellPoint.y());