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

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

Issue 255563004: Implement "Save image as" for canvas (blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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/loader/NavigationPolicy.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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (!image()) 272 if (!image())
273 return IntRect(); 273 return IntRect();
274 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou ndingBox(); 274 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou ndingBox();
275 } 275 }
276 276
277 KURL HitTestResult::absoluteImageURL() const 277 KURL HitTestResult::absoluteImageURL() const
278 { 278 {
279 if (!m_innerNonSharedNode) 279 if (!m_innerNonSharedNode)
280 return KURL(); 280 return KURL();
281 281
282 if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()-> isImage())) 282 RenderObject* renderer = m_innerNonSharedNode->renderer();
283 if (!(renderer && (renderer->isImage() || renderer->isCanvas())))
283 return KURL(); 284 return KURL();
284 285
285 AtomicString urlString; 286 AtomicString urlString;
286 if (isHTMLEmbedElement(*m_innerNonSharedNode) 287 if (isHTMLCanvasElement(*m_innerNonSharedNode)
288 || isHTMLEmbedElement(*m_innerNonSharedNode)
287 || isHTMLImageElement(*m_innerNonSharedNode) 289 || isHTMLImageElement(*m_innerNonSharedNode)
288 || isHTMLInputElement(*m_innerNonSharedNode) 290 || isHTMLInputElement(*m_innerNonSharedNode)
289 || isHTMLObjectElement(*m_innerNonSharedNode) 291 || isHTMLObjectElement(*m_innerNonSharedNode)
290 || isSVGImageElement(*m_innerNonSharedNode) 292 || isSVGImageElement(*m_innerNonSharedNode)
291 ) { 293 ) {
292 urlString = toElement(*m_innerNonSharedNode).imageSourceURL(); 294 urlString = toElement(*m_innerNonSharedNode).imageSourceURL();
293 } else 295 } else
294 return KURL(); 296 return KURL();
295 297
296 return m_innerNonSharedNode->document().completeURL(stripLeadingAndTrailingH TMLSpaces(urlString)); 298 return m_innerNonSharedNode->document().completeURL(stripLeadingAndTrailingH TMLSpaces(urlString));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 { 487 {
486 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { 488 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) {
487 if (node->isElementNode()) 489 if (node->isElementNode())
488 return toElement(node); 490 return toElement(node);
489 } 491 }
490 492
491 return 0; 493 return 0;
492 } 494 }
493 495
494 } // namespace WebCore 496 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/NavigationPolicy.h ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698