| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 IntRect HitTestResult::imageRect() const | 278 IntRect HitTestResult::imageRect() const |
| 279 { | 279 { |
| 280 if (!image()) | 280 if (!image()) |
| 281 return IntRect(); | 281 return IntRect(); |
| 282 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou
ndingBox(); | 282 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou
ndingBox(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 KURL HitTestResult::absoluteImageURL() const | 285 KURL HitTestResult::absoluteImageURL() const |
| 286 { | 286 { |
| 287 return absoluteImageURLInternal(false); |
| 288 } |
| 289 |
| 290 KURL HitTestResult::absoluteImageURLIncludingCanvasDataURL() const |
| 291 { |
| 292 return absoluteImageURLInternal(true); |
| 293 } |
| 294 |
| 295 KURL HitTestResult::absoluteImageURLInternal(bool allowCanvas) const |
| 296 { |
| 287 if (!m_innerNonSharedNode) | 297 if (!m_innerNonSharedNode) |
| 288 return KURL(); | 298 return KURL(); |
| 289 | 299 |
| 290 RenderObject* renderer = m_innerNonSharedNode->renderer(); | 300 RenderObject* renderer = m_innerNonSharedNode->renderer(); |
| 291 if (!(renderer && (renderer->isImage() || renderer->isCanvas()))) | 301 if (!(renderer && (renderer->isImage() || renderer->isCanvas()))) |
| 292 return KURL(); | 302 return KURL(); |
| 293 | 303 |
| 294 AtomicString urlString; | 304 AtomicString urlString; |
| 295 if (isHTMLCanvasElement(*m_innerNonSharedNode) | 305 if ((allowCanvas && isHTMLCanvasElement(*m_innerNonSharedNode)) |
| 296 || isHTMLEmbedElement(*m_innerNonSharedNode) | 306 || isHTMLEmbedElement(*m_innerNonSharedNode) |
| 297 || isHTMLImageElement(*m_innerNonSharedNode) | 307 || isHTMLImageElement(*m_innerNonSharedNode) |
| 298 || isHTMLInputElement(*m_innerNonSharedNode) | 308 || isHTMLInputElement(*m_innerNonSharedNode) |
| 299 || isHTMLObjectElement(*m_innerNonSharedNode) | 309 || isHTMLObjectElement(*m_innerNonSharedNode) |
| 300 || isSVGImageElement(*m_innerNonSharedNode) | 310 || isSVGImageElement(*m_innerNonSharedNode) |
| 301 ) { | 311 ) { |
| 302 urlString = toElement(*m_innerNonSharedNode).imageSourceURL(); | 312 urlString = toElement(*m_innerNonSharedNode).imageSourceURL(); |
| 303 } else | 313 } else |
| 304 return KURL(); | 314 return KURL(); |
| 305 | 315 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 { | 477 { |
| 468 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) { | 478 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) { |
| 469 if (node->isElementNode()) | 479 if (node->isElementNode()) |
| 470 return toElement(node); | 480 return toElement(node); |
| 471 } | 481 } |
| 472 | 482 |
| 473 return 0; | 483 return 0; |
| 474 } | 484 } |
| 475 | 485 |
| 476 } // namespace blink | 486 } // namespace blink |
| OLD | NEW |