2011-06-06 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jun 2011 23:21:20 +0000 (23:21 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jun 2011 23:21:20 +0000 (23:21 +0000)
        Reviewed by Eric Seidel.

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

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

        No new tests as this is simple refactoring.

        * rendering/RenderReplaced.cpp:
        (WebCore::RenderReplaced::paint):
        (WebCore::RenderReplaced::shouldPaint):
        * rendering/RenderReplaced.h:
        * rendering/RenderWidget.cpp:
        (WebCore::RenderWidget::paint):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderReplaced.h
Source/WebCore/rendering/RenderWidget.cpp

index 7bb934143f198d9e7694adfe27fdcb933b7b49ab..254b02d1de22e5a11297e2daa6ecdff5dbb1b59e 100644 (file)
@@ -1,3 +1,22 @@
+2011-06-06  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Switch shouldPaint to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=62158
+
+        Switching shouldPaint to take an IntPoint representing the paint offset instead
+        of a pair of ints.
+
+        No new tests as this is simple refactoring.
+
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::paint):
+        (WebCore::RenderReplaced::shouldPaint):
+        * rendering/RenderReplaced.h:
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::paint):
+
 2011-06-06  James Simonsen  <simonjam@chromium.org>
 
         Reviewed by James Robinson.
index bf389755d2e9480d9c7a9bac2ed5352e948a3e95..10487ef150cfca1c619238fd0743fda03a0649c1 100644 (file)
@@ -96,7 +96,7 @@ void RenderReplaced::intrinsicSizeChanged()
 
 void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
 {
-    if (!shouldPaint(paintInfo, tx, ty))
+    if (!shouldPaint(paintInfo, IntPoint(tx, ty)))
         return;
     
     tx += x();
@@ -156,7 +156,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
     }
 }
 
-bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, int& tx, int& ty)
+bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const IntPoint& paintOffset)
 {
     if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline 
             && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseMask)
@@ -169,21 +169,20 @@ bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, int& tx, int& ty)
     if (style()->visibility() != VISIBLE)
         return false;
 
-    int currentTX = tx + x();
-    int currentTY = ty + y();
+    IntPoint adjustedPaintOffset = paintOffset + location();
 
     // Early exit if the element touches the edges.
-    int top = currentTY + minYVisualOverflow();
-    int bottom = currentTY + maxYVisualOverflow();
+    int top = adjustedPaintOffset.y() + minYVisualOverflow();
+    int bottom = adjustedPaintOffset.y() + maxYVisualOverflow();
     if (isSelected() && m_inlineBoxWrapper) {
-        int selTop = ty + m_inlineBoxWrapper->root()->selectionTop();
-        int selBottom = ty + selTop + m_inlineBoxWrapper->root()->selectionHeight();
+        int selTop = paintOffset.y() + m_inlineBoxWrapper->root()->selectionTop();
+        int selBottom = paintOffset.y() + selTop + m_inlineBoxWrapper->root()->selectionHeight();
         top = min(selTop, top);
         bottom = max(selBottom, bottom);
     }
     
     int os = 2 * maximalOutlineSize(paintInfo.phase);
-    if (currentTX + minXVisualOverflow() >= paintInfo.rect.maxX() + os || currentTX + maxXVisualOverflow() <= paintInfo.rect.x() - os)
+    if (adjustedPaintOffset.x() + minXVisualOverflow() >= paintInfo.rect.maxX() + os || adjustedPaintOffset.x() + maxXVisualOverflow() <= paintInfo.rect.x() - os)
         return false;
     if (top >= paintInfo.rect.maxY() + os || bottom <= paintInfo.rect.y() - os)
         return false;
index 857adb4678c3bb0bb137ac2792a78a0b2ca63b44..a10fafbcc04ad6019ee40d885cc597c548843c05 100644 (file)
@@ -52,7 +52,7 @@ protected:
     void setHasIntrinsicSize() { m_hasIntrinsicSize = true; }
 
     virtual void paint(PaintInfo&, int tx, int ty);
-    bool shouldPaint(PaintInfo&, int& tx, int& ty);
+    bool shouldPaint(PaintInfo&, const IntPoint&);
     IntRect localSelectionRect(bool checkWhetherSelected = true) const; // This is in local coordinates, but it's a physical rect (so the top left corner is physical top left).
 
 private:
index b0c188727ae1a2948136ef0db1ce9ca81d4e0667..ee6370822a5e06702334223c1bb70059355a4635 100644 (file)
@@ -249,7 +249,7 @@ void RenderWidget::notifyWidget(WidgetNotification notification)
 
 void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
 {
-    if (!shouldPaint(paintInfo, tx, ty))
+    if (!shouldPaint(paintInfo, IntPoint(tx, ty)))
         return;
 
     tx += x();