| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 HitTestResult& operator=(const HitTestResult&); | 59 HitTestResult& operator=(const HitTestResult&); |
| 60 | 60 |
| 61 // For point-based hit tests, these accessors provide information about the
node | 61 // For point-based hit tests, these accessors provide information about the
node |
| 62 // under the point. For rect-based hit tests they are meaningless (reflect t
he | 62 // under the point. For rect-based hit tests they are meaningless (reflect t
he |
| 63 // last candidate node observed in the rect). | 63 // last candidate node observed in the rect). |
| 64 // FIXME: Make these less error-prone for rect-based hit tests (center point
or fail). | 64 // FIXME: Make these less error-prone for rect-based hit tests (center point
or fail). |
| 65 Node* innerNode() const { return m_innerNode.get(); } | 65 Node* innerNode() const { return m_innerNode.get(); } |
| 66 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get
(); } | 66 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get
(); } |
| 67 Element* innerElement() const; | 67 Element* innerElement() const; |
| 68 Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); } | 68 Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); } |
| 69 Element* URLElement() const { return m_innerURLElement.get(); } | |
| 70 bool isOverWidget() const { return m_isOverWidget; } | 69 bool isOverWidget() const { return m_isOverWidget; } |
| 71 | 70 |
| 72 // Forwarded from HitTestLocation | 71 // Forwarded from HitTestLocation |
| 73 bool isRectBasedTest() const { return m_hitTestLocation.isRectBasedTest(); } | 72 bool isRectBasedTest() const { return m_hitTestLocation.isRectBasedTest(); } |
| 74 | 73 |
| 75 // The hit-tested point in the coordinates of the main frame. | 74 // The hit-tested point in the coordinates of the main frame. |
| 76 const LayoutPoint& pointInMainFrame() const { return m_hitTestLocation.point
(); } | 75 const LayoutPoint& pointInMainFrame() const { return m_hitTestLocation.point
(); } |
| 77 IntPoint roundedPointInMainFrame() const { return roundedIntPoint(pointInMai
nFrame()); } | 76 IntPoint roundedPointInMainFrame() const { return roundedIntPoint(pointInMai
nFrame()); } |
| 78 | 77 |
| 79 // The hit-tested point in the coordinates of the innerNode frame, the frame
containing innerNode. | 78 // The hit-tested point in the coordinates of the innerNode frame, the frame
containing innerNode. |
| 80 const LayoutPoint& pointInInnerNodeFrame() const { return m_pointInInnerNode
Frame; } | 79 const LayoutPoint& pointInInnerNodeFrame() const { return m_pointInInnerNode
Frame; } |
| 81 IntPoint roundedPointInInnerNodeFrame() const { return roundedIntPoint(point
InInnerNodeFrame()); } | 80 IntPoint roundedPointInInnerNodeFrame() const { return roundedIntPoint(point
InInnerNodeFrame()); } |
| 82 LocalFrame* innerNodeFrame() const; | 81 LocalFrame* innerNodeFrame() const; |
| 83 | 82 |
| 84 // The hit-tested point in the coordinates of the inner node. | 83 // The hit-tested point in the coordinates of the inner node. |
| 85 const LayoutPoint& localPoint() const { return m_localPoint; } | 84 const LayoutPoint& localPoint() const { return m_localPoint; } |
| 86 void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; } | 85 void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; } |
| 87 | 86 |
| 88 PositionWithAffinity position() const; | 87 PositionWithAffinity position() const; |
| 89 RenderObject* renderer() const; | 88 RenderObject* renderer() const; |
| 90 | 89 |
| 91 const HitTestLocation& hitTestLocation() const { return m_hitTestLocation; } | 90 const HitTestLocation& hitTestLocation() const { return m_hitTestLocation; } |
| 92 | 91 |
| 93 void setInnerNode(Node*); | 92 void setInnerNode(Node*); |
| 94 void setInnerNonSharedNode(Node*); | 93 void setInnerNonSharedNode(Node*); |
| 95 void setURLElement(Element*); | |
| 96 void setIsOverWidget(bool b) { m_isOverWidget = b; } | |
| 97 | 94 |
| 98 bool isSelected() const; | 95 bool isSelected() const; |
| 99 Image* image() const; | 96 Image* image() const; |
| 100 IntRect imageRect() const; | 97 IntRect imageRect() const; |
| 101 KURL absoluteImageURL() const; | |
| 102 // This variant of absoluteImageURL will also convert <canvas> elements | |
| 103 // to huge image data URLs (very expensive). | |
| 104 KURL absoluteImageURLIncludingCanvasDataURL() const; | |
| 105 KURL absoluteLinkURL() const; | |
| 106 String textContent() const; | |
| 107 bool isLiveLink() const; | |
| 108 bool isMisspelled() const; | 98 bool isMisspelled() const; |
| 109 bool isContentEditable() const; | 99 bool isContentEditable() const; |
| 110 | 100 |
| 111 bool isOverLink() const; | |
| 112 // Returns true if it is rect-based hit test and needs to continue until the
rect is fully | 101 // Returns true if it is rect-based hit test and needs to continue until the
rect is fully |
| 113 // enclosed by the boundaries of a node. | 102 // enclosed by the boundaries of a node. |
| 114 bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTes
tLocation& pointInContainer, const LayoutRect& = LayoutRect()); | 103 bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTes
tLocation& pointInContainer, const LayoutRect& = LayoutRect()); |
| 115 bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTes
tLocation& pointInContainer, const FloatRect&); | 104 bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTes
tLocation& pointInContainer, const FloatRect&); |
| 116 void append(const HitTestResult&); | 105 void append(const HitTestResult&); |
| 117 | 106 |
| 118 // If m_rectBasedTestResult is 0 then set it to a new NodeSet. Return *m_rec
tBasedTestResult. Lazy allocation makes | 107 // If m_rectBasedTestResult is 0 then set it to a new NodeSet. Return *m_rec
tBasedTestResult. Lazy allocation makes |
| 119 // sense because the NodeSet is seldom necessary, and it's somewhat expensiv
e to allocate and initialize. This method does | 108 // sense because the NodeSet is seldom necessary, and it's somewhat expensiv
e to allocate and initialize. This method does |
| 120 // the same thing as mutableRectBasedTestResult(), but here the return value
is const. | 109 // the same thing as mutableRectBasedTestResult(), but here the return value
is const. |
| 121 const NodeSet& rectBasedTestResult() const; | 110 const NodeSet& rectBasedTestResult() const; |
| 122 | 111 |
| 123 // Collapse the rect-based test result into a single target at the specified
location. | 112 // Collapse the rect-based test result into a single target at the specified
location. |
| 124 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv
edPointInMainFrame); | 113 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv
edPointInMainFrame); |
| 125 | 114 |
| 126 // FIXME: Remove this. | 115 // FIXME: Remove this. |
| 127 Node* targetNode() const { return innerNode(); } | 116 Node* targetNode() const { return innerNode(); } |
| 128 | 117 |
| 129 private: | 118 private: |
| 130 KURL absoluteImageURLInternal(bool allowCanvas) const; | |
| 131 NodeSet& mutableRectBasedTestResult(); // See above. | 119 NodeSet& mutableRectBasedTestResult(); // See above. |
| 132 | 120 |
| 133 HitTestLocation m_hitTestLocation; | 121 HitTestLocation m_hitTestLocation; |
| 134 | 122 |
| 135 RefPtr<Node> m_innerNode; | 123 RefPtr<Node> m_innerNode; |
| 136 RefPtr<Node> m_innerPossiblyPseudoNode; | 124 RefPtr<Node> m_innerPossiblyPseudoNode; |
| 137 RefPtr<Node> m_innerNonSharedNode; | 125 RefPtr<Node> m_innerNonSharedNode; |
| 138 // FIXME: Nothing changes this to a value different from m_hitTestLocation! | 126 // FIXME: Nothing changes this to a value different from m_hitTestLocation! |
| 139 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode fr
ame coordinates. | 127 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode fr
ame coordinates. |
| 140 LayoutPoint m_localPoint; // A point in the local coordinate space of m_inne
rNonSharedNode's renderer. Allows us to efficiently | 128 LayoutPoint m_localPoint; // A point in the local coordinate space of m_inne
rNonSharedNode's renderer. Allows us to efficiently |
| 141 // determine where inside the renderer we hit on s
ubsequent operations. | 129 // determine where inside the renderer we hit on s
ubsequent operations. |
| 142 RefPtr<Element> m_innerURLElement; | |
| 143 bool m_isOverWidget; // Returns true if we are over a widget. | 130 bool m_isOverWidget; // Returns true if we are over a widget. |
| 144 | 131 |
| 145 mutable OwnPtr<NodeSet> m_rectBasedTestResult; | 132 mutable OwnPtr<NodeSet> m_rectBasedTestResult; |
| 146 }; | 133 }; |
| 147 | 134 |
| 148 } // namespace blink | 135 } // namespace blink |
| 149 | 136 |
| 150 #endif // SKY_ENGINE_CORE_RENDERING_HITTESTRESULT_H_ | 137 #endif // SKY_ENGINE_CORE_RENDERING_HITTESTRESULT_H_ |
| OLD | NEW |