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

Side by Side Diff: Source/web/WebNode.cpp

Issue 19856004: Adds WebElement::imageContents() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: put image fetching logic in WebCore::Element, add basic smoke test Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/web/tests/WebFrameTest.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "WebPluginContainer.h" 42 #include "WebPluginContainer.h"
43 #include "WebPluginContainerImpl.h" 43 #include "WebPluginContainerImpl.h"
44 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
45 #include "core/dom/Element.h" 45 #include "core/dom/Element.h"
46 #include "core/dom/Event.h" 46 #include "core/dom/Event.h"
47 #include "core/dom/Node.h" 47 #include "core/dom/Node.h"
48 #include "core/dom/NodeList.h" 48 #include "core/dom/NodeList.h"
49 #include "core/editing/markup.h" 49 #include "core/editing/markup.h"
50 #include "core/page/Frame.h" 50 #include "core/page/Frame.h"
51 #include "core/platform/Widget.h" 51 #include "core/platform/Widget.h"
52 #include "core/rendering/RenderImage.h"
52 #include "core/rendering/RenderObject.h" 53 #include "core/rendering/RenderObject.h"
53 #include "core/rendering/RenderWidget.h" 54 #include "core/rendering/RenderWidget.h"
54 #include "public/platform/WebString.h" 55 #include "public/platform/WebString.h"
55 #include "public/platform/WebVector.h" 56 #include "public/platform/WebVector.h"
56 57
57 using namespace WebCore; 58 using namespace WebCore;
58 59
59 namespace WebKit { 60 namespace WebKit {
60 61
61 void WebNode::reset() 62 void WebNode::reset()
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 245 }
245 246
246 WebElement WebNode::shadowHost() const 247 WebElement WebNode::shadowHost() const
247 { 248 {
248 if (isNull()) 249 if (isNull())
249 return WebElement(); 250 return WebElement();
250 const Node* coreNode = constUnwrap<Node>(); 251 const Node* coreNode = constUnwrap<Node>();
251 return WebElement(coreNode->shadowHost()); 252 return WebElement(coreNode->shadowHost());
252 } 253 }
253 254
255 WebImage WebNode::imageContents()
256 {
257 if (isNull() || !m_private->isElementNode())
258 return WebImage();
259
260 RefPtr<Element> element = unwrap<Element>();
darin (slow to review) 2013/07/30 05:02:41 nit: perhaps we should have just put this method o
261
262 WebCore::Image* image = element->imageContents();
263 if (!image)
264 return WebImage();
265
266 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame();
267 if (!bitmap)
268 return WebImage();
269
270 return bitmap->bitmap();
271 }
272
254 WebNode::WebNode(const PassRefPtr<Node>& node) 273 WebNode::WebNode(const PassRefPtr<Node>& node)
255 : m_private(node) 274 : m_private(node)
256 { 275 {
257 } 276 }
258 277
259 WebNode& WebNode::operator=(const PassRefPtr<Node>& node) 278 WebNode& WebNode::operator=(const PassRefPtr<Node>& node)
260 { 279 {
261 m_private = node; 280 m_private = node;
262 return *this; 281 return *this;
263 } 282 }
264 283
265 WebNode::operator PassRefPtr<Node>() const 284 WebNode::operator PassRefPtr<Node>() const
266 { 285 {
267 return m_private.get(); 286 return m_private.get();
268 } 287 }
269 288
270 } // namespace WebKit 289 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698