[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.17-2-1290-g8419ee5
Gustavo Noronha Silva
kov at debian.org
Thu Jan 7 00:57:09 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit fc05a96ca65c827c1f4c5512e1c4965000307930
Author: Martin Robinson <martin.james.robinson at gmail.com>
Date: Wed Jan 6 21:23:04 2010 -0200
Add DataObjectGtk, a container for pasteboard and drag-and-drop data.
Use DataObjectGtk when setting and clear selection clipboard data.
diff --git a/GNUmakefile.in b/GNUmakefile.in
index 7405819..40d3d5c 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -4045,6 +4045,8 @@ am__libWebCore_la_SOURCES_DIST = WebCore/WebCorePrefix.h \
WebCore/platform/gtk/ContextMenuItemGtk.cpp \
WebCore/platform/gtk/CursorGtk.cpp \
WebCore/platform/gtk/CursorGtk.h \
+ WebCore/platform/gtk/DataObjectGtk.h \
+ WebCore/platform/gtk/DataObjectGtk.cpp \
WebCore/platform/gtk/DragDataGtk.cpp \
WebCore/platform/gtk/DragImageGtk.cpp \
WebCore/platform/gtk/EventLoopGtk.cpp \
@@ -5281,6 +5283,7 @@ am__objects_32 = \
WebCore/platform/gtk/libWebCore_la-ContextMenuGtk.lo \
WebCore/platform/gtk/libWebCore_la-ContextMenuItemGtk.lo \
WebCore/platform/gtk/libWebCore_la-CursorGtk.lo \
+ WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo \
WebCore/platform/gtk/libWebCore_la-DragDataGtk.lo \
WebCore/platform/gtk/libWebCore_la-DragImageGtk.lo \
WebCore/platform/gtk/libWebCore_la-EventLoopGtk.lo \
@@ -8381,6 +8384,8 @@ webcoregtk_sources := WebCore/bindings/js/ScriptControllerGtk.cpp \
WebCore/platform/gtk/ContextMenuItemGtk.cpp \
WebCore/platform/gtk/CursorGtk.cpp \
WebCore/platform/gtk/CursorGtk.h \
+ WebCore/platform/gtk/DataObjectGtk.h \
+ WebCore/platform/gtk/DataObjectGtk.cpp \
WebCore/platform/gtk/DragDataGtk.cpp \
WebCore/platform/gtk/DragImageGtk.cpp \
WebCore/platform/gtk/EventLoopGtk.cpp \
@@ -13423,6 +13428,9 @@ WebCore/platform/gtk/libWebCore_la-ContextMenuItemGtk.lo: \
WebCore/platform/gtk/libWebCore_la-CursorGtk.lo: \
WebCore/platform/gtk/$(am__dirstamp) \
WebCore/platform/gtk/$(DEPDIR)/$(am__dirstamp)
+WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo: \
+ WebCore/platform/gtk/$(am__dirstamp) \
+ WebCore/platform/gtk/$(DEPDIR)/$(am__dirstamp)
WebCore/platform/gtk/libWebCore_la-DragDataGtk.lo: \
WebCore/platform/gtk/$(am__dirstamp) \
WebCore/platform/gtk/$(DEPDIR)/$(am__dirstamp)
@@ -15829,6 +15837,8 @@ mostlyclean-compile:
-rm -f WebCore/platform/gtk/libWebCore_la-ContextMenuItemGtk.lo
-rm -f WebCore/platform/gtk/libWebCore_la-CursorGtk.$(OBJEXT)
-rm -f WebCore/platform/gtk/libWebCore_la-CursorGtk.lo
+ -rm -f WebCore/platform/gtk/libWebCore_la-DataObjectGtk.$(OBJEXT)
+ -rm -f WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo
-rm -f WebCore/platform/gtk/libWebCore_la-DragDataGtk.$(OBJEXT)
-rm -f WebCore/platform/gtk/libWebCore_la-DragDataGtk.lo
-rm -f WebCore/platform/gtk/libWebCore_la-DragImageGtk.$(OBJEXT)
@@ -17837,6 +17847,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-ContextMenuGtk.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-ContextMenuItemGtk.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-CursorGtk.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DataObjectGtk.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DragDataGtk.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DragImageGtk.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-EventLoopGtk.Plo at am__quote@
@@ -29065,6 +29076,14 @@ WebCore/platform/gtk/libWebCore_la-CursorGtk.lo: WebCore/platform/gtk/CursorGtk.
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWebCore_la_CPPFLAGS) $(CPPFLAGS) $(libWebCore_la_CXXFLAGS) $(CXXFLAGS) -c -o WebCore/platform/gtk/libWebCore_la-CursorGtk.lo `test -f 'WebCore/platform/gtk/CursorGtk.cpp' || echo '$(srcdir)/'`WebCore/platform/gtk/CursorGtk.cpp
+WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo: WebCore/platform/gtk/DataObjectGtk.cpp
+ at am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWebCore_la_CPPFLAGS) $(CPPFLAGS) $(libWebCore_la_CXXFLAGS) $(CXXFLAGS) -MT WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo -MD -MP -MF WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DataObjectGtk.Tpo -c -o WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo `test -f 'WebCore/platform/gtk/DataObjectGtk.cpp' || echo '$(srcdir)/'`WebCore/platform/gtk/DataObjectGtk.cpp
+ at am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DataObjectGtk.Tpo WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DataObjectGtk.Plo
+ at am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='WebCore/platform/gtk/DataObjectGtk.cpp' object='WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWebCore_la_CPPFLAGS) $(CPPFLAGS) $(libWebCore_la_CXXFLAGS) $(CXXFLAGS) -c -o WebCore/platform/gtk/libWebCore_la-DataObjectGtk.lo `test -f 'WebCore/platform/gtk/DataObjectGtk.cpp' || echo '$(srcdir)/'`WebCore/platform/gtk/DataObjectGtk.cpp
+
WebCore/platform/gtk/libWebCore_la-DragDataGtk.lo: WebCore/platform/gtk/DragDataGtk.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWebCore_la_CPPFLAGS) $(CPPFLAGS) $(libWebCore_la_CXXFLAGS) $(CXXFLAGS) -MT WebCore/platform/gtk/libWebCore_la-DragDataGtk.lo -MD -MP -MF WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DragDataGtk.Tpo -c -o WebCore/platform/gtk/libWebCore_la-DragDataGtk.lo `test -f 'WebCore/platform/gtk/DragDataGtk.cpp' || echo '$(srcdir)/'`WebCore/platform/gtk/DragDataGtk.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DragDataGtk.Tpo WebCore/platform/gtk/$(DEPDIR)/libWebCore_la-DragDataGtk.Plo
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index c6c97b7..ba72c05 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1981,6 +1981,8 @@ webcoregtk_sources += \
WebCore/platform/gtk/ContextMenuItemGtk.cpp \
WebCore/platform/gtk/CursorGtk.cpp \
WebCore/platform/gtk/CursorGtk.h \
+ WebCore/platform/gtk/DataObjectGtk.h \
+ WebCore/platform/gtk/DataObjectGtk.cpp \
WebCore/platform/gtk/DragDataGtk.cpp \
WebCore/platform/gtk/DragImageGtk.cpp \
WebCore/platform/gtk/EventLoopGtk.cpp \
diff --git a/WebCore/platform/gtk/DataObjectGtk.cpp b/WebCore/platform/gtk/DataObjectGtk.cpp
new file mode 100644
index 0000000..9cecb25
--- /dev/null
+++ b/WebCore/platform/gtk/DataObjectGtk.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2009, Martin Robinson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "DataObjectGtk.h"
+
+#include <gtk/gtk.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/gtk/GOwnPtr.h>
+
+namespace WebCore {
+
+DataObjectGtk::DataObjectGtk()
+{
+}
+
+DataObjectGtk::~DataObjectGtk()
+{
+}
+
+Vector<String> DataObjectGtk::files()
+{
+ Vector<KURL> uris(uriList());
+ Vector<String> files;
+
+ for (size_t i = 0; i < uris.size(); i++) {
+ KURL& uri = uris[0];
+ if (!uri.isValid() || !uri.isLocalFile())
+ continue;
+
+ files.append(uri.string());
+ }
+
+ return files;
+}
+
+String DataObjectGtk::url()
+{
+ Vector<KURL> uris(uriList());
+ for (size_t i = 0; i < uris.size(); i++) {
+ KURL& uri = uris[0];
+ if (uri.isValid())
+ return uri;
+ }
+
+ return String();
+}
+
+String DataObjectGtk::urlLabel()
+{
+ if (hasText())
+ return text();
+
+ if (hasURL())
+ return url();
+
+ return String();
+}
+
+bool DataObjectGtk::hasURL()
+{
+ return !url().isEmpty();
+}
+
+void DataObjectGtk::clearImage()
+{
+ setImage(0);
+}
+
+void DataObjectGtk::clear()
+{
+ clearText();
+ clearMarkup();
+ clearURIList();
+ clearImage();
+}
+
+DataObjectGtk* DataObjectGtk::forClipboard(GtkClipboard* clipboard)
+{
+ static HashMap<GtkClipboard*, RefPtr<DataObjectGtk> > objectMap;
+
+ if (!objectMap.contains(clipboard)) {
+ RefPtr<DataObjectGtk> dataObject = DataObjectGtk::create();
+ objectMap.set(clipboard, dataObject);
+ return dataObject.get();
+ }
+
+ HashMap<GtkClipboard*, RefPtr<DataObjectGtk> >::iterator it = objectMap.find(clipboard);
+ return it->second.get();
+}
+
+}
diff --git a/WebCore/platform/gtk/DataObjectGtk.h b/WebCore/platform/gtk/DataObjectGtk.h
new file mode 100644
index 0000000..f6d38e0
--- /dev/null
+++ b/WebCore/platform/gtk/DataObjectGtk.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2009, Martin Robinson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef DataObjectGtk_h
+#define DataObjectGtk_h
+
+#include "CString.h"
+#include "FileList.h"
+#include "KURL.h"
+#include "StringHash.h"
+#include <gtk/gtk.h>
+#include <wtf/RefCounted.h>
+#include <wtf/gtk/GRefPtr.h>
+
+namespace WebCore {
+
+class DataObjectGtk : public RefCounted<DataObjectGtk> {
+public:
+ static PassRefPtr<DataObjectGtk> create()
+ {
+ return adoptRef(new DataObjectGtk());
+ }
+
+ ~DataObjectGtk();
+
+ String text() { return m_text; }
+ String markup() { return m_markup; }
+ Vector<KURL> uriList() { return m_uriList; }
+ GdkPixbuf* image() { return m_image.get(); }
+ void setText(const String& newText) { m_text = newText; }
+ void setMarkup(const String& newMarkup) { m_markup = newMarkup; }
+ void setURIList(const Vector<KURL>& newURIList) { m_uriList = newURIList; }
+ void setImage(GdkPixbuf* newImage) { m_image = newImage; }
+ void setDragContext(GdkDragContext* newDragContext) { m_dragContext = newDragContext; }
+ bool hasText() { return !m_text.isEmpty(); }
+ bool hasMarkup() { return !m_markup.isEmpty(); }
+ bool hasURIList() { return !m_uriList.isEmpty(); }
+ bool hasImage() { return m_image; }
+ void clearText() { m_text = ""; }
+ void clearMarkup() { m_markup = ""; }
+ void clearURIList() { m_uriList.clear(); }
+ GdkDragContext* dragContext() { return m_dragContext.get(); }
+
+ Vector<String> files();
+ bool hasURL();
+ String url();
+ String urlLabel();
+
+ void clearImage();
+ void clear();
+
+ static DataObjectGtk* forClipboard(GtkClipboard*);
+
+private:
+ DataObjectGtk();
+
+ String m_text;
+ String m_markup;
+ Vector<KURL> m_uriList;
+ GRefPtr<GdkPixbuf> m_image;
+ GRefPtr<GdkDragContext> m_dragContext;
+};
+
+}
+
+#endif // DataObjectGtk_h
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index b8566a2..e2daf3f 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -24,6 +24,7 @@
#include "EditorClientGtk.h"
#include "CString.h"
+#include "DataObjectGtk.h"
#include "EditCommand.h"
#include "Editor.h"
#include <enchant.h>
@@ -35,6 +36,7 @@
#include "KeyboardEvent.h"
#include "NotImplemented.h"
#include "Page.h"
+#include "PasteboardHelperGtk.h"
#include "PlatformKeyboardEvent.h"
#include "markup.h"
#include "webkitprivate.h"
@@ -185,34 +187,11 @@ void EditorClient::respondToChangedContents()
notImplemented();
}
-void clipboard_get_contents_cb(GtkClipboard* clipboard, GtkSelectionData* selection_data, guint info, gpointer data)
-{
- EditorClient* client = static_cast<EditorClient*>(data);
-
- if (!client->m_range)
- return;
-
- if (static_cast<gint>(info) == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) {
- String markup = createMarkup(client->m_range.get(), 0, AnnotateForInterchange);
- gtk_selection_data_set(selection_data, selection_data->target, 8,
- reinterpret_cast<const guchar*>(markup.utf8().data()), markup.utf8().length());
- } else {
- String text = client->m_range->text();
- gtk_selection_data_set_text(selection_data, text.utf8().data(), text.utf8().length());
- }
-}
-
-void clipboard_clear_contents_cb(GtkClipboard* clipboard, gpointer data)
-{
- EditorClient* client = static_cast<EditorClient*>(data);
-
- client->m_range = 0;
-}
-
void EditorClient::respondToChangedSelection()
{
WebKitWebViewPrivate* priv = m_webView->priv;
- Frame* targetFrame = core(m_webView)->focusController()->focusedOrMainFrame();
+ WebCore::Page* corePage = core(m_webView);
+ Frame* targetFrame = corePage->focusController()->focusedOrMainFrame();
if (!targetFrame)
return;
@@ -220,17 +199,20 @@ void EditorClient::respondToChangedSelection()
if (targetFrame->editor()->ignoreCompositionSelectionChange())
return;
+#if PLATFORM(X11)
GtkClipboard* clipboard = gtk_widget_get_clipboard(GTK_WIDGET(m_webView), GDK_SELECTION_PRIMARY);
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+ dataObject->clear();
+
if (targetFrame->selection()->isRange()) {
- GtkTargetList* targetList = webkit_web_view_get_copy_target_list(m_webView);
- gint targetCount;
- GtkTargetEntry* targets = gtk_target_table_new_from_list(targetList, &targetCount);
- gtk_clipboard_set_with_data(clipboard, targets, targetCount,
- clipboard_get_contents_cb, clipboard_clear_contents_cb, this);
- m_range = targetFrame->selection()->toNormalizedRange();
- gtk_target_table_free(targets, targetCount);
+ RefPtr<Range> range = targetFrame->selection()->toNormalizedRange();
+ dataObject->setText(targetFrame->selectedText());
+ dataObject->setMarkup(createMarkup(range.get(), 0, AnnotateForInterchange));
}
+ pasteboardHelperInstance()->writeClipboardContents(clipboard, corePage);
+#endif
+
if (!targetFrame->editor()->hasComposition())
return;
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
index c71ef1b..4dc2b50 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
@@ -20,13 +20,14 @@
#include "config.h"
#include "PasteboardHelperGtk.h"
+#include "DataObjectGtk.h"
+#include "FocusController.h"
#include "Frame.h"
+#include <gtk/gtk.h>
#include "webkitwebframe.h"
#include "webkitwebview.h"
#include "webkitprivate.h"
-#include <gtk/gtk.h>
-
using namespace WebCore;
namespace WebKit {
@@ -79,4 +80,81 @@ gint PasteboardHelperGtk::getWebViewTargetInfoHtml() const
return WEBKIT_WEB_VIEW_TARGET_INFO_HTML;
}
+static void fillSelectionData(GtkSelectionData* selectionData, guint info, DataObjectGtk* dataObject)
+{
+ if (info == WEBKIT_WEB_VIEW_TARGET_INFO_TEXT)
+ gtk_selection_data_set_text(selectionData, dataObject->text().utf8().data(), -1);
+ else if (info == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) {
+ GOwnPtr<gchar> markup(g_strdup(dataObject->markup().utf8().data()));
+ gtk_selection_data_set(selectionData, selectionData->target, 8,
+ reinterpret_cast<const guchar*>(markup.get()),
+ strlen(markup.get()));
+ }
+}
+
+static GtkTargetList* targetListForDataObject(DataObjectGtk* dataObject)
+{
+ GtkTargetList* list = gtk_target_list_new(0, 0);
+
+ if (dataObject->hasText())
+ gtk_target_list_add_text_targets(list, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT);
+
+ if (dataObject->hasMarkup())
+ gtk_target_list_add(list, gdkMarkupAtom, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML);
+
+ return list;
+}
+
+static bool settingClipboard = false;
+static void getClipboardContentsCallback(GtkClipboard* clipboard, GtkSelectionData *selectionData, guint info, gpointer data)
+{
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+ ASSERT(dataObject);
+ fillSelectionData(selectionData, info, dataObject);
+}
+
+static void clearClipboardContentsCallback(GtkClipboard* clipboard, gpointer data)
+{
+ // GTK will call the clear clipboard callback while setting clipboard data.
+ // We don't actually want to clear the DataObject during that time.
+ if (settingClipboard)
+ return;
+
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+ ASSERT(dataObject);
+
+ dataObject->clear();
+ if (data) {
+ WebCore::Page* corePage = reinterpret_cast<WebCore::Page*>(data);
+ Frame* frame = corePage->focusController()->focusedOrMainFrame();
+
+ // Collapse the selection without clearing it
+ ASSERT(frame);
+ frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity());
+ }
+}
+
+void PasteboardHelperGtk::writeClipboardContents(GtkClipboard* clipboard, gpointer data)
+{
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+ GtkTargetList* list = targetListForDataObject(dataObject);
+
+ int numberOfTargets;
+ GtkTargetEntry* table = gtk_target_table_new_from_list(list, &numberOfTargets);
+
+ if (numberOfTargets > 0 && table) {
+ settingClipboard = true;
+ gtk_clipboard_set_with_data(clipboard, table, numberOfTargets,
+ getClipboardContentsCallback,
+ clearClipboardContentsCallback, data);
+ settingClipboard = false;
+ } else
+ gtk_clipboard_clear(clipboard);
+
+ if (table)
+ gtk_target_table_free(table, numberOfTargets);
+
+ gtk_target_list_unref(list);
+}
+
}
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
index 12ba207..97eff90 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
@@ -47,6 +47,8 @@ public:
virtual GtkTargetList* targetList() const;
virtual gint getWebViewTargetInfoHtml() const;
+ void writeClipboardContents(GtkClipboard* clipboard, gpointer data = 0);
+
private:
GtkTargetList* m_targetList;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list