[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 14:29:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit cd8d3afde6030975acf67019a1b5b23a715ef733
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 11 22:12:54 2010 +0000

    2010-10-11  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Tony Chang.
    
            [GTK] editing/pasteboard/dataTransfer-setData-getData.html fails on GTK+
            https://bugs.webkit.org/show_bug.cgi?id=47244
    
            Unskip the freshly passing test and add a baseline which has a PASS for all
            tests.
    
            * platform/gtk/Skipped: Unskip passing test.
            * platform/gtk/editing/pasteboard/dataTransfer-setData-getData-expected.txt:
    2010-10-11  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Tony Chang.
    
            [GTK] editing/pasteboard/dataTransfer-setData-getData.html fails on GTK+
            https://bugs.webkit.org/show_bug.cgi?id=47244
    
            Store the URI list as a String in DataObjectGtk, so that non-URI elements
            are preserved when getData(...) is called. This necessitates some other
            changes, including adding a m_filenames member to DataObjectGtk to store
            filenames extracted during setURIList(...). The logic in getData(...) has
            also changed to set success = true no matter what to match the spec. A
            followup patch will remove this parameter completely for all platforms.
    
            * platform/gtk/ClipboardGtk.cpp:
            (WebCore::ClipboardGtk::getData): Always succeed to match the HTML5
            spec and Firefox. Simply return the uriList string from the DataObject
            instead of reconstructing it from a vector of KURLs.
            (WebCore::ClipboardGtk::setData): The DataObject now accepts a string
            for the uriList parameter.
            (WebCore::ClipboardGtk::types): Predicate the "Files" member on
            DataObjectGtk::hasFilenames().
            (WebCore::ClipboardGtk::files): Update to reflect the change from
            DataObjectGtk::files() to DataObjectGtk::filenames().
            * platform/gtk/DataObjectGtk.cpp:
            (WebCore::DataObjectGtk::setURIList): Expanded this setter to find the
            first valid URL to use as the m_url member and also extract a list of filenames
            from the URI list.
            (WebCore::DataObjectGtk::setURL): Updated to reflect changes to m_uriList.
            (WebCore::DataObjectGtk::clear): Updated to reflect changes to m_uriList and
            also leave a comment explaining why we do not clear filenames here.
            * platform/gtk/DataObjectGtk.h:
            (WebCore::DataObjectGtk::url): This implementation is now a simple getter.
            (WebCore::DataObjectGtk::uriList): Ditto.
            (WebCore::DataObjectGtk::filenames): Added.
            (WebCore::DataObjectGtk::hasURL): Now a simple check.
            (WebCore::DataObjectGtk::hasFilenames): Added.
            (WebCore::DataObjectGtk::clearURIList): Simple setter.
            (WebCore::DataObjectGtk::clearURL): Ditto.
            * platform/gtk/DragDataGtk.cpp:
            (WebCore::DragData::containsFiles): Updated to access DataObjectGtk::hasFilenames().
            (WebCore::DragData::asFilenames): Updated to access DataObjectGtk::filenames().
            * platform/gtk/PasteboardHelper.cpp:
            (WebCore::PasteboardHelper::getClipboardContents): Use the uriList as a string now.
            (WebCore::PasteboardHelper::fillSelectionData):  Ditto.
            (WebCore::PasteboardHelper::fillDataObjectFromDropData): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69530 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f8f3bc8..c08309b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,18 @@
 2010-10-11  Martin Robinson  <mrobinson at igalia.com>
 
+        Reviewed by Tony Chang.
+
+        [GTK] editing/pasteboard/dataTransfer-setData-getData.html fails on GTK+
+        https://bugs.webkit.org/show_bug.cgi?id=47244
+
+        Unskip the freshly passing test and add a baseline which has a PASS for all
+        tests.
+
+        * platform/gtk/Skipped: Unskip passing test.
+        * platform/gtk/editing/pasteboard/dataTransfer-setData-getData-expected.txt:
+
+2010-10-11  Martin Robinson  <mrobinson at igalia.com>
+
         Reviewed by Gustavo Noronha Silva.
 
         [GTK] Cleanup font selection code for the Freetype backend
diff --git a/LayoutTests/platform/gtk/editing/pasteboard/dataTransfer-setData-getData-expected.txt b/LayoutTests/platform/gtk/editing/pasteboard/dataTransfer-setData-getData-expected.txt
index 9bd5cec..68106c8 100644
--- a/LayoutTests/platform/gtk/editing/pasteboard/dataTransfer-setData-getData-expected.txt
+++ b/LayoutTests/platform/gtk/editing/pasteboard/dataTransfer-setData-getData-expected.txt
@@ -5,30 +5,37 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 --- Test set/get 'URL':
 PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
+PASS getDataResult is "http://test.com/"
+--- Test set/get 'URL' with multiple URLs:
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com/"
 --- Test set/get 'text/uri-list':
 PASS getDataResultType is "string"
-PASS getDataLines.length is 2
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
-PASS getDataLines[1].replace(/\/$/, '') is "http://check.com"
+PASS getDataResult is "http://test.com\r\nhttp://check.com"
+--- Test set/get 'text/uri-list' using '\n':
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com\nhttp://check.com"
 --- Test set 'text/uri-list', get 'URL':
 PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
+PASS getDataResult is "http://test.com/"
+--- Test set 'URL', get 'text/uri-list':
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com\r\nhttp://check.com"
 --- Test set 'text/uri-list', get 'URL', using only '\n':
 PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
+PASS getDataResult is "http://test.com/"
 --- Test set/get 'text/uri-list' with comments:
 PASS getDataResultType is "string"
-PASS getDataLines.length is 2
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
-PASS getDataLines[1].replace(/\/$/, '') is "http://check.com"
+PASS getDataResult is "# comment\r\nhttp://test.com\r\nhttp://check.com"
+--- Test set 'text/uri-list', get 'URL' with comments:
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com/"
+--- Test set 'text/uri-list', get 'URL' with only comments:
+PASS getDataResultType is "string"
+PASS getDataResult is ""
 --- Test set/get 'text/plain':
 PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "Lorem ipsum dolor sit amet."
+PASS getDataResult is "Lorem ipsum dolor sit amet."
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c937a47..a209324 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,50 @@
+2010-10-11  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Tony Chang.
+
+        [GTK] editing/pasteboard/dataTransfer-setData-getData.html fails on GTK+
+        https://bugs.webkit.org/show_bug.cgi?id=47244
+
+        Store the URI list as a String in DataObjectGtk, so that non-URI elements
+        are preserved when getData(...) is called. This necessitates some other
+        changes, including adding a m_filenames member to DataObjectGtk to store
+        filenames extracted during setURIList(...). The logic in getData(...) has
+        also changed to set success = true no matter what to match the spec. A
+        followup patch will remove this parameter completely for all platforms.
+
+        * platform/gtk/ClipboardGtk.cpp:
+        (WebCore::ClipboardGtk::getData): Always succeed to match the HTML5
+        spec and Firefox. Simply return the uriList string from the DataObject
+        instead of reconstructing it from a vector of KURLs.
+        (WebCore::ClipboardGtk::setData): The DataObject now accepts a string
+        for the uriList parameter.
+        (WebCore::ClipboardGtk::types): Predicate the "Files" member on 
+        DataObjectGtk::hasFilenames().
+        (WebCore::ClipboardGtk::files): Update to reflect the change from
+        DataObjectGtk::files() to DataObjectGtk::filenames().
+        * platform/gtk/DataObjectGtk.cpp:
+        (WebCore::DataObjectGtk::setURIList): Expanded this setter to find the
+        first valid URL to use as the m_url member and also extract a list of filenames
+        from the URI list.
+        (WebCore::DataObjectGtk::setURL): Updated to reflect changes to m_uriList.
+        (WebCore::DataObjectGtk::clear): Updated to reflect changes to m_uriList and
+        also leave a comment explaining why we do not clear filenames here.
+        * platform/gtk/DataObjectGtk.h:
+        (WebCore::DataObjectGtk::url): This implementation is now a simple getter.
+        (WebCore::DataObjectGtk::uriList): Ditto.
+        (WebCore::DataObjectGtk::filenames): Added.
+        (WebCore::DataObjectGtk::hasURL): Now a simple check.
+        (WebCore::DataObjectGtk::hasFilenames): Added.
+        (WebCore::DataObjectGtk::clearURIList): Simple setter.
+        (WebCore::DataObjectGtk::clearURL): Ditto.
+        * platform/gtk/DragDataGtk.cpp:
+        (WebCore::DragData::containsFiles): Updated to access DataObjectGtk::hasFilenames().
+        (WebCore::DragData::asFilenames): Updated to access DataObjectGtk::filenames().
+        * platform/gtk/PasteboardHelper.cpp:
+        (WebCore::PasteboardHelper::getClipboardContents): Use the uriList as a string now.
+        (WebCore::PasteboardHelper::fillSelectionData):  Ditto.
+        (WebCore::PasteboardHelper::fillDataObjectFromDropData): Ditto.
+
 2010-10-11  James Robinson  <jamesr at chromium.org>
 
         Reviewed by Kenneth Russell.
diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp
index e7ee432..49bcb7d 100644
--- a/WebCore/platform/gtk/ClipboardGtk.cpp
+++ b/WebCore/platform/gtk/ClipboardGtk.cpp
@@ -139,23 +139,13 @@ void ClipboardGtk::clearAllData()
         m_helper->writeClipboardContents(m_clipboard);
 }
 
-static String joinURIList(Vector<KURL> uriList)
-{
-    if (uriList.isEmpty())
-        return String();
-
-    String joined(uriList[0].string());
-    for (size_t i = 1; i < uriList.size(); i++) {
-        joined.append("\r\n");
-        joined.append(uriList[i].string());
-    }
-
-    return joined;
-}
-
 String ClipboardGtk::getData(const String& typeString, bool& success) const
 {
-    success = false; // Pessimism.
+    success = true; // According to http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html
+    // "The getData(format) method must return the data that is associated with the type format converted
+    // to ASCII lowercase, if any, and must return the empty string otherwise." Since success == false 
+    // results in an 'undefined' return value, we always want to return success == true. This parameter
+    // should eventually be removed.
     if (policy() != ClipboardReadable || !m_dataObject)
         return String();
 
@@ -163,33 +153,14 @@ String ClipboardGtk::getData(const String& typeString, bool& success) const
         m_helper->getClipboardContents(m_clipboard);
 
     ClipboardDataType type = dataObjectTypeFromHTMLClipboardType(typeString);
-    if (type == ClipboardDataTypeURIList) {
-        if (!m_dataObject->hasURIList())
-            return String();
-        success = true;
-        return joinURIList(m_dataObject->uriList());
-    }
-
-    if (type == ClipboardDataTypeURL) {
-        if (!m_dataObject->hasURL())
-            return String();
-        success = true;
+    if (type == ClipboardDataTypeURIList)
+        return m_dataObject->uriList();
+    if (type == ClipboardDataTypeURL)
         return m_dataObject->url();
-    }
-
-    if (type == ClipboardDataTypeMarkup) {
-        if (!m_dataObject->hasMarkup())
-            return String();
-        success = true;
+    if (type == ClipboardDataTypeMarkup)
         return m_dataObject->markup();
-    }
-
-    if (type == ClipboardDataTypeText) {
-        if (!m_dataObject->hasText())
-                return String();
-        success = true;
+    if (type == ClipboardDataTypeText)
         return m_dataObject->text();
-    }
 
     return String();
 }
@@ -202,18 +173,8 @@ bool ClipboardGtk::setData(const String& typeString, const String& data)
     bool success = false;
     ClipboardDataType type = dataObjectTypeFromHTMLClipboardType(typeString);
     if (type == ClipboardDataTypeURIList || type == ClipboardDataTypeURL) {
-        Vector<KURL> uriList;
-        gchar** uris = g_uri_list_extract_uris(data.utf8().data());
-        if (uris) {
-            gchar** currentURI = uris;
-            while (*currentURI) {
-                uriList.append(KURL(KURL(), *currentURI));
-                currentURI++;
-            }
-            g_strfreev(uris);
-            m_dataObject->setURIList(uriList);
-            success = true;
-        }
+        m_dataObject->setURIList(data);
+        success = true;
     } else if (type == ClipboardDataTypeMarkup) {
         m_dataObject->setMarkup(data);
         success = true;
@@ -248,9 +209,11 @@ HashSet<String> ClipboardGtk::types() const
     if (m_dataObject->hasURIList()) {
         types.add("text/uri-list");
         types.add("URL");
-        types.add("Files");
     }
 
+    if (m_dataObject->hasFilenames())
+        types.add("Files");
+
     return types;
 }
 
@@ -263,11 +226,9 @@ PassRefPtr<FileList> ClipboardGtk::files() const
         m_helper->getClipboardContents(m_clipboard);
 
     RefPtr<FileList> fileList = FileList::create();
-    Vector<String> fileVector(m_dataObject->files());
-
-    for (size_t i = 0; i < fileVector.size(); i++)
-        fileList->append(File::create(fileVector[i]));
-
+    const Vector<String>& filenames = m_dataObject->filenames();
+    for (size_t i = 0; i < filenames.size(); i++)
+        fileList->append(File::create(filenames[i]));
     return fileList.release();
 }
 
diff --git a/WebCore/platform/gtk/DataObjectGtk.cpp b/WebCore/platform/gtk/DataObjectGtk.cpp
index db13345..05a2da9 100644
--- a/WebCore/platform/gtk/DataObjectGtk.cpp
+++ b/WebCore/platform/gtk/DataObjectGtk.cpp
@@ -59,8 +59,51 @@ void DataObjectGtk::setMarkup(const String& newMarkup)
     m_markup = newMarkup;
 }
 
+void DataObjectGtk::setURIList(const String& uriListString)
+{
+    m_uriList = uriListString;
+
+    // This code is originally from: platform/chromium/ChromiumDataObject.cpp.
+    // FIXME: We should make this code cross-platform eventually.
+
+    // Line separator is \r\n per RFC 2483 - however, for compatibility
+    // reasons we also allow just \n here.
+    Vector<String> uriList;
+    uriListString.split('\n', uriList);
+
+    // Process the input and copy the first valid URL into the url member.
+    // In case no URLs can be found, subsequent calls to getData("URL")
+    // will get an empty string. This is in line with the HTML5 spec (see
+    // "The DragEvent and DataTransfer interfaces"). Also extract all filenames
+    // from the URI list.
+    bool setURL = false;
+    for (size_t i = 0; i < uriList.size(); ++i) {
+        String& line = uriList[i];
+        line = line.stripWhiteSpace();
+        if (line.isEmpty())
+            continue;
+        if (line[0] == '#')
+            continue;
+
+        KURL url = KURL(KURL(), line);
+        if (url.isValid()) {
+            if (!setURL) {
+                m_url = url;
+                setURL = true;
+            }
+
+            GOwnPtr<GError> error;
+            GOwnPtr<gchar> filename(g_filename_from_uri(line.utf8().data(), 0, &error.outPtr()));
+            if (!error && filename)
+                m_filenames.append(String::fromUTF8(filename.get()));
+        }
+    }
+}
+
 void DataObjectGtk::setURL(const KURL& url, const String& label)
 {
+    m_url = url;
+    m_uriList = url;
     setText(url.string());
 
     String actualLabel(label);
@@ -75,10 +118,6 @@ void DataObjectGtk::setURL(const KURL& url, const String& label)
     append(markup, String::fromUTF8(escaped.get()));
     append(markup, "</a>");
     setMarkup(String::adopt(markup));
-
-    Vector<KURL> uriList;
-    uriList.append(url);
-    setURIList(uriList);
 }
 
 void DataObjectGtk::clearText()
@@ -93,34 +132,6 @@ void DataObjectGtk::clearMarkup()
     m_markup = "";
 }
 
-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())
@@ -132,18 +143,19 @@ String DataObjectGtk::urlLabel()
     return String();
 }
 
-bool DataObjectGtk::hasURL()
-{
-    return !url().isEmpty();
-}
-
 void DataObjectGtk::clear()
 {
     m_text = "";
     m_markup = "";
-    m_uriList.clear();
+    m_uriList = "";
+    m_url = KURL();
     m_image = 0;
     m_range = 0;
+
+    // We do not clear filenames. According to the spec: "The clearData() method
+    // does not affect whether any files were included in the drag, so the types
+    // attribute's list might still not be empty after calling clearData() (it would 
+    // still contain the "Files" string if any files were included in the drag)."
 }
 
 DataObjectGtk* DataObjectGtk::forClipboard(GtkClipboard* clipboard)
diff --git a/WebCore/platform/gtk/DataObjectGtk.h b/WebCore/platform/gtk/DataObjectGtk.h
index e6095da..f6b13fd 100644
--- a/WebCore/platform/gtk/DataObjectGtk.h
+++ b/WebCore/platform/gtk/DataObjectGtk.h
@@ -36,28 +36,30 @@ public:
         return adoptRef(new DataObjectGtk());
     }
 
-    Vector<KURL> uriList() { return m_uriList; }
+    const KURL& url() { return m_url; }
+    const String& uriList() { return m_uriList; }
+    const Vector<String>& filenames() { return m_filenames; }
     GdkPixbuf* image() { return m_image.get(); }
     void setRange(PassRefPtr<Range> newRange) { m_range = newRange; }
-    void setURIList(const Vector<KURL>& newURIList) {  m_uriList = newURIList; }
     void setImage(GdkPixbuf* newImage) { m_image = newImage; }
     void setDragContext(GdkDragContext* newDragContext) { m_dragContext = newDragContext; }
     void setURL(const KURL&, const String&);
     bool hasText() { return m_range || !m_text.isEmpty(); }
     bool hasMarkup() { return m_range || !m_markup.isEmpty(); }
     bool hasURIList() { return !m_uriList.isEmpty(); }
+    bool hasURL() { return !m_url.isEmpty() && m_url.isValid(); }
+    bool hasFilenames() { return !m_filenames.isEmpty(); }
     bool hasImage() { return m_image; }
-    void clearURIList() { m_uriList.clear(); }
+    void clearURIList() { m_uriList = ""; }
+    void clearURL() { m_url = KURL(); }
     void clearImage() { m_image = 0; }
     GdkDragContext* dragContext() { return m_dragContext.get(); }
 
     String text();
     String markup();
-    Vector<String> files();
-    void setText(const String& newText);
-    void setMarkup(const String& newMarkup);
-    bool hasURL();
-    String url();
+    void setText(const String&);
+    void setMarkup(const String&);
+    void setURIList(const String&);
     String urlLabel();
     void clear();
     void clearText();
@@ -68,7 +70,9 @@ public:
 private:
     String m_text;
     String m_markup;
-    Vector<KURL> m_uriList;
+    KURL m_url;
+    String m_uriList;
+    Vector<String> m_filenames;
     PlatformRefPtr<GdkPixbuf> m_image;
     PlatformRefPtr<GdkDragContext> m_dragContext;
     RefPtr<Range> m_range;
diff --git a/WebCore/platform/gtk/DragDataGtk.cpp b/WebCore/platform/gtk/DragDataGtk.cpp
index 69966aa..42ddb16 100644
--- a/WebCore/platform/gtk/DragDataGtk.cpp
+++ b/WebCore/platform/gtk/DragDataGtk.cpp
@@ -37,14 +37,12 @@ bool DragData::containsColor() const
 
 bool DragData::containsFiles() const
 {
-    return !m_platformDragData->files().isEmpty();
+    return m_platformDragData->hasFilenames();
 }
 
 void DragData::asFilenames(Vector<String>& result) const
 {
-    Vector<String> files(m_platformDragData->files());
-    for (size_t i = 0; i < files.size(); i++)
-        result.append(files[i]);
+    result = m_platformDragData->filenames();
 }
 
 bool DragData::containsPlainText() const
diff --git a/WebCore/platform/gtk/PasteboardHelper.cpp b/WebCore/platform/gtk/PasteboardHelper.cpp
index 95df25f..9f75728 100644
--- a/WebCore/platform/gtk/PasteboardHelper.cpp
+++ b/WebCore/platform/gtk/PasteboardHelper.cpp
@@ -92,17 +92,6 @@ GtkTargetList* PasteboardHelper::targetList() const
     return m_targetList;
 }
 
-static Vector<KURL> urisToKURLVector(gchar** uris)
-{
-    ASSERT(uris);
-
-    Vector<KURL> uriList;
-    for (int i = 0; *(uris + i); i++)
-        uriList.append(KURL(KURL(), *(uris + i)));
-
-    return uriList;
-}
-
 static String selectionDataToUTF8String(GtkSelectionData* data)
 {
     // g_strndup guards against selection data that is not null-terminated.
@@ -130,11 +119,7 @@ void PasteboardHelper::getClipboardContents(GtkClipboard* clipboard)
 
     if (gtk_clipboard_wait_is_target_available(clipboard, uriListAtom)) {
         if (GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard, uriListAtom)) {
-            gchar** uris = gtk_selection_data_get_uris(data);
-            if (uris) {
-                dataObject->setURIList(urisToKURLVector(uris));
-                g_strfreev(uris);
-            }
+            dataObject->setURIList(selectionDataToUTF8String(data));
             gtk_selection_data_free(data);
         }
     }
@@ -151,13 +136,9 @@ void PasteboardHelper::fillSelectionData(GtkSelectionData* selectionData, guint
             reinterpret_cast<const guchar*>(markup.get()), strlen(markup.get()) + 1);
 
     } else if (info == getIdForTargetType(TargetTypeURIList)) {
-        Vector<KURL> uriList(dataObject->uriList());
-        gchar** uris = g_new0(gchar*, uriList.size() + 1);
-        for (size_t i = 0; i < uriList.size(); i++)
-            uris[i] = g_strdup(uriList[i].string().utf8().data());
-
-        gtk_selection_data_set_uris(selectionData, uris);
-        g_strfreev(uris);
+        CString uriList = dataObject->uriList().utf8();
+        gtk_selection_data_set(selectionData, uriListAtom, 8,
+            reinterpret_cast<const guchar*>(uriList.data()), uriList.length() + 1);
 
     } else if (info == getIdForTargetType(TargetTypeNetscapeURL) && dataObject->hasURL()) {
         String url(dataObject->url());
@@ -209,27 +190,16 @@ void PasteboardHelper::fillDataObjectFromDropData(GtkSelectionData* data, guint
     else if (target == markupAtom)
         dataObject->setMarkup(selectionDataToUTF8String(data));
     else if (target == uriListAtom) {
-        gchar** uris = gtk_selection_data_get_uris(data);
-        if (!uris)
-            return;
-
-        Vector<KURL> uriList(urisToKURLVector(uris));
-        dataObject->setURIList(uriList);
-        g_strfreev(uris);
+        dataObject->setURIList(selectionDataToUTF8String(data));
     } else if (target == netscapeURLAtom) {
         String urlWithLabel(selectionDataToUTF8String(data));
-
         Vector<String> pieces;
         urlWithLabel.split("\n", pieces);
 
         // Give preference to text/uri-list here, as it can hold more
         // than one URI but still take  the label if there is one.
-        if (!dataObject->hasURL()) {
-            Vector<KURL> uriList;
-            uriList.append(KURL(KURL(), pieces[0]));
-            dataObject->setURIList(uriList);
-        }
-
+        if (!dataObject->hasURIList())
+            dataObject->setURIList(pieces[0]);
         if (pieces.size() > 1)
             dataObject->setText(pieces[1]);
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list