diff options
author | Ben Murdoch <benm@google.com> | 2010-08-13 05:20:16 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-13 05:20:16 -0700 |
commit | f4958a7d95cd5fbc1c74905e229b02c95cd5ee78 (patch) | |
tree | 14a0f1b07a19948c2ed93d0d8547caa7fe10aa0e /WebCore/platform/gtk/ClipboardGtk.cpp | |
parent | d074a7997da8ce379434eb6e208b97cde8a0841c (diff) | |
parent | f964bc1fd59a545a80a0cc2529ad8830be514871 (diff) | |
download | external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.zip external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.gz external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.bz2 |
Merge changes I60a96064,I6929172f,Idefd9bec,I8cf448f2,I8791737a,I992c56b0,Ibb4b089d,I779a8ec0,Ife412e30,I2da1ae98,Ibcf41849
* changes:
Merge WebKit at r65072 : Update WebKit revision number.
Merge WebKit at r65072 : Update test_expectations.
Merge WebKit at r65072 : Complete cherry-pick of WebKit change 43848 to add EmptyDeviceMotionClient
Merge WebKit at r65072 : Implement DeviceMotionClientAndroid
Merge WebKit at r65072: JSC build fix in InspectorController.h
Merge WebKit at r65072: Fix V8 code generator.
Merge WebKit at r65072 : Build fix for JSC, update ambiguous usage of JSLock.
Merge WebKit at r65072: String class has moved to the WTF namespace.
Merge Webkit at r65072 : Fix conflicts.
Merge Webkit at r65072 : Fix Makefiles.
Merge WebKit at r65072 : Initial merge by git.
Diffstat (limited to 'WebCore/platform/gtk/ClipboardGtk.cpp')
-rw-r--r-- | WebCore/platform/gtk/ClipboardGtk.cpp | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index c08b03f..7003cf0 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -23,6 +23,7 @@ #include "Element.h" #include "FileList.h" #include "Frame.h" +#include "HTMLNames.h" #include "Image.h" #include "NotImplemented.h" #include "Pasteboard.h" @@ -271,38 +272,38 @@ PassRefPtr<FileList> ClipboardGtk::files() const return fileList.release(); } -IntPoint ClipboardGtk::dragLocation() const +void ClipboardGtk::setDragImage(CachedImage* image, const IntPoint& location) { - notImplemented(); - return IntPoint(0, 0); + setDragImage(image, 0, location); } -CachedImage* ClipboardGtk::dragImage() const +void ClipboardGtk::setDragImageElement(Node* element, const IntPoint& location) { - notImplemented(); - return 0; + setDragImage(0, element, location); } -void ClipboardGtk::setDragImage(CachedImage*, const IntPoint&) +void ClipboardGtk::setDragImage(CachedImage* image, Node* element, const IntPoint& location) { - notImplemented(); -} + if (policy() != ClipboardImageWritable && policy() != ClipboardWritable) + return; -Node* ClipboardGtk::dragImageElement() -{ - notImplemented(); - return 0; -} + if (m_dragImage) + m_dragImage->removeClient(this); + m_dragImage = image; + if (m_dragImage) + m_dragImage->addClient(this); -void ClipboardGtk::setDragImageElement(Node*, const IntPoint&) -{ - notImplemented(); + m_dragLoc = location; + m_dragImageElement = element; } -DragImageRef ClipboardGtk::createDragImage(IntPoint&) const +DragImageRef ClipboardGtk::createDragImage(IntPoint& location) const { - notImplemented(); - return 0; + location = m_dragLoc; + if (!m_dragImage) + return 0; + + return createDragImageFromImage(m_dragImage->image()); } static CachedImage* getCachedImage(Element* element) @@ -320,23 +321,20 @@ static CachedImage* getCachedImage(Element* element) return 0; } -void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame*) +void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame* frame) { - CachedImage* cachedImage = getCachedImage(element); - if (!cachedImage || !cachedImage->isLoaded()) + m_dataObject->setURL(url, label); + m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, AbsoluteURLs)); + + CachedImage* image = getCachedImage(element); + if (!image || !image->isLoaded()) return; - GdkPixbuf* pixbuf = cachedImage->image()->getGdkPixbuf(); + GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->image()->getGdkPixbuf()); if (!pixbuf) return; - GtkClipboard* imageClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardImage")); - gtk_clipboard_clear(imageClipboard); - - gtk_clipboard_set_image(imageClipboard, pixbuf); - g_object_unref(pixbuf); - - writeURL(url, label, 0); + m_dataObject->setImage(pixbuf.get()); } void ClipboardGtk::writeURL(const KURL& url, const String& label, Frame*) |