Changeset 71031 in webkit
- Timestamp:
- Nov 1, 2010 9:00:01 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r71027 r71031 1 2010-11-01 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Xan Lopez. 4 5 [GTK] Pasting markup into Thunderbird compose window produces no text 6 https://bugs.webkit.org/show_bug.cgi?id=43737 7 8 Include a content-type meta tag prefix on all clipboard markup. Programs like 9 Thunderbird expect this meta tag and will not paste anything unless it is there. 10 11 This is covered by changes to WebKit/gtk/tests/testcopyandpaste.c. This patch was 12 written in such a way as to not affect layout test results, otherwise there 13 would be many new GTK+-specific results that say "FAIL"). 14 15 * platform/gtk/PasteboardHelper.cpp: 16 (WebCore::removeMarkupPrefix): Added this helper which removes the prefix 17 when found on incoming clipboard and drag-and-drop text. 18 (WebCore::PasteboardHelper::getClipboardContents): Remove the meta tag prefix. 19 (WebCore::PasteboardHelper::fillSelectionData): Add the meta tag prefix. 20 (WebCore::PasteboardHelper::fillDataObjectFromDropData): Remove the meta tag prefix 21 1 22 2010-11-01 Justin Schuh <jschuh@chromium.org> 2 23 -
trunk/WebCore/platform/gtk/PasteboardHelper.cpp
r69530 r71031 39 39 static GdkAtom netscapeURLAtom = gdk_atom_intern("_NETSCAPE_URL", FALSE); 40 40 static GdkAtom uriListAtom = gdk_atom_intern("text/uri-list", FALSE); 41 static String gMarkupPrefix = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"; 42 43 static void removeMarkupPrefix(String& markup) 44 { 45 46 // The markup prefix is not harmful, but we remove it from the string anyway, so that 47 // we can have consistent results with other ports during the layout tests. 48 if (markup.startsWith(gMarkupPrefix)) 49 markup.remove(0, gMarkupPrefix.length()); 50 } 41 51 42 52 PasteboardHelper::PasteboardHelper() … … 113 123 if (gtk_clipboard_wait_is_target_available(clipboard, markupAtom)) { 114 124 if (GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard, markupAtom)) { 115 dataObject->setMarkup(selectionDataToUTF8String(data)); 125 String markup(selectionDataToUTF8String(data)); 126 removeMarkupPrefix(markup); 127 dataObject->setMarkup(markup); 116 128 gtk_selection_data_free(data); 117 129 } … … 132 144 133 145 else if (info == getIdForTargetType(TargetTypeMarkup)) { 134 GOwnPtr<gchar> markup(g_strdup(dataObject->markup().utf8().data())); 146 // Some Linux applications refuse to accept pasted markup unless it is 147 // prefixed by a content-type meta tag. 148 CString markup = (gMarkupPrefix + dataObject->markup()).utf8(); 135 149 gtk_selection_data_set(selectionData, markupAtom, 8, 136 reinterpret_cast<const guchar*>(markup. get()), strlen(markup.get()) + 1);150 reinterpret_cast<const guchar*>(markup.data()), markup.length() + 1); 137 151 138 152 } else if (info == getIdForTargetType(TargetTypeURIList)) { … … 188 202 if (target == textPlainAtom) 189 203 dataObject->setText(selectionDataToUTF8String(data)); 190 else if (target == markupAtom) 191 dataObject->setMarkup(selectionDataToUTF8String(data)); 192 else if (target == uriListAtom) { 204 else if (target == markupAtom) { 205 String markup(selectionDataToUTF8String(data)); 206 removeMarkupPrefix(markup); 207 dataObject->setMarkup(markup); 208 } else if (target == uriListAtom) { 193 209 dataObject->setURIList(selectionDataToUTF8String(data)); 194 210 } else if (target == netscapeURLAtom) { -
trunk/WebKit/gtk/ChangeLog
r71026 r71031 1 2010-11-01 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Xan Lopez. 4 5 [GTK] Pasting markup into Thunderbird compose window produces no text 6 https://bugs.webkit.org/show_bug.cgi?id=43737 7 8 Added a test verifying that the meta tag prefix on markup data exists. 9 10 * tests/testcopyandpaste.c: 11 (load_status_cb): Add a check for the meta tag prefix. 12 1 13 2010-11-01 Mario Sanchez Prada <msanchez@igalia.com> 2 14 -
trunk/WebKit/gtk/tests/testcopyandpaste.c
r69293 r71031 93 93 g_free(text); 94 94 95 // Verify that the markup starts with the proper content-type meta tag prefix. 96 GtkSelectionData* selectionData = gtk_clipboard_wait_for_contents(clipboard, gdk_atom_intern("text/html", FALSE)); 97 if (selectionData) { 98 static const char* markupPrefix = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"; 99 char* markup = g_strndup((const char*) gtk_selection_data_get_data(selectionData), 100 gtk_selection_data_get_length(selectionData)); 101 g_assert(strlen(markupPrefix) <= strlen(markup)); 102 g_assert(!strncmp(markupPrefix, markup, strlen(markupPrefix))); 103 g_free(markup); 104 } 105 95 106 g_assert(!gtk_clipboard_wait_is_uris_available(clipboard)); 96 107 g_assert(!gtk_clipboard_wait_is_image_available(clipboard));
Note: See TracChangeset
for help on using the changeset viewer.