Title: [87018] trunk/Source/WebCore
Revision
87018
Author
[email protected]
Date
2011-05-21 06:54:31 -0700 (Sat, 21 May 2011)

Log Message

2011-05-21  Emil A Eklund  <[email protected]>

        Reviewed by Eric Seidel.

        Change HitTestResult to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=61230

        Covered by existing tests.

        * rendering/EllipsisBox.cpp:
        (WebCore::EllipsisBox::nodeAtPoint):
        * rendering/HitTestResult.cpp:
        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
        * rendering/HitTestResult.h:
        (WebCore::HitTestResult::isRectBasedTest):
        * rendering/InlineFlowBox.cpp:
        (WebCore::InlineFlowBox::nodeAtPoint):
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::nodeAtPoint):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::nodeAtPoint):
        (WebCore::RenderBlock::hitTestColumns):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::nodeAtPoint):
        * rendering/RenderTable.cpp:
        (WebCore::RenderTable::nodeAtPoint):
        * rendering/svg/RenderSVGRoot.cpp:
        (WebCore::RenderSVGRoot::nodeAtPoint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87017 => 87018)


--- trunk/Source/WebCore/ChangeLog	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/ChangeLog	2011-05-21 13:54:31 UTC (rev 87018)
@@ -1,3 +1,32 @@
+2011-05-21  Emil A Eklund  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Change HitTestResult to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=61230
+
+        Covered by existing tests.
+
+        * rendering/EllipsisBox.cpp:
+        (WebCore::EllipsisBox::nodeAtPoint):
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
+        * rendering/HitTestResult.h:
+        (WebCore::HitTestResult::isRectBasedTest):
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::nodeAtPoint):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::nodeAtPoint):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::nodeAtPoint):
+        (WebCore::RenderBlock::hitTestColumns):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::nodeAtPoint):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::nodeAtPoint):
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::nodeAtPoint):
+
 2011-05-21  Jochen Eisinger  <[email protected]>
 
         Reviewed by Darin Fisher.

Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/EllipsisBox.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -118,7 +118,7 @@
     IntRect boundsRect = IntRect(tx, ty, m_logicalWidth, m_height);
     if (visibleToHitTesting() && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
         renderer()->updateHitTestResult(result, pointInContainer - IntSize(tx, ty));
-        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
+        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, boundsRect))
             return true;
     }
 

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -508,7 +508,7 @@
     return m_innerNonSharedNode->rendererIsEditable();
 }
 
-bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const IntRect& rect)
+bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const IntRect& rect)
 {
     // If it is not a rect-based hit test, this method has to be no-op.
     // Return false, so the hit test stops.
@@ -536,10 +536,10 @@
                 mutableRectBasedTestResult().add(currInline->node()->shadowAncestorNode());
         }
     }
-    return !rect.contains(rectForPoint(x, y));
+    return !rect.contains(rectForPoint(pointInContainer));
 }
 
-bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const FloatRect& rect)
+bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const FloatRect& rect)
 {
     // If it is not a rect-based hit test, this method has to be no-op.
     // Return false, so the hit test stops.
@@ -567,7 +567,7 @@
                 mutableRectBasedTestResult().add(currInline->node()->shadowAncestorNode());
         }
     }
-    return !rect.contains(rectForPoint(x, y));
+    return !rect.contains(rectForPoint(pointInContainer));
 }
 
 void HitTestResult::append(const HitTestResult& other)

Modified: trunk/Source/WebCore/rendering/HitTestResult.h (87017 => 87018)


--- trunk/Source/WebCore/rendering/HitTestResult.h	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/HitTestResult.h	2011-05-21 13:54:31 UTC (rev 87018)
@@ -103,7 +103,6 @@
 
     // Rect-based hit test related methods.
     bool isRectBasedTest() const { return m_isRectBased; }
-    IntRect rectForPoint(int x, int y) const;
     IntRect rectForPoint(const IntPoint&) const;
     static IntRect rectForPoint(const IntPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     int topPadding() const { return m_topPadding; }
@@ -113,8 +112,8 @@
 
     // Returns true if it is rect-based hit test and needs to continue until the rect is fully
     // enclosed by the boundaries of a node.
-    bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& = IntRect());
-    bool addNodeToRectBasedTestResult(Node*, int x, int y, const FloatRect&);
+    bool addNodeToRectBasedTestResult(Node*, const IntPoint& pointInContainer, const IntRect& = IntRect());
+    bool addNodeToRectBasedTestResult(Node*, const IntPoint& pointInContainer, const FloatRect&);
     void append(const HitTestResult&);
 
     // If m_rectBasedTestResult is 0 then set it to a new NodeSet. Return *m_rectBasedTestResult. Lazy allocation makes
@@ -145,11 +144,6 @@
     mutable OwnPtr<NodeSet> m_rectBasedTestResult;
 };
 
-inline IntRect HitTestResult::rectForPoint(int x, int y) const
-{
-    return rectForPoint(IntPoint(x, y), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
-}
-
 // Formula:
 // x = p.x() - rightPadding
 // y = p.y() - topPadding

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -939,7 +939,7 @@
 
     if (visibleToHitTesting() && rect.intersects(result.rectForPoint(pointInContainer))) {
         renderer()->updateHitTestResult(result, flipForWritingMode(pointInContainer - IntSize(tx, ty))); // Don't add in m_x or m_y here, we want coords in the containing block's space.
-        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer.x(), pointInContainer.y(), rect))
+        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, rect))
             return true;
     }
     

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -350,7 +350,7 @@
     FloatRect rect(boxOrigin, IntSize(width(), height()));
     if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectForPoint(pointInContainer))) {
         renderer()->updateHitTestResult(result, flipForWritingMode(pointInContainer - IntSize(tx, ty)));
-        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer.x(), pointInContainer.y(), rect))
+        if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, rect))
             return true;
     }
     return false;

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -3912,7 +3912,7 @@
     if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) && isPointInOverflowControl(result, pointInContainer.x(), pointInContainer.y(), localOffset.width(), localOffset.height())) {
         updateHitTestResult(result, pointInContainer - localOffset);
         // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet.
-        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y()))
+        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer))
            return true;
     }
 
@@ -3947,7 +3947,7 @@
         IntRect boundsRect(localOffset.width(), localOffset.height(), width(), height());
         if (visibleToHitTesting() && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
             updateHitTestResult(result, flipForWritingMode(pointInContainer - localOffset));
-            if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
+            if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
                 return true;
         }
     }
@@ -4014,14 +4014,14 @@
             currLogicalTopOffset += blockDelta;
         colRect.move(tx, ty);
         
-        if (colRect.intersects(result.rectForPoint(x, y))) {
+        if (colRect.intersects(result.rectForPoint(IntPoint(x, y)))) {
             // The point is inside this column.
             // Adjust tx and ty to change where we hit test.
         
             IntSize offset = isHorizontal ? IntSize(currLogicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, currLogicalLeftOffset);
             int finalX = tx + offset.width();
             int finalY = ty + offset.height();
-            if (result.isRectBasedTest() && !colRect.contains(result.rectForPoint(x, y)))
+            if (result.isRectBasedTest() && !colRect.contains(result.rectForPoint(IntPoint(x, y))))
                 hitTestContents(request, result, x, y, finalX, finalY, hitTestAction);
             else
                 return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction) || (hitTestAction == HitTestFloat && hitTestFloats(request, result, x, y, finalX, finalY));

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -758,7 +758,7 @@
     IntRect boundsRect = IntRect(tx, ty, width(), height());
     if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
         updateHitTestResult(result, pointInContainer - IntSize(tx, ty));
-        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
+        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
             return true;
     }
 

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -1216,7 +1216,7 @@
     IntRect boundsRect = IntRect(tx, ty, width(), height());
     if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
         updateHitTestResult(result, flipForWritingMode(pointInContainer - IntSize(tx, ty)));
-        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer.x(), pointInContainer.y(), boundsRect))
+        if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
             return true;
     }
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (87017 => 87018)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2011-05-21 12:41:00 UTC (rev 87017)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2011-05-21 13:54:31 UTC (rev 87018)
@@ -334,7 +334,7 @@
             // FIXME: CSS/HTML assumes the local point is relative to the border box, right?
             updateHitTestResult(result, pointInBorderBox);
             // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
-            result.addNodeToRectBasedTestResult(child->node(), pointInContainer.x(), pointInContainer.y());
+            result.addNodeToRectBasedTestResult(child->node(), pointInContainer);
             return true;
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to