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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 unsigned leftPadding); | 70 unsigned leftPadding); |
71 HitTestResult(const HitTestRequest&, const HitTestLocation&); | 71 HitTestResult(const HitTestRequest&, const HitTestLocation&); |
72 HitTestResult(const HitTestResult&); | 72 HitTestResult(const HitTestResult&); |
73 ~HitTestResult(); | 73 ~HitTestResult(); |
74 HitTestResult& operator=(const HitTestResult&); | 74 HitTestResult& operator=(const HitTestResult&); |
75 DECLARE_TRACE(); | 75 DECLARE_TRACE(); |
76 | 76 |
77 bool equalForCacheability(const HitTestResult&) const; | 77 bool equalForCacheability(const HitTestResult&) const; |
78 void cacheValues(const HitTestResult&); | 78 void cacheValues(const HitTestResult&); |
79 | 79 |
80 // Populate this object based on another HitTestResult; similar to assignment | 80 // Populate this object based on another HitTestResult; similar to assignment
operator |
81 // operator but don't assign any of the request parameters. ie. This method | 81 // but don't assign any of the request parameters. ie. Thie method avoids sett
ing |
82 // avoids setting |m_hitTestLocation|, |m_hitTestRequest|. | 82 // |m_hitTestLocation|, |m_hitTestRequest|. |
83 void populateFromCachedResult(const HitTestResult&); | 83 void populateFromCachedResult(const HitTestResult&); |
84 | 84 |
85 // For point-based hit tests, these accessors provide information about the | 85 // For point-based hit tests, these accessors provide information about the no
de |
86 // node under the point. For rect-based hit tests they are meaningless | 86 // under the point. For rect-based hit tests they are meaningless (reflect the |
87 // (reflect the last candidate node observed in the rect). | 87 // last candidate node observed in the rect). |
88 // FIXME: Make these less error-prone for rect-based hit tests (center point | 88 // FIXME: Make these less error-prone for rect-based hit tests (center point o
r fail). |
89 // or fail). | |
90 Node* innerNode() const { return m_innerNode.get(); } | 89 Node* innerNode() const { return m_innerNode.get(); } |
91 Node* innerPossiblyPseudoNode() const { | 90 Node* innerPossiblyPseudoNode() const { |
92 return m_innerPossiblyPseudoNode.get(); | 91 return m_innerPossiblyPseudoNode.get(); |
93 } | 92 } |
94 Element* innerElement() const; | 93 Element* innerElement() const; |
95 | 94 |
96 // If innerNode is an image map or image map area, return the associated image | 95 // If innerNode is an image map or image map area, return the associated image
node. |
97 // node. | |
98 Node* innerNodeOrImageMapImage() const; | 96 Node* innerNodeOrImageMapImage() const; |
99 | 97 |
100 Element* URLElement() const { return m_innerURLElement.get(); } | 98 Element* URLElement() const { return m_innerURLElement.get(); } |
101 Scrollbar* scrollbar() const { return m_scrollbar.get(); } | 99 Scrollbar* scrollbar() const { return m_scrollbar.get(); } |
102 bool isOverWidget() const { return m_isOverWidget; } | 100 bool isOverWidget() const { return m_isOverWidget; } |
103 | 101 |
104 // Forwarded from HitTestLocation | 102 // Forwarded from HitTestLocation |
105 bool isRectBasedTest() const { return m_hitTestLocation.isRectBasedTest(); } | 103 bool isRectBasedTest() const { return m_hitTestLocation.isRectBasedTest(); } |
106 | 104 |
107 // The hit-tested point in the coordinates of the main frame. | 105 // The hit-tested point in the coordinates of the main frame. |
108 const LayoutPoint& pointInMainFrame() const { | 106 const LayoutPoint& pointInMainFrame() const { |
109 return m_hitTestLocation.point(); | 107 return m_hitTestLocation.point(); |
110 } | 108 } |
111 IntPoint roundedPointInMainFrame() const { | 109 IntPoint roundedPointInMainFrame() const { |
112 return roundedIntPoint(pointInMainFrame()); | 110 return roundedIntPoint(pointInMainFrame()); |
113 } | 111 } |
114 | 112 |
115 // The hit-tested point in the coordinates of the innerNode frame, the frame | 113 // The hit-tested point in the coordinates of the innerNode frame, the frame c
ontaining innerNode. |
116 // containing innerNode. | |
117 const LayoutPoint& pointInInnerNodeFrame() const { | 114 const LayoutPoint& pointInInnerNodeFrame() const { |
118 return m_pointInInnerNodeFrame; | 115 return m_pointInInnerNodeFrame; |
119 } | 116 } |
120 IntPoint roundedPointInInnerNodeFrame() const { | 117 IntPoint roundedPointInInnerNodeFrame() const { |
121 return roundedIntPoint(pointInInnerNodeFrame()); | 118 return roundedIntPoint(pointInInnerNodeFrame()); |
122 } | 119 } |
123 LocalFrame* innerNodeFrame() const; | 120 LocalFrame* innerNodeFrame() const; |
124 | 121 |
125 // The hit-tested point in the coordinates of the inner node. | 122 // The hit-tested point in the coordinates of the inner node. |
126 const LayoutPoint& localPoint() const { return m_localPoint; } | 123 const LayoutPoint& localPoint() const { return m_localPoint; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 ListBasedHitTestBehavior addNodeToListBasedTestResult( | 164 ListBasedHitTestBehavior addNodeToListBasedTestResult( |
168 Node*, | 165 Node*, |
169 const HitTestLocation&, | 166 const HitTestLocation&, |
170 const LayoutRect& = LayoutRect()); | 167 const LayoutRect& = LayoutRect()); |
171 ListBasedHitTestBehavior addNodeToListBasedTestResult(Node*, | 168 ListBasedHitTestBehavior addNodeToListBasedTestResult(Node*, |
172 const HitTestLocation&, | 169 const HitTestLocation&, |
173 const Region&); | 170 const Region&); |
174 | 171 |
175 void append(const HitTestResult&); | 172 void append(const HitTestResult&); |
176 | 173 |
177 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return | 174 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return *m_listB
asedTestResult. Lazy allocation makes |
178 // *m_listBasedTestResult. Lazy allocation makes sense because the NodeSet is | 175 // sense because the NodeSet is seldom necessary, and it's somewhat expensive
to allocate and initialize. This method does |
179 // seldom necessary, and it's somewhat expensive to allocate and initialize. | 176 // the same thing as mutableListBasedTestResult(), but here the return value i
s const. |
180 // This method does the same thing as mutableListBasedTestResult(), but here | |
181 // the return value is const. | |
182 const NodeSet& listBasedTestResult() const; | 177 const NodeSet& listBasedTestResult() const; |
183 | 178 |
184 // Collapse the rect-based test result into a single target at the specified | 179 // Collapse the rect-based test result into a single target at the specified l
ocation. |
185 // location. | |
186 void resolveRectBasedTest(Node* resolvedInnerNode, | 180 void resolveRectBasedTest(Node* resolvedInnerNode, |
187 const LayoutPoint& resolvedPointInMainFrame); | 181 const LayoutPoint& resolvedPointInMainFrame); |
188 | 182 |
189 private: | 183 private: |
190 NodeSet& mutableListBasedTestResult(); // See above. | 184 NodeSet& mutableListBasedTestResult(); // See above. |
191 HTMLMediaElement* mediaElement() const; | 185 HTMLMediaElement* mediaElement() const; |
192 | 186 |
193 HitTestLocation m_hitTestLocation; | 187 HitTestLocation m_hitTestLocation; |
194 HitTestRequest m_hitTestRequest; | 188 HitTestRequest m_hitTestRequest; |
195 bool m_cacheable; | 189 bool m_cacheable; |
196 | 190 |
197 Member<Node> m_innerNode; | 191 Member<Node> m_innerNode; |
198 Member<Node> m_innerPossiblyPseudoNode; | 192 Member<Node> m_innerPossiblyPseudoNode; |
199 // FIXME: Nothing changes this to a value different from m_hitTestLocation! | 193 // FIXME: Nothing changes this to a value different from m_hitTestLocation! |
200 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode | 194 LayoutPoint |
201 // frame coordinates. | 195 m_pointInInnerNodeFrame; // The hit-tested point in innerNode frame coord
inates. |
202 LayoutPoint m_localPoint; // A point in the local coordinate space of | 196 LayoutPoint |
203 // m_innerNode's layoutObject.Allows us to | 197 m_localPoint; // A point in the local coordinate space of m_innerNode's l
ayoutObject. Allows us to efficiently |
204 // efficiently determine where inside the | 198 // determine where inside the layoutObject we hit on subsequent operations. |
205 // layoutObject we hit on subsequent operations. | |
206 Member<Element> m_innerURLElement; | 199 Member<Element> m_innerURLElement; |
207 Member<Scrollbar> m_scrollbar; | 200 Member<Scrollbar> m_scrollbar; |
208 bool m_isOverWidget; // Returns true if we are over a widget (and not in the | 201 bool |
209 // border/padding area of a LayoutPart for example). | 202 m_isOverWidget; // Returns true if we are over a widget (and not in the b
order/padding area of a LayoutPart for example). |
210 | 203 |
211 mutable Member<NodeSet> m_listBasedTestResult; | 204 mutable Member<NodeSet> m_listBasedTestResult; |
212 }; | 205 }; |
213 | 206 |
214 } // namespace blink | 207 } // namespace blink |
215 | 208 |
216 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::HitTestResult); | 209 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::HitTestResult); |
217 | 210 |
218 #endif // HitTestResult_h | 211 #endif // HitTestResult_h |
OLD | NEW |