diff options
Diffstat (limited to 'WebCore/platform/gtk/PasteboardGtk.cpp')
-rw-r--r-- | WebCore/platform/gtk/PasteboardGtk.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp index 9f72923..0ff26f7 100644 --- a/WebCore/platform/gtk/PasteboardGtk.cpp +++ b/WebCore/platform/gtk/PasteboardGtk.cpp @@ -35,13 +35,6 @@ namespace WebCore { -/* FIXME: we must get rid of this and use the enum in webkitwebview.h someway */ -typedef enum -{ - WEBKIT_WEB_VIEW_TARGET_INFO_HTML = - 1, - WEBKIT_WEB_VIEW_TARGET_INFO_TEXT = - 2 -} WebKitWebViewTargetInfo; - class PasteboardSelectionData { public: PasteboardSelectionData(gchar* text, gchar* markup) @@ -65,11 +58,11 @@ static void clipboard_get_contents_cb(GtkClipboard *clipboard, GtkSelectionData guint info, gpointer data) { PasteboardSelectionData* clipboardData = reinterpret_cast<PasteboardSelectionData*>(data); ASSERT(clipboardData); - if ((gint)info == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) { + if ((gint)info == Pasteboard::generalPasteboard()->m_helper->getWebViewTargetInfoHtml()) gtk_selection_data_set(selection_data, selection_data->target, 8, reinterpret_cast<const guchar*>(clipboardData->markup()), g_utf8_strlen(clipboardData->markup(), -1)); - } else + else gtk_selection_data_set_text(selection_data, clipboardData->text(), -1); } @@ -115,6 +108,13 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, gtk_target_table_free(targets, n_targets); } +void Pasteboard::writePlainText(const String& text) +{ + CString utf8 = text.utf8(); + GtkClipboard* clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD); + gtk_clipboard_set_text(clipboard, utf8.data(), utf8.length()); +} + void Pasteboard::writeURL(const KURL& url, const String&, Frame* frame) { if (url.isEmpty()) @@ -122,8 +122,9 @@ void Pasteboard::writeURL(const KURL& url, const String&, Frame* frame) GtkClipboard* clipboard = m_helper->getClipboard(frame); GtkClipboard* primary = m_helper->getPrimary(frame); - gtk_clipboard_set_text(clipboard, url.string().utf8().data(), url.string().utf8().length()); - gtk_clipboard_set_text(primary, url.string().utf8().data(), url.string().utf8().length()); + CString utf8 = url.string().utf8(); + gtk_clipboard_set_text(clipboard, utf8.data(), utf8.length()); + gtk_clipboard_set_text(primary, utf8.data(), utf8.length()); } void Pasteboard::writeImage(Node* node, const KURL&, const String&) |