Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: Source/core/rendering/HitTestResult.cpp

Issue 530913003: Remove unnecessary codes (associated with save image feature) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/HitTestResult.h ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 {
297 if (!m_innerNonSharedNode) 287 if (!m_innerNonSharedNode)
298 return KURL(); 288 return KURL();
299 289
300 RenderObject* renderer = m_innerNonSharedNode->renderer(); 290 RenderObject* renderer = m_innerNonSharedNode->renderer();
301 if (!(renderer && (renderer->isImage() || renderer->isCanvas()))) 291 if (!(renderer && renderer->isImage()))
302 return KURL(); 292 return KURL();
303 293
304 AtomicString urlString; 294 AtomicString urlString;
305 if ((allowCanvas && isHTMLCanvasElement(*m_innerNonSharedNode)) 295 if (isHTMLEmbedElement(*m_innerNonSharedNode)
306 || isHTMLEmbedElement(*m_innerNonSharedNode)
307 || isHTMLImageElement(*m_innerNonSharedNode) 296 || isHTMLImageElement(*m_innerNonSharedNode)
308 || isHTMLInputElement(*m_innerNonSharedNode) 297 || isHTMLInputElement(*m_innerNonSharedNode)
309 || isHTMLObjectElement(*m_innerNonSharedNode) 298 || isHTMLObjectElement(*m_innerNonSharedNode)
310 || isSVGImageElement(*m_innerNonSharedNode) 299 || isSVGImageElement(*m_innerNonSharedNode)
311 ) { 300 ) {
312 urlString = toElement(*m_innerNonSharedNode).imageSourceURL(); 301 urlString = toElement(*m_innerNonSharedNode).imageSourceURL();
313 } else 302 } else
314 return KURL(); 303 return KURL();
315 304
316 return m_innerNonSharedNode->document().completeURL(stripLeadingAndTrailingH TMLSpaces(urlString)); 305 return m_innerNonSharedNode->document().completeURL(stripLeadingAndTrailingH TMLSpaces(urlString));
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 { 473 {
485 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { 474 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) {
486 if (node->isElementNode()) 475 if (node->isElementNode())
487 return toElement(node); 476 return toElement(node);
488 } 477 }
489 478
490 return 0; 479 return 0;
491 } 480 }
492 481
493 } // namespace blink 482 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/HitTestResult.h ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698