Title: [88200] trunk/Source/WebCore
Revision
88200
Author
[email protected]
Date
2011-06-06 16:21:20 -0700 (Mon, 06 Jun 2011)

Log Message

2011-06-06  Levi Weintraub  <[email protected]>

        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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88199 => 88200)


--- trunk/Source/WebCore/ChangeLog	2011-06-06 23:04:58 UTC (rev 88199)
+++ trunk/Source/WebCore/ChangeLog	2011-06-06 23:21:20 UTC (rev 88200)
@@ -1,3 +1,22 @@
+2011-06-06  Levi Weintraub  <[email protected]>
+
+        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  <[email protected]>
 
         Reviewed by James Robinson.

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (88199 => 88200)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2011-06-06 23:04:58 UTC (rev 88199)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2011-06-06 23:21:20 UTC (rev 88200)
@@ -96,7 +96,7 @@
 
 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 @@
     }
 }
 
-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 @@
     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;

Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (88199 => 88200)


--- trunk/Source/WebCore/rendering/RenderReplaced.h	2011-06-06 23:04:58 UTC (rev 88199)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h	2011-06-06 23:21:20 UTC (rev 88200)
@@ -52,7 +52,7 @@
     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:

Modified: trunk/Source/WebCore/rendering/RenderWidget.cpp (88199 => 88200)


--- trunk/Source/WebCore/rendering/RenderWidget.cpp	2011-06-06 23:04:58 UTC (rev 88199)
+++ trunk/Source/WebCore/rendering/RenderWidget.cpp	2011-06-06 23:21:20 UTC (rev 88200)
@@ -249,7 +249,7 @@
 
 void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
 {
-    if (!shouldPaint(paintInfo, tx, ty))
+    if (!shouldPaint(paintInfo, IntPoint(tx, ty)))
         return;
 
     tx += x();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to