Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / HitTestResult.h
index 7be5962..e0a8daf 100644 (file)
@@ -34,7 +34,7 @@
 #include "wtf/OwnPtr.h"
 #include "wtf/RefPtr.h"
 
-namespace WebCore {
+namespace blink {
 
 class Element;
 class LocalFrame;
@@ -43,6 +43,7 @@ class Image;
 class KURL;
 class Node;
 class RenderObject;
+class PositionWithAffinity;
 class Scrollbar;
 
 class HitTestResult {
@@ -60,6 +61,10 @@ public:
     HitTestResult& operator=(const HitTestResult&);
     void trace(Visitor*);
 
+    // For point-based hit tests, these accessors provide information about the node
+    // under the point. For rect-based hit tests they are meaningless (reflect the
+    // last candidate node observed in the rect).
+    // FIXME: Make these less error-prone for rect-based hit tests (center point or fail).
     Node* innerNode() const { return m_innerNode.get(); }
     Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get(); }
     Element* innerElement() const;
@@ -84,9 +89,9 @@ public:
     const LayoutPoint& localPoint() const { return m_localPoint; }
     void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
 
+    PositionWithAffinity position() const;
     RenderObject* renderer() const;
 
-    void setToNodesInDocumentTreeScope();
     void setToShadowHostIfInUserAgentShadowRoot();
 
     const HitTestLocation& hitTestLocation() const { return m_hitTestLocation; }
@@ -105,6 +110,9 @@ public:
     Image* image() const;
     IntRect imageRect() const;
     KURL absoluteImageURL() const;
+    // This variant of absoluteImageURL will also convert <canvas> elements
+    // to huge image data URLs (very expensive).
+    KURL absoluteImageURLIncludingCanvasDataURL() const;
     KURL absoluteMediaURL() const;
     KURL absoluteLinkURL() const;
     String textContent() const;
@@ -124,9 +132,14 @@ public:
     // the same thing as mutableRectBasedTestResult(), but here the return value is const.
     const NodeSet& rectBasedTestResult() const;
 
-    Node* targetNode() const;
+    // Collapse the rect-based test result into a single target at the specified location.
+    void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolvedPointInMainFrame);
+
+    // FIXME: Remove this.
+    Node* targetNode() const { return innerNode(); }
 
 private:
+    KURL absoluteImageURLInternal(bool allowCanvas) const;
     NodeSet& mutableRectBasedTestResult(); // See above.
     HTMLMediaElement* mediaElement() const;
 
@@ -135,6 +148,7 @@ private:
     RefPtrWillBeMember<Node> m_innerNode;
     RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode;
     RefPtrWillBeMember<Node> m_innerNonSharedNode;
+    // FIXME: Nothing changes this to a value different from m_hitTestLocation!
     LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode frame coordinates.
     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.
@@ -146,6 +160,6 @@ private:
     mutable OwnPtrWillBeMember<NodeSet> m_rectBasedTestResult;
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // HitTestResult_h