OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 visitor->trace(m_scrollbar); | 117 visitor->trace(m_scrollbar); |
118 #if ENABLE(OILPAN) | 118 #if ENABLE(OILPAN) |
119 visitor->trace(m_rectBasedTestResult); | 119 visitor->trace(m_rectBasedTestResult); |
120 #endif | 120 #endif |
121 } | 121 } |
122 | 122 |
123 PositionWithAffinity HitTestResult::position() const | 123 PositionWithAffinity HitTestResult::position() const |
124 { | 124 { |
125 if (!m_innerPossiblyPseudoNode) | 125 if (!m_innerPossiblyPseudoNode) |
126 return PositionWithAffinity(); | 126 return PositionWithAffinity(); |
127 RenderObject* renderer = this->renderer(); | 127 LayoutObject* renderer = this->renderer(); |
128 if (!renderer) | 128 if (!renderer) |
129 return PositionWithAffinity(); | 129 return PositionWithAffinity(); |
130 if (m_innerPossiblyPseudoNode->isPseudoElement() && m_innerPossiblyPseudoNod
e->pseudoId() == BEFORE) | 130 if (m_innerPossiblyPseudoNode->isPseudoElement() && m_innerPossiblyPseudoNod
e->pseudoId() == BEFORE) |
131 return Position(m_innerNode, Position::PositionIsBeforeChildren).downstr
eam(); | 131 return Position(m_innerNode, Position::PositionIsBeforeChildren).downstr
eam(); |
132 return renderer->positionForPoint(localPoint()); | 132 return renderer->positionForPoint(localPoint()); |
133 } | 133 } |
134 | 134 |
135 RenderObject* HitTestResult::renderer() const | 135 LayoutObject* HitTestResult::renderer() const |
136 { | 136 { |
137 return m_innerNode ? m_innerNode->renderer() : 0; | 137 return m_innerNode ? m_innerNode->renderer() : 0; |
138 } | 138 } |
139 | 139 |
140 void HitTestResult::setToShadowHostIfInUserAgentShadowRoot() | 140 void HitTestResult::setToShadowHostIfInUserAgentShadowRoot() |
141 { | 141 { |
142 if (Node* node = innerNode()) { | 142 if (Node* node = innerNode()) { |
143 if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { | 143 if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { |
144 if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) | 144 if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) |
145 setInnerNode(node->shadowHost()); | 145 setInnerNode(node->shadowHost()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 dir = LTR; | 203 dir = LTR; |
204 // Return the tool tip string associated with this point, if any. Only marke
rs associated with bad grammar | 204 // Return the tool tip string associated with this point, if any. Only marke
rs associated with bad grammar |
205 // currently supply strings, but maybe someday markers associated with missp
elled words will also. | 205 // currently supply strings, but maybe someday markers associated with missp
elled words will also. |
206 if (!m_innerNonSharedNode) | 206 if (!m_innerNonSharedNode) |
207 return String(); | 207 return String(); |
208 | 208 |
209 DocumentMarker* marker = m_innerNonSharedNode->document().markers().markerCo
ntainingPoint(m_hitTestLocation.point(), DocumentMarker::Grammar); | 209 DocumentMarker* marker = m_innerNonSharedNode->document().markers().markerCo
ntainingPoint(m_hitTestLocation.point(), DocumentMarker::Grammar); |
210 if (!marker) | 210 if (!marker) |
211 return String(); | 211 return String(); |
212 | 212 |
213 if (RenderObject* renderer = m_innerNonSharedNode->renderer()) | 213 if (LayoutObject* renderer = m_innerNonSharedNode->renderer()) |
214 dir = renderer->style()->direction(); | 214 dir = renderer->style()->direction(); |
215 return marker->description(); | 215 return marker->description(); |
216 } | 216 } |
217 | 217 |
218 String HitTestResult::title(TextDirection& dir) const | 218 String HitTestResult::title(TextDirection& dir) const |
219 { | 219 { |
220 dir = LTR; | 220 dir = LTR; |
221 // Find the title in the nearest enclosing DOM node. | 221 // Find the title in the nearest enclosing DOM node. |
222 // For <area> tags in image maps, walk the tree for the <area>, not the <img
> using it. | 222 // For <area> tags in image maps, walk the tree for the <area>, not the <img
> using it. |
223 for (Node* titleNode = m_innerNode.get(); titleNode; titleNode = titleNode->
parentNode()) { | 223 for (Node* titleNode = m_innerNode.get(); titleNode; titleNode = titleNode->
parentNode()) { |
224 if (titleNode->isElementNode()) { | 224 if (titleNode->isElementNode()) { |
225 String title = toElement(titleNode)->title(); | 225 String title = toElement(titleNode)->title(); |
226 if (!title.isNull()) { | 226 if (!title.isNull()) { |
227 if (RenderObject* renderer = titleNode->renderer()) | 227 if (LayoutObject* renderer = titleNode->renderer()) |
228 dir = renderer->style()->direction(); | 228 dir = renderer->style()->direction(); |
229 return title; | 229 return title; |
230 } | 230 } |
231 } | 231 } |
232 } | 232 } |
233 return String(); | 233 return String(); |
234 } | 234 } |
235 | 235 |
236 const AtomicString& HitTestResult::altDisplayString() const | 236 const AtomicString& HitTestResult::altDisplayString() const |
237 { | 237 { |
(...skipping 11 matching lines...) Expand all Loading... |
249 } | 249 } |
250 | 250 |
251 return nullAtom; | 251 return nullAtom; |
252 } | 252 } |
253 | 253 |
254 Image* HitTestResult::image() const | 254 Image* HitTestResult::image() const |
255 { | 255 { |
256 if (!m_innerNonSharedNode) | 256 if (!m_innerNonSharedNode) |
257 return 0; | 257 return 0; |
258 | 258 |
259 RenderObject* renderer = m_innerNonSharedNode->renderer(); | 259 LayoutObject* renderer = m_innerNonSharedNode->renderer(); |
260 if (renderer && renderer->isImage()) { | 260 if (renderer && renderer->isImage()) { |
261 RenderImage* image = toRenderImage(renderer); | 261 RenderImage* image = toRenderImage(renderer); |
262 if (image->cachedImage() && !image->cachedImage()->errorOccurred()) | 262 if (image->cachedImage() && !image->cachedImage()->errorOccurred()) |
263 return image->cachedImage()->imageForRenderer(image); | 263 return image->cachedImage()->imageForRenderer(image); |
264 } | 264 } |
265 | 265 |
266 return 0; | 266 return 0; |
267 } | 267 } |
268 | 268 |
269 IntRect HitTestResult::imageRect() const | 269 IntRect HitTestResult::imageRect() const |
270 { | 270 { |
271 if (!image()) | 271 if (!image()) |
272 return IntRect(); | 272 return IntRect(); |
273 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou
ndingBox(); | 273 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou
ndingBox(); |
274 } | 274 } |
275 | 275 |
276 KURL HitTestResult::absoluteImageURL() const | 276 KURL HitTestResult::absoluteImageURL() const |
277 { | 277 { |
278 if (!m_innerNonSharedNode) | 278 if (!m_innerNonSharedNode) |
279 return KURL(); | 279 return KURL(); |
280 | 280 |
281 RenderObject* renderer = m_innerNonSharedNode->renderer(); | 281 LayoutObject* renderer = m_innerNonSharedNode->renderer(); |
282 if (!(renderer && renderer->isImage())) | 282 if (!(renderer && renderer->isImage())) |
283 return KURL(); | 283 return KURL(); |
284 | 284 |
285 AtomicString urlString; | 285 AtomicString urlString; |
286 if (isHTMLEmbedElement(*m_innerNonSharedNode) | 286 if (isHTMLEmbedElement(*m_innerNonSharedNode) |
287 || isHTMLImageElement(*m_innerNonSharedNode) | 287 || isHTMLImageElement(*m_innerNonSharedNode) |
288 || isHTMLInputElement(*m_innerNonSharedNode) | 288 || isHTMLInputElement(*m_innerNonSharedNode) |
289 || isHTMLObjectElement(*m_innerNonSharedNode) | 289 || isHTMLObjectElement(*m_innerNonSharedNode) |
290 || isSVGImageElement(*m_innerNonSharedNode)) { | 290 || isSVGImageElement(*m_innerNonSharedNode)) { |
291 urlString = toElement(*m_innerNonSharedNode).imageSourceURL(); | 291 urlString = toElement(*m_innerNonSharedNode).imageSourceURL(); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 { | 466 { |
467 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(*node)) { | 467 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(*node)) { |
468 if (node->isElementNode()) | 468 if (node->isElementNode()) |
469 return toElement(node); | 469 return toElement(node); |
470 } | 470 } |
471 | 471 |
472 return 0; | 472 return 0; |
473 } | 473 } |
474 | 474 |
475 } // namespace blink | 475 } // namespace blink |
OLD | NEW |