OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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()) | |
258 return WebImage(); | |
259 | |
260 RefPtr<Node> node = unwrap<Node>(); | |
261 | |
262 if (!(node->renderer() && node->renderer()->isImage())) | |
263 return WebImage(); | |
264 | |
265 WebCore::RenderImage* renderer = toRenderImage(node->renderer()); | |
266 WebCore::CachedImage* cachedImage = renderer->cachedImage(); | |
267 if (!cachedImage || cachedImage->errorOccurred()) | |
268 return WebImage(); | |
269 WebCore::Image* image = cachedImage->imageForRenderer(renderer); | |
esprehn
2013/07/25 22:52:03
This should be a method on HTMLImageElement and th
jamesr
2013/07/26 17:54:33
I don't follow. This line isn't reaching into the
| |
270 ASSERT(image); | |
271 | |
272 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); | |
273 if (!bitmap) | |
274 return WebImage(); | |
275 | |
276 return bitmap->bitmap(); | |
277 } | |
278 | |
254 WebNode::WebNode(const PassRefPtr<Node>& node) | 279 WebNode::WebNode(const PassRefPtr<Node>& node) |
255 : m_private(node) | 280 : m_private(node) |
256 { | 281 { |
257 } | 282 } |
258 | 283 |
259 WebNode& WebNode::operator=(const PassRefPtr<Node>& node) | 284 WebNode& WebNode::operator=(const PassRefPtr<Node>& node) |
260 { | 285 { |
261 m_private = node; | 286 m_private = node; |
262 return *this; | 287 return *this; |
263 } | 288 } |
264 | 289 |
265 WebNode::operator PassRefPtr<Node>() const | 290 WebNode::operator PassRefPtr<Node>() const |
266 { | 291 { |
267 return m_private.get(); | 292 return m_private.get(); |
268 } | 293 } |
269 | 294 |
270 } // namespace WebKit | 295 } // namespace WebKit |
OLD | NEW |