Title: [135710] trunk/Source/WebCore
Revision
135710
Author
allan.jen...@digia.com
Date
2012-11-26 05:54:02 -0800 (Mon, 26 Nov 2012)

Log Message

HitTestResult should not be a HitTestLocation
https://bugs.webkit.org/show_bug.cgi?id=101590

Reviewed by Sam Weinig.

Change HitTestResult from being a HitTestLocation to having a HitTestLocation.
A result of a test should not be a special case of the location of the test.

No change in functionality. No new tests.

* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::HitTestResult):
(WebCore::HitTestResult::operator=):
(WebCore::HitTestResult::isSelected):
(WebCore::HitTestResult::spellingToolTip):
(WebCore::HitTestResult::replacedString):
* rendering/HitTestResult.h:
(WebCore::HitTestResult::isRectBasedTest):
(WebCore::HitTestResult::pointInInnerNodeFrame):
(WebCore::HitTestResult::hitTestLocation):
(HitTestResult):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135709 => 135710)


--- trunk/Source/WebCore/ChangeLog	2012-11-26 13:41:20 UTC (rev 135709)
+++ trunk/Source/WebCore/ChangeLog	2012-11-26 13:54:02 UTC (rev 135710)
@@ -1,3 +1,27 @@
+2012-11-26  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        HitTestResult should not be a HitTestLocation
+        https://bugs.webkit.org/show_bug.cgi?id=101590
+
+        Reviewed by Sam Weinig.
+
+        Change HitTestResult from being a HitTestLocation to having a HitTestLocation. 
+        A result of a test should not be a special case of the location of the test.
+
+        No change in functionality. No new tests.
+
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::HitTestResult):
+        (WebCore::HitTestResult::operator=):
+        (WebCore::HitTestResult::isSelected):
+        (WebCore::HitTestResult::spellingToolTip):
+        (WebCore::HitTestResult::replacedString):
+        * rendering/HitTestResult.h:
+        (WebCore::HitTestResult::isRectBasedTest):
+        (WebCore::HitTestResult::pointInInnerNodeFrame):
+        (WebCore::HitTestResult::hitTestLocation):
+        (HitTestResult):
+
 2012-11-26  Marja Hölttä  <ma...@chromium.org>
 
         Circular reference between Document and MediaQueryMatcher.

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (135709 => 135710)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2012-11-26 13:41:20 UTC (rev 135709)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2012-11-26 13:54:02 UTC (rev 135710)
@@ -192,34 +192,34 @@
     return IntRect(actualPoint, actualPadding);
 }
 
-HitTestResult::HitTestResult() : HitTestLocation()
-    , m_isOverWidget(false)
+HitTestResult::HitTestResult()
+    : m_isOverWidget(false)
 {
 }
 
 HitTestResult::HitTestResult(const LayoutPoint& point)
-    : HitTestLocation(point)
+    : m_hitTestLocation(point)
     , m_pointInMainFrame(point)
     , m_isOverWidget(false)
 {
 }
 
 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
-    : HitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
+    : m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
     , m_pointInMainFrame(centerPoint)
     , m_isOverWidget(false)
 {
 }
 
 HitTestResult::HitTestResult(const HitTestLocation& other)
-    : HitTestLocation(other)
-    , m_pointInMainFrame(point())
+    : m_hitTestLocation(other)
+    , m_pointInMainFrame(m_hitTestLocation.point())
     , m_isOverWidget(false)
 {
 }
 
 HitTestResult::HitTestResult(const HitTestResult& other)
-    : HitTestLocation(other)
+    : m_hitTestLocation(other.m_hitTestLocation)
     , m_innerNode(other.innerNode())
     , m_innerNonSharedNode(other.innerNonSharedNode())
     , m_pointInMainFrame(other.m_pointInMainFrame)
@@ -238,7 +238,7 @@
 
 HitTestResult& HitTestResult::operator=(const HitTestResult& other)
 {
-    HitTestLocation::operator=(other);
+    m_hitTestLocation = other.m_hitTestLocation;
     m_innerNode = other.innerNode();
     m_innerNonSharedNode = other.innerNonSharedNode();
     m_pointInMainFrame = other.m_pointInMainFrame;
@@ -315,7 +315,7 @@
     if (!frame)
         return false;
 
-    return frame->selection()->contains(point());
+    return frame->selection()->contains(m_hitTestLocation.point());
 }
 
 String HitTestResult::spellingToolTip(TextDirection& dir) const
@@ -326,7 +326,7 @@
     if (!m_innerNonSharedNode)
         return String();
     
-    DocumentMarker* marker = m_innerNonSharedNode->document()->markers()->markerContainingPoint(point(), DocumentMarker::Grammar);
+    DocumentMarker* marker = m_innerNonSharedNode->document()->markers()->markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Grammar);
     if (!marker)
         return String();
 
@@ -342,7 +342,7 @@
     if (!m_innerNonSharedNode)
         return String();
     
-    DocumentMarker* marker = m_innerNonSharedNode->document()->markers()->markerContainingPoint(point(), DocumentMarker::Replacement);
+    DocumentMarker* marker = m_innerNonSharedNode->document()->markers()->markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Replacement);
     if (!marker)
         return String();
     

Modified: trunk/Source/WebCore/rendering/HitTestResult.h (135709 => 135710)


--- trunk/Source/WebCore/rendering/HitTestResult.h	2012-11-26 13:41:20 UTC (rev 135709)
+++ trunk/Source/WebCore/rendering/HitTestResult.h	2012-11-26 13:54:02 UTC (rev 135710)
@@ -45,6 +45,7 @@
 class RenderRegion;
 class Scrollbar;
 
+// FIXME: HitTestLocation should be moved to a separate file.
 class HitTestLocation {
 public:
 
@@ -100,8 +101,7 @@
     bool m_isRectilinear;
 };
 
-// FIXME: HitTestResult should not be a HitTestLocation, but instead have a HitTestLocation. See https://bugs.webkit.org/show_bug.cgi?id=101590
-class HitTestResult : protected HitTestLocation {
+class HitTestResult {
 public:
     typedef ListHashSet<RefPtr<Node> > NodeSet;
 
@@ -121,7 +121,7 @@
     bool isOverWidget() const { return m_isOverWidget; }
 
     // Forwarded from HitTestLocation
-    bool isRectBasedTest() const { return HitTestLocation::isRectBasedTest(); }
+    bool isRectBasedTest() const { return m_hitTestLocation.isRectBasedTest(); }
 
     // The hit-tested point in the coordinates of the main frame.
     const LayoutPoint& pointInMainFrame() const { return m_pointInMainFrame; }
@@ -129,7 +129,7 @@
     void setPointInMainFrame(const LayoutPoint& p) { m_pointInMainFrame = p; }
 
     // The hit-tested point in the coordinates of the innerNode frame, the frame containing innerNode.
-    const LayoutPoint& pointInInnerNodeFrame() const { return HitTestLocation::point(); }
+    const LayoutPoint& pointInInnerNodeFrame() const { return m_hitTestLocation.point(); }
     IntPoint roundedPointInInnerNodeFrame() const { return roundedIntPoint(pointInInnerNodeFrame()); }
     Frame* innerNodeFrame() const;
 
@@ -139,7 +139,7 @@
 
     void setToNonShadowAncestor();
 
-    const HitTestLocation& hitTestLocation() const { return *this; }
+    const HitTestLocation& hitTestLocation() const { return m_hitTestLocation; }
 
     void setInnerNode(Node*);
     void setInnerNonSharedNode(Node*);
@@ -198,6 +198,7 @@
 #if ENABLE(VIDEO)
     HTMLMediaElement* mediaElement() const;
 #endif
+    HitTestLocation m_hitTestLocation;
 
     RefPtr<Node> m_innerNode;
     RefPtr<Node> m_innerNonSharedNode;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to