OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 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 30 matching lines...) Expand all Loading... |
41 #include "core/editing/Editor.h" | 41 #include "core/editing/Editor.h" |
42 #include "core/editing/markup.h" | 42 #include "core/editing/markup.h" |
43 #include "core/html/parser/HTMLParserIdioms.h" | 43 #include "core/html/parser/HTMLParserIdioms.h" |
44 #include "core/loader/cache/CachedImage.h" | 44 #include "core/loader/cache/CachedImage.h" |
45 #include "core/page/Frame.h" | 45 #include "core/page/Frame.h" |
46 #include "core/platform/chromium/ClipboardChromium.h" | 46 #include "core/platform/chromium/ClipboardChromium.h" |
47 #include "core/platform/chromium/ClipboardUtilitiesChromium.h" | 47 #include "core/platform/chromium/ClipboardUtilitiesChromium.h" |
48 #include "core/platform/graphics/Image.h" | 48 #include "core/platform/graphics/Image.h" |
49 #include "core/platform/graphics/skia/NativeImageSkia.h" | 49 #include "core/platform/graphics/skia/NativeImageSkia.h" |
50 #include "core/rendering/RenderImage.h" | 50 #include "core/rendering/RenderImage.h" |
| 51 #include "core/svg/SVGImageElement.h" |
51 #include "public/platform/Platform.h" | 52 #include "public/platform/Platform.h" |
52 #include "public/platform/WebClipboard.h" | 53 #include "public/platform/WebClipboard.h" |
53 #include "public/platform/WebDragData.h" | 54 #include "public/platform/WebDragData.h" |
54 #include "weborigin/KURL.h" | 55 #include "weborigin/KURL.h" |
55 | 56 |
56 namespace WebCore { | 57 namespace WebCore { |
57 | 58 |
58 Pasteboard* Pasteboard::generalPasteboard() | 59 Pasteboard* Pasteboard::generalPasteboard() |
59 { | 60 { |
60 static Pasteboard* pasteboard = new Pasteboard; | 61 static Pasteboard* pasteboard = new Pasteboard; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 138 |
138 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); | 139 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); |
139 if (!bitmap) | 140 if (!bitmap) |
140 return; | 141 return; |
141 | 142 |
142 // If the image is wrapped in a link, |url| points to the target of the | 143 // If the image is wrapped in a link, |url| points to the target of the |
143 // link. This isn't useful to us, so get the actual image URL. | 144 // link. This isn't useful to us, so get the actual image URL. |
144 AtomicString urlString; | 145 AtomicString urlString; |
145 if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::input
Tag)) | 146 if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::input
Tag)) |
146 urlString = toElement(node)->getAttribute(HTMLNames::srcAttr); | 147 urlString = toElement(node)->getAttribute(HTMLNames::srcAttr); |
147 else if (node->hasTagName(SVGNames::imageTag)) | 148 else if (isSVGImageElement(node)) |
148 urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr); | 149 urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr); |
149 else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames
::objectTag)) { | 150 else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames
::objectTag)) { |
150 Element* element = toElement(node); | 151 Element* element = toElement(node); |
151 urlString = element->imageSourceURL(); | 152 urlString = element->imageSourceURL(); |
152 } | 153 } |
153 KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(stri
pLeadingAndTrailingHTMLSpaces(urlString)); | 154 KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(stri
pLeadingAndTrailingHTMLSpaces(urlString)); |
154 WebKit::WebImage webImage = bitmap->bitmap(); | 155 WebKit::WebImage webImage = bitmap->bitmap(); |
155 WebKit::Platform::current()->clipboard()->writeImage(webImage, WebKit::WebUR
L(url), WebKit::WebString(title)); | 156 WebKit::Platform::current()->clipboard()->writeImage(webImage, WebKit::WebUR
L(url), WebKit::WebString(title)); |
156 } | 157 } |
157 | 158 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 chosePlainText = true; | 194 chosePlainText = true; |
194 if (RefPtr<DocumentFragment> fragment = createFragmentFromText(conte
xt.get(), markup)) | 195 if (RefPtr<DocumentFragment> fragment = createFragmentFromText(conte
xt.get(), markup)) |
195 return fragment.release(); | 196 return fragment.release(); |
196 } | 197 } |
197 } | 198 } |
198 | 199 |
199 return 0; | 200 return 0; |
200 } | 201 } |
201 | 202 |
202 } // namespace WebCore | 203 } // namespace WebCore |
OLD | NEW |