Title: [90603] trunk/Source/WebCore
Revision
90603
Author
e...@chromium.org
Date
2011-07-07 17:17:24 -0700 (Thu, 07 Jul 2011)

Log Message

Switch HitTestResult to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=64131

Reviewed by Eric Seidel.

No new tests, no functionality changes.

* page/MouseEventWithHitTestResults.cpp:
(WebCore::MouseEventWithHitTestResults::localPoint):
* page/MouseEventWithHitTestResults.h:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::HitTestResult):
(WebCore::HitTestResult::addNodeToRectBasedTestResult):
(WebCore::HitTestResult::rectForPoint):
* rendering/HitTestResult.h:
(WebCore::HitTestResult::point):
(WebCore::HitTestResult::localPoint):
(WebCore::HitTestResult::setPoint):
(WebCore::HitTestResult::setLocalPoint):
(WebCore::HitTestResult::rectForPoint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90602 => 90603)


--- trunk/Source/WebCore/ChangeLog	2011-07-07 23:54:57 UTC (rev 90602)
+++ trunk/Source/WebCore/ChangeLog	2011-07-08 00:17:24 UTC (rev 90603)
@@ -1,3 +1,26 @@
+2011-07-07  Emil A Eklund  <e...@chromium.org>
+
+        Switch HitTestResult to to new layout types
+        https://bugs.webkit.org/show_bug.cgi?id=64131
+
+        Reviewed by Eric Seidel.
+
+        No new tests, no functionality changes.
+
+        * page/MouseEventWithHitTestResults.cpp:
+        (WebCore::MouseEventWithHitTestResults::localPoint):
+        * page/MouseEventWithHitTestResults.h:
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::HitTestResult):
+        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
+        (WebCore::HitTestResult::rectForPoint):
+        * rendering/HitTestResult.h:
+        (WebCore::HitTestResult::point):
+        (WebCore::HitTestResult::localPoint):
+        (WebCore::HitTestResult::setPoint):
+        (WebCore::HitTestResult::setLocalPoint):
+        (WebCore::HitTestResult::rectForPoint):
+
 2011-07-07  Levi Weintraub  <le...@chromium.org>
 
         Switch remaining paint functions to new layout types

Modified: trunk/Source/WebCore/page/MouseEventWithHitTestResults.cpp (90602 => 90603)


--- trunk/Source/WebCore/page/MouseEventWithHitTestResults.cpp	2011-07-07 23:54:57 UTC (rev 90602)
+++ trunk/Source/WebCore/page/MouseEventWithHitTestResults.cpp	2011-07-08 00:17:24 UTC (rev 90603)
@@ -33,7 +33,7 @@
 {
 }
 
-const IntPoint MouseEventWithHitTestResults::localPoint() const
+const LayoutPoint MouseEventWithHitTestResults::localPoint() const
 {
     return m_hitTestResult.localPoint();
 }

Modified: trunk/Source/WebCore/page/MouseEventWithHitTestResults.h (90602 => 90603)


--- trunk/Source/WebCore/page/MouseEventWithHitTestResults.h	2011-07-07 23:54:57 UTC (rev 90602)
+++ trunk/Source/WebCore/page/MouseEventWithHitTestResults.h	2011-07-08 00:17:24 UTC (rev 90603)
@@ -34,7 +34,7 @@
 
     const PlatformMouseEvent& event() const { return m_event; }
     const HitTestResult& hitTestResult() const { return m_hitTestResult; }
-    const IntPoint localPoint() const;
+    const LayoutPoint localPoint() const;
     Scrollbar* scrollbar() const;
     bool isOverLink() const;
     bool isOverWidget() const { return m_hitTestResult.isOverWidget(); }

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (90602 => 90603)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2011-07-07 23:54:57 UTC (rev 90602)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2011-07-08 00:17:24 UTC (rev 90603)
@@ -55,7 +55,7 @@
 {
 }
 
-HitTestResult::HitTestResult(const IntPoint& point)
+HitTestResult::HitTestResult(const LayoutPoint& point)
     : m_point(point)
     , m_isOverWidget(false)
     , m_isRectBased(false)
@@ -66,7 +66,7 @@
 {
 }
 
-HitTestResult::HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
     : m_point(centerPoint)
     , m_isOverWidget(false)
     , m_topPadding(topPadding)
@@ -508,7 +508,7 @@
     return m_innerNonSharedNode->rendererIsEditable();
 }
 
-bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const IntRect& rect)
+bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint& pointInContainer, const LayoutRect& rect)
 {
     // If it is not a rect-based hit test, this method has to be no-op.
     // Return false, so the hit test stops.
@@ -539,7 +539,7 @@
     return !rect.contains(rectForPoint(pointInContainer));
 }
 
-bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const FloatRect& rect)
+bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint& 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.
@@ -590,16 +590,16 @@
     }
 }
 
-IntRect HitTestResult::rectForPoint(const IntPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
 {
-    IntPoint actualPoint(point);
-    actualPoint -= IntSize(leftPadding, topPadding);
+    LayoutPoint actualPoint(point);
+    actualPoint -= LayoutSize(leftPadding, topPadding);
 
     IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding);
     // As IntRect is left inclusive and right exclusive (seeing IntRect::contains(x, y)), adding "1".
     actualPadding += IntSize(1, 1);
 
-    return IntRect(actualPoint, actualPadding);
+    return LayoutRect(actualPoint, actualPadding);
 }
 
 const HitTestResult::NodeSet& HitTestResult::rectBasedTestResult() const

Modified: trunk/Source/WebCore/rendering/HitTestResult.h (90602 => 90603)


--- trunk/Source/WebCore/rendering/HitTestResult.h	2011-07-07 23:54:57 UTC (rev 90602)
+++ trunk/Source/WebCore/rendering/HitTestResult.h	2011-07-08 00:17:24 UTC (rev 90603)
@@ -21,9 +21,7 @@
 #define HitTestResult_h
 
 #include "FloatRect.h"
-#include "IntPoint.h"
-#include "IntRect.h"
-#include "IntSize.h"
+#include "LayoutTypes.h"
 #include "TextDirection.h"
 #include <wtf/Forward.h>
 #include <wtf/ListHashSet.h>
@@ -38,7 +36,6 @@
 class HTMLMediaElement;
 #endif
 class Image;
-class IntRect;
 class KURL;
 class Node;
 class Scrollbar;
@@ -48,17 +45,17 @@
     typedef ListHashSet<RefPtr<Node> > NodeSet;
 
     HitTestResult();
-    HitTestResult(const IntPoint&);
+    HitTestResult(const LayoutPoint&);
     // Pass non-negative padding values to perform a rect-based hit test.
-    HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
+    HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     HitTestResult(const HitTestResult&);
     ~HitTestResult();
     HitTestResult& operator=(const HitTestResult&);
 
     Node* innerNode() const { return m_innerNode.get(); }
     Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); }
-    IntPoint point() const { return m_point; }
-    IntPoint localPoint() const { return m_localPoint; }
+    LayoutPoint point() const { return m_point; }
+    LayoutPoint localPoint() const { return m_localPoint; }
     Element* URLElement() const { return m_innerURLElement.get(); }
     Scrollbar* scrollbar() const { return m_scrollbar.get(); }
     bool isOverWidget() const { return m_isOverWidget; }
@@ -67,8 +64,8 @@
 
     void setInnerNode(Node*);
     void setInnerNonSharedNode(Node*);
-    void setPoint(const IntPoint& p) { m_point = p; }
-    void setLocalPoint(const IntPoint& p) { m_localPoint = p; }
+    void setPoint(const LayoutPoint& p) { m_point = p; }
+    void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
     void setURLElement(Element*);
     void setScrollbar(Scrollbar*);
     void setIsOverWidget(bool b) { m_isOverWidget = b; }
@@ -103,8 +100,8 @@
 
     // Rect-based hit test related methods.
     bool isRectBasedTest() const { return m_isRectBased; }
-    IntRect rectForPoint(const IntPoint&) const;
-    static IntRect rectForPoint(const IntPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
+    LayoutRect rectForPoint(const LayoutPoint&) const;
+    static LayoutRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     int topPadding() const { return m_topPadding; }
     int rightPadding() const { return m_rightPadding; }
     int bottomPadding() const { return m_bottomPadding; }
@@ -112,8 +109,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*, const IntPoint& pointInContainer, const IntRect& = IntRect());
-    bool addNodeToRectBasedTestResult(Node*, const IntPoint& pointInContainer, const FloatRect&);
+    bool addNodeToRectBasedTestResult(Node*, const LayoutPoint& pointInContainer, const LayoutRect& = IntRect());
+    bool addNodeToRectBasedTestResult(Node*, const LayoutPoint& 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
@@ -130,9 +127,9 @@
 
     RefPtr<Node> m_innerNode;
     RefPtr<Node> m_innerNonSharedNode;
-    IntPoint m_point;
-    IntPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer.  Allows us to efficiently
-                           // determine where inside the renderer we hit on subsequent operations.
+    LayoutPoint m_point;
+    LayoutPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer. Allows us to efficiently
+                              // determine where inside the renderer we hit on subsequent operations.
     RefPtr<Element> m_innerURLElement;
     RefPtr<Scrollbar> m_scrollbar;
     bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example).
@@ -149,7 +146,7 @@
 // y = p.y() - topPadding
 // width = leftPadding + rightPadding + 1
 // height = topPadding + bottomPadding + 1
-inline IntRect HitTestResult::rectForPoint(const IntPoint& point) const
+inline LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point) const
 {
     return rectForPoint(point, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to