[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 15:20:21 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 83caf5cbc717292575e644eca8263fce560af29d
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 1 16:00:01 2010 +0000

    2010-11-01  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] Pasting markup into Thunderbird compose window produces no text
            https://bugs.webkit.org/show_bug.cgi?id=43737
    
            Include a content-type meta tag prefix on all clipboard markup. Programs like
            Thunderbird expect this meta tag and will not paste anything unless it is there.
    
            This is covered by changes to WebKit/gtk/tests/testcopyandpaste.c. This patch was
            written in such a way as to not affect layout test results, otherwise there
            would be many new GTK+-specific results that say "FAIL").
    
            * platform/gtk/PasteboardHelper.cpp:
            (WebCore::removeMarkupPrefix): Added this helper which removes the prefix
            when found on incoming clipboard and drag-and-drop text.
            (WebCore::PasteboardHelper::getClipboardContents): Remove the meta tag prefix.
            (WebCore::PasteboardHelper::fillSelectionData): Add the meta tag prefix.
            (WebCore::PasteboardHelper::fillDataObjectFromDropData): Remove the meta tag prefix
    2010-11-01  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [GTK] Pasting markup into Thunderbird compose window produces no text
            https://bugs.webkit.org/show_bug.cgi?id=43737
    
            Added a test verifying that the meta tag prefix on markup data exists.
    
            * tests/testcopyandpaste.c:
            (load_status_cb): Add a check for the meta tag prefix.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71031 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0600f21..2b4f2cd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-11-01  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] Pasting markup into Thunderbird compose window produces no text
+        https://bugs.webkit.org/show_bug.cgi?id=43737
+
+        Include a content-type meta tag prefix on all clipboard markup. Programs like
+        Thunderbird expect this meta tag and will not paste anything unless it is there.
+
+        This is covered by changes to WebKit/gtk/tests/testcopyandpaste.c. This patch was
+        written in such a way as to not affect layout test results, otherwise there
+        would be many new GTK+-specific results that say "FAIL").
+
+        * platform/gtk/PasteboardHelper.cpp:
+        (WebCore::removeMarkupPrefix): Added this helper which removes the prefix
+        when found on incoming clipboard and drag-and-drop text.
+        (WebCore::PasteboardHelper::getClipboardContents): Remove the meta tag prefix.
+        (WebCore::PasteboardHelper::fillSelectionData): Add the meta tag prefix.
+        (WebCore::PasteboardHelper::fillDataObjectFromDropData): Remove the meta tag prefix
+
 2010-11-01  Justin Schuh  <jschuh at chromium.org>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/platform/gtk/PasteboardHelper.cpp b/WebCore/platform/gtk/PasteboardHelper.cpp
index 9f75728..228d5e9 100644
--- a/WebCore/platform/gtk/PasteboardHelper.cpp
+++ b/WebCore/platform/gtk/PasteboardHelper.cpp
@@ -38,6 +38,16 @@ static GdkAtom textPlainAtom = gdk_atom_intern("text/plain;charset=utf-8", FALSE
 static GdkAtom markupAtom = gdk_atom_intern("text/html", FALSE);
 static GdkAtom netscapeURLAtom = gdk_atom_intern("_NETSCAPE_URL", FALSE);
 static GdkAtom uriListAtom = gdk_atom_intern("text/uri-list", FALSE);
+static String gMarkupPrefix = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">";
+
+static void removeMarkupPrefix(String& markup)
+{
+
+    // The markup prefix is not harmful, but we remove it from the string anyway, so that
+    // we can have consistent results with other ports during the layout tests.
+    if (markup.startsWith(gMarkupPrefix))
+        markup.remove(0, gMarkupPrefix.length());
+}
 
 PasteboardHelper::PasteboardHelper()
     : m_targetList(gtk_target_list_new(0, 0))
@@ -112,7 +122,9 @@ void PasteboardHelper::getClipboardContents(GtkClipboard* clipboard)
 
     if (gtk_clipboard_wait_is_target_available(clipboard, markupAtom)) {
         if (GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard, markupAtom)) {
-            dataObject->setMarkup(selectionDataToUTF8String(data));
+            String markup(selectionDataToUTF8String(data));
+            removeMarkupPrefix(markup);
+            dataObject->setMarkup(markup);
             gtk_selection_data_free(data);
         }
     }
@@ -131,9 +143,11 @@ void PasteboardHelper::fillSelectionData(GtkSelectionData* selectionData, guint
         gtk_selection_data_set_text(selectionData, dataObject->text().utf8().data(), -1);
 
     else if (info == getIdForTargetType(TargetTypeMarkup)) {
-        GOwnPtr<gchar> markup(g_strdup(dataObject->markup().utf8().data()));
+        // Some Linux applications refuse to accept pasted markup unless it is
+        // prefixed by a content-type meta tag.
+        CString markup = (gMarkupPrefix + dataObject->markup()).utf8();
         gtk_selection_data_set(selectionData, markupAtom, 8,
-            reinterpret_cast<const guchar*>(markup.get()), strlen(markup.get()) + 1);
+            reinterpret_cast<const guchar*>(markup.data()), markup.length() + 1);
 
     } else if (info == getIdForTargetType(TargetTypeURIList)) {
         CString uriList = dataObject->uriList().utf8();
@@ -187,9 +201,11 @@ void PasteboardHelper::fillDataObjectFromDropData(GtkSelectionData* data, guint
     GdkAtom target = gtk_selection_data_get_target(data);
     if (target == textPlainAtom)
         dataObject->setText(selectionDataToUTF8String(data));
-    else if (target == markupAtom)
-        dataObject->setMarkup(selectionDataToUTF8String(data));
-    else if (target == uriListAtom) {
+    else if (target == markupAtom) {
+        String markup(selectionDataToUTF8String(data));
+        removeMarkupPrefix(markup);
+        dataObject->setMarkup(markup);
+    } else if (target == uriListAtom) {
         dataObject->setURIList(selectionDataToUTF8String(data));
     } else if (target == netscapeURLAtom) {
         String urlWithLabel(selectionDataToUTF8String(data));
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 03201c1..c8e3df3 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-01  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] Pasting markup into Thunderbird compose window produces no text
+        https://bugs.webkit.org/show_bug.cgi?id=43737
+
+        Added a test verifying that the meta tag prefix on markup data exists.
+
+        * tests/testcopyandpaste.c:
+        (load_status_cb): Add a check for the meta tag prefix.
+
 2010-11-01  Mario Sanchez Prada  <msanchez at igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/tests/testcopyandpaste.c b/WebKit/gtk/tests/testcopyandpaste.c
index f7889bd..1b5fb7b 100644
--- a/WebKit/gtk/tests/testcopyandpaste.c
+++ b/WebKit/gtk/tests/testcopyandpaste.c
@@ -92,6 +92,17 @@ static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer da
     g_assert(!text || !strcmp(text, fixture->info->expectedContent));
     g_free(text);
 
+    // Verify that the markup starts with the proper content-type meta tag prefix.
+    GtkSelectionData* selectionData = gtk_clipboard_wait_for_contents(clipboard, gdk_atom_intern("text/html", FALSE));
+    if (selectionData) {
+        static const char* markupPrefix = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">";
+        char* markup = g_strndup((const char*) gtk_selection_data_get_data(selectionData),
+            gtk_selection_data_get_length(selectionData));
+        g_assert(strlen(markupPrefix) <= strlen(markup));
+        g_assert(!strncmp(markupPrefix, markup, strlen(markupPrefix)));
+        g_free(markup);
+    }
+
     g_assert(!gtk_clipboard_wait_is_uris_available(clipboard));
     g_assert(!gtk_clipboard_wait_is_image_available(clipboard));
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list