Unreviewed, rolling out r107894.
authordcheng@chromium.org <dcheng@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Feb 2012 02:20:12 +0000 (02:20 +0000)
committerdcheng@chromium.org <dcheng@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Feb 2012 02:20:12 +0000 (02:20 +0000)
http://trac.webkit.org/changeset/107894
https://bugs.webkit.org/show_bug.cgi?id=30416

dataTransfer.types should be an Array since DOMStringList is deprecated.

Source/WebCore:

* bindings/js/JSClipboardCustom.cpp:
(WebCore::JSClipboard::types):
(WebCore):
* bindings/v8/custom/V8ClipboardCustom.cpp:
(WebCore::V8Clipboard::typesAccessorGetter):
(WebCore):
* dom/Clipboard.cpp:
(WebCore::Clipboard::hasStringOfType):
* dom/Clipboard.h:
(Clipboard):
* dom/Clipboard.idl:
* platform/blackberry/ClipboardBlackBerry.cpp:
(WebCore::ClipboardBlackBerry::types):
* platform/blackberry/ClipboardBlackBerry.h:
(ClipboardBlackBerry):
* platform/chromium/ChromiumDataObject.cpp:
(WebCore::ChromiumDataObject::types):
* platform/chromium/ChromiumDataObject.h:
(ChromiumDataObject):
* platform/chromium/ClipboardChromium.cpp:
(WebCore::ClipboardChromium::types):
(WebCore::ClipboardChromium::mayUpdateItems):
* platform/chromium/ClipboardChromium.h:
(ClipboardChromium):
* platform/chromium/DragDataChromium.cpp:
(WebCore::containsHTML):
(WebCore::DragData::containsURL):
(WebCore::DragData::asURL):
(WebCore::DragData::containsPlainText):
(WebCore::DragData::canSmartReplace):
(WebCore::DragData::asFragment):
* platform/efl/ClipboardEfl.cpp:
(WebCore::ClipboardEfl::types):
* platform/efl/ClipboardEfl.h:
(ClipboardEfl):
* platform/gtk/ClipboardGtk.cpp:
(WebCore::ClipboardGtk::types):
* platform/gtk/ClipboardGtk.h:
(ClipboardGtk):
* platform/mac/ClipboardMac.h:
(ClipboardMac):
* platform/mac/ClipboardMac.mm:
(WebCore::addHTMLClipboardTypesForCocoaType):
(WebCore::ClipboardMac::types):
* platform/qt/ClipboardQt.cpp:
(WebCore::ClipboardQt::types):
* platform/qt/ClipboardQt.h:
(ClipboardQt):
* platform/win/ClipboardWin.cpp:
(WebCore::addMimeTypesForFormat):
(WebCore::ClipboardWin::types):
* platform/win/ClipboardWin.h:
(ClipboardWin):
* platform/wx/ClipboardWx.cpp:
(WebCore::ClipboardWx::types):
* platform/wx/ClipboardWx.h:
(ClipboardWx):

LayoutTests:

* editing/pasteboard/clipboard-customData.html:
* editing/pasteboard/onpaste-text-html-types.html:
* fast/events/drag-and-drop-dataTransfer-types-nocrash.html:
* fast/events/drag-customData.html:
* fast/events/drag-dataTransfer-live-attributes-expected.txt: Removed.
* fast/events/drag-dataTransfer-live-attributes.html: Removed.
* http/tests/local/fileapi/resources/setup-file-input-element-for-drag.js:
* http/tests/security/clipboard/script-tests/clipboard-file-access.js:
(checkForEventTransferType):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109182 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/clipboard-customData.html
LayoutTests/editing/pasteboard/onpaste-text-html-types.html
LayoutTests/fast/events/drag-and-drop-dataTransfer-types-nocrash.html
LayoutTests/fast/events/drag-customData.html
LayoutTests/fast/events/drag-dataTransfer-live-attributes-expected.txt [deleted file]
LayoutTests/fast/events/drag-dataTransfer-live-attributes.html [deleted file]
LayoutTests/http/tests/local/fileapi/resources/setup-file-input-element-for-drag.js
LayoutTests/http/tests/security/clipboard/script-tests/clipboard-file-access.js
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSClipboardCustom.cpp
Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
Source/WebCore/dom/Clipboard.cpp
Source/WebCore/dom/Clipboard.h
Source/WebCore/dom/Clipboard.idl
Source/WebCore/platform/blackberry/ClipboardBlackBerry.cpp
Source/WebCore/platform/blackberry/ClipboardBlackBerry.h
Source/WebCore/platform/chromium/ChromiumDataObject.cpp
Source/WebCore/platform/chromium/ChromiumDataObject.h
Source/WebCore/platform/chromium/ClipboardChromium.cpp
Source/WebCore/platform/chromium/ClipboardChromium.h
Source/WebCore/platform/chromium/DragDataChromium.cpp
Source/WebCore/platform/efl/ClipboardEfl.cpp
Source/WebCore/platform/efl/ClipboardEfl.h
Source/WebCore/platform/gtk/ClipboardGtk.cpp
Source/WebCore/platform/gtk/ClipboardGtk.h
Source/WebCore/platform/mac/ClipboardMac.h
Source/WebCore/platform/mac/ClipboardMac.mm
Source/WebCore/platform/qt/ClipboardQt.cpp
Source/WebCore/platform/qt/ClipboardQt.h
Source/WebCore/platform/win/ClipboardWin.cpp
Source/WebCore/platform/win/ClipboardWin.h
Source/WebCore/platform/wx/ClipboardWx.cpp
Source/WebCore/platform/wx/ClipboardWx.h

index 541a028..a8e9be8 100644 (file)
@@ -1,3 +1,21 @@
+2012-02-28  Daniel Cheng  <dcheng@chromium.org>
+
+        Unreviewed, rolling out r107894.
+        http://trac.webkit.org/changeset/107894
+        https://bugs.webkit.org/show_bug.cgi?id=30416
+
+        dataTransfer.types should be an Array since DOMStringList is deprecated.
+
+        * editing/pasteboard/clipboard-customData.html:
+        * editing/pasteboard/onpaste-text-html-types.html:
+        * fast/events/drag-and-drop-dataTransfer-types-nocrash.html:
+        * fast/events/drag-customData.html:
+        * fast/events/drag-dataTransfer-live-attributes-expected.txt: Removed.
+        * fast/events/drag-dataTransfer-live-attributes.html: Removed.
+        * http/tests/local/fileapi/resources/setup-file-input-element-for-drag.js:
+        * http/tests/security/clipboard/script-tests/clipboard-file-access.js:
+        (checkForEventTransferType):
+
 2012-02-27  MORITA Hajime  <morrita@google.com>
 
         <content> element should behave as HTMLUnknownElement outside of a shadow DOM subtree
index 0ce4cbb..31d99bb 100644 (file)
@@ -17,8 +17,8 @@ function copy(event) {
 
 function paste(event) {
     var failed = false;
-    if (!event.clipboardData.types.contains('text/plain')
-        || !event.clipboardData.types.contains('custom-data'))
+    if (event.clipboardData.types.indexOf('text/plain') < 0
+        || event.clipboardData.types.indexOf('custom-data') < 0)
         failed = true;
     if (event.clipboardData.getData('text') != 'sample'
         || event.clipboardData.getData('custom-data') != 'hello world')
index f87fbe5..3b74ce4 100644 (file)
@@ -8,7 +8,8 @@ during an onpaste event.  This test requires DRT.</div>
 function paste(ev)
 {
     var types = ev.clipboardData.types;
-    if (types.contains('text/plain') && types.contains('text/html'))
+    if (types.indexOf('text/plain') >= 0 &&
+        types.indexOf('text/html') >= 0)
         document.getElementById("results").innerHTML = "PASS";
 }
 
index 3739655..2128e40 100644 (file)
@@ -84,7 +84,7 @@
     {
         event = e;
         var formatTypes = e.dataTransfer.types; // This line causes the crash.
-        if (event.dataTransfer.types.contains(FORMAT_TYPE) == -1)
+        if (event.dataTransfer.types.indexOf(FORMAT_TYPE) == -1)
             testFailed('event.dataTransfer.types should contain format "' + FORMAT_TYPE + '", but it does not.');
         else
             testPassed('event.dataTransfer.types contains format "' + FORMAT_TYPE + '"');
index d8ce25c..dca57ef 100644 (file)
@@ -32,8 +32,8 @@ function dragover(event) {
 }
 function drop(event) {
     var failed = false;
-    if (!event.dataTransfer.types.contains('text/plain')
-        || !event.dataTransfer.types.contains('custom-data'))
+    if (event.dataTransfer.types.indexOf('text/plain') < 0
+        || event.dataTransfer.types.indexOf('custom-data') < 0)
         failed = true;
     if (event.dataTransfer.getData('text') != 'sample'
         || event.dataTransfer.getData('custom-data') != 'hello world')
diff --git a/LayoutTests/fast/events/drag-dataTransfer-live-attributes-expected.txt b/LayoutTests/fast/events/drag-dataTransfer-live-attributes-expected.txt
deleted file mode 100644 (file)
index 010acc1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-This is a test that various dataTransfer attributes are live and return the same object when accessed multiple times. To manually test, drag 'Drag Me' to 'Drop Here' and drop. The word 'SUCCESS' should appear.
-
-Drag Me
-Drop Here
-types != types
-files != files
-items != items
-FAILURE
-
diff --git a/LayoutTests/fast/events/drag-dataTransfer-live-attributes.html b/LayoutTests/fast/events/drag-dataTransfer-live-attributes.html
deleted file mode 100644 (file)
index 13aecdd..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<style>
-#drag {
-    border: 1px solid black;
-    height: 200px;
-    width: 200px;
-}
-#drop {
-    border: 1px solid black;
-    height: 200px;
-    width: 200px;
-}
-</style>
-<script>
-var failed;
-
-function log(str)
-{
-    var result = document.getElementById('result');
-    result.appendChild(document.createTextNode(str));
-    result.appendChild(document.createElement('br'));
-}
-function dragstart(event)
-{
-    failed = false;
-    event.dataTransfer.setData('text', 'sample');
-    if (event.dataTransfer.types != event.dataTransfer.types) {
-        failed = true;
-        log('types != types');
-    }
-    if (event.dataTransfer.files != event.dataTransfer.files) {
-        failed = true;
-        log('files != files');
-    }
-    if (event.dataTransfer.items != event.dataTransfer.items) {
-        failed = true;
-        log('items != items');
-    }
-}
-function dragenter(event)
-{
-    event.preventDefault();
-}
-function dragover(event)
-{
-    event.preventDefault();
-}
-function drop(event)
-{
-    if (!event.dataTransfer.types.contains('text/plain'))
-        failed = true;
-    if (event.dataTransfer.getData('text') != 'sample')
-        failed = true;
-    log(failed ? 'FAILURE' : 'SUCCESS');
-    if (window.layoutTestController)
-        layoutTestController.notifyDone();
-}
-window.onload = function()
-{
-    if (!window.layoutTestController)
-        return;
-    layoutTestController.dumpAsText();
-    layoutTestController.waitUntilDone();
-
-    var dragElement = document.getElementById('drag');
-    eventSender.mouseMoveTo(dragElement.offsetLeft + dragElement.offsetWidth / 2,
-                            dragElement.offsetTop + dragElement.offsetHeight / 2);
-    eventSender.mouseDown();
-    eventSender.leapForward(100);
-    var dropElement = document.getElementById('drop');
-    eventSender.mouseMoveTo(dropElement.offsetLeft + dropElement.offsetWidth / 2,
-                            dropElement.offsetTop + dropElement.offsetHeight / 2);
-    eventSender.mouseUp();
-}
-</script>
-</head>
-<body>
-<p>This is a test that various dataTransfer attributes are live and return the same object when accessed multiple times. To manually test, drag 'Drag Me' to 'Drop Here' and drop. The word 'SUCCESS' should appear.
-<div draggable="true" id="drag" ondragstart="dragstart(event)">Drag Me</div>
-<div id="drop" ondragenter="dragenter(event)" ondragover="dragover(event)" ondrop="drop(event)">Drop Here</div>
-</div>
-<div id="result"></div>
-</body>
-</html>
index 378feb8..c51c680 100644 (file)
@@ -16,7 +16,7 @@ fileInput.addEventListener("dragover", function() {
 
 var fileInputDropCallback = null;
 fileInput.addEventListener("drop", function() {
-    if (event.dataTransfer.types.contains("Files") && event.dataTransfer.files.length == 1)
+    if (event.dataTransfer.types.indexOf("Files") != -1 && event.dataTransfer.files.length == 1)
         testPassed("event.dataTransfer contains a File object on drop.");
     else {
         testFailed("event.dataTransfer does not contain a File object on drop.");
index 9b28a0b..4b6368d 100644 (file)
@@ -75,7 +75,7 @@ function checkForEventTransferType(event, typeString, shouldContainType)
 {
     var passedCheck;
     var message;
-    if (event.dataTransfer.types && event.dataTransfer.types.contains(typeString)) {
+    if (event.dataTransfer.types && event.dataTransfer.types.indexOf(typeString) != -1) {
         passedCheck = shouldContainType;
         message = "event.dataTransfer.types contains " + typeString + ".";
     } else {
index c420959..3c5d7ba 100644 (file)
@@ -1,3 +1,69 @@
+2012-02-28  Daniel Cheng  <dcheng@chromium.org>
+
+        Unreviewed, rolling out r107894.
+        http://trac.webkit.org/changeset/107894
+        https://bugs.webkit.org/show_bug.cgi?id=30416
+
+        dataTransfer.types should be an Array since DOMStringList is deprecated.
+
+        * bindings/js/JSClipboardCustom.cpp:
+        (WebCore::JSClipboard::types):
+        (WebCore):
+        * bindings/v8/custom/V8ClipboardCustom.cpp:
+        (WebCore::V8Clipboard::typesAccessorGetter):
+        (WebCore):
+        * dom/Clipboard.cpp:
+        (WebCore::Clipboard::hasStringOfType):
+        * dom/Clipboard.h:
+        (Clipboard):
+        * dom/Clipboard.idl:
+        * platform/blackberry/ClipboardBlackBerry.cpp:
+        (WebCore::ClipboardBlackBerry::types):
+        * platform/blackberry/ClipboardBlackBerry.h:
+        (ClipboardBlackBerry):
+        * platform/chromium/ChromiumDataObject.cpp:
+        (WebCore::ChromiumDataObject::types):
+        * platform/chromium/ChromiumDataObject.h:
+        (ChromiumDataObject):
+        * platform/chromium/ClipboardChromium.cpp:
+        (WebCore::ClipboardChromium::types):
+        (WebCore::ClipboardChromium::mayUpdateItems):
+        * platform/chromium/ClipboardChromium.h:
+        (ClipboardChromium):
+        * platform/chromium/DragDataChromium.cpp:
+        (WebCore::containsHTML):
+        (WebCore::DragData::containsURL):
+        (WebCore::DragData::asURL):
+        (WebCore::DragData::containsPlainText):
+        (WebCore::DragData::canSmartReplace):
+        (WebCore::DragData::asFragment):
+        * platform/efl/ClipboardEfl.cpp:
+        (WebCore::ClipboardEfl::types):
+        * platform/efl/ClipboardEfl.h:
+        (ClipboardEfl):
+        * platform/gtk/ClipboardGtk.cpp:
+        (WebCore::ClipboardGtk::types):
+        * platform/gtk/ClipboardGtk.h:
+        (ClipboardGtk):
+        * platform/mac/ClipboardMac.h:
+        (ClipboardMac):
+        * platform/mac/ClipboardMac.mm:
+        (WebCore::addHTMLClipboardTypesForCocoaType):
+        (WebCore::ClipboardMac::types):
+        * platform/qt/ClipboardQt.cpp:
+        (WebCore::ClipboardQt::types):
+        * platform/qt/ClipboardQt.h:
+        (ClipboardQt):
+        * platform/win/ClipboardWin.cpp:
+        (WebCore::addMimeTypesForFormat):
+        (WebCore::ClipboardWin::types):
+        * platform/win/ClipboardWin.h:
+        (ClipboardWin):
+        * platform/wx/ClipboardWx.cpp:
+        (WebCore::ClipboardWx::types):
+        * platform/wx/ClipboardWx.h:
+        (ClipboardWx):
+
 2012-02-28  Simon Fraser  <simon.fraser@apple.com>
 
         Update WebKitSystemInterface.
index 6c1217e..8cfd65a 100644 (file)
@@ -48,6 +48,21 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
+JSValue JSClipboard::types(ExecState* exec) const
+{
+    Clipboard* clipboard = impl();
+
+    HashSet<String> types = clipboard->types();
+    if (types.isEmpty())
+        return jsNull();
+
+    MarkedArgumentBuffer list;
+    HashSet<String>::const_iterator end = types.end();
+    for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it)
+        list.append(jsString(exec, stringToUString(*it)));
+    return constructArray(exec, globalObject(), list);
+}
+
 JSValue JSClipboard::clearData(ExecState* exec)
 {
     Clipboard* clipboard = impl();
index 665270c..b336610 100644 (file)
 
 namespace WebCore {
 
+v8::Handle<v8::Value> V8Clipboard::typesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.Clipboard.types()");
+    Clipboard* clipboard = V8Clipboard::toNative(info.Holder());
+
+    HashSet<String> types = clipboard->types();
+    if (types.isEmpty())
+        return v8::Null();
+
+    v8::Local<v8::Array> result = v8::Array::New(types.size());
+    HashSet<String>::const_iterator end = types.end();
+    int index = 0;
+    for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index)
+        result->Set(v8::Integer::New(index), v8String(*it));
+
+    return result;
+}
+
 v8::Handle<v8::Value> V8Clipboard::clearDataCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.Clipboard.clearData()");
index 2053292..0279925 100644 (file)
@@ -27,7 +27,6 @@
 #include "Clipboard.h"
 
 #include "CachedImage.h"
-#include "DOMStringList.h"
 #include "FileList.h"
 #include "Frame.h"
 #include "FrameLoader.h"
@@ -148,7 +147,7 @@ bool Clipboard::hasStringOfType(const String& type) const
     if (m_policy != ClipboardReadable && m_policy != ClipboardTypesReadable)
         return false;
     
-    return types()->contains(type);
+    return types().contains(type); 
 }
     
 void Clipboard::setDropEffect(const String &effect)
index f46502d..83f0f24 100644 (file)
@@ -33,7 +33,6 @@
 
 namespace WebCore {
 
-    class DOMStringList;
     class DataTransferItemList;
     class DragData;
     class FileList;
@@ -67,7 +66,7 @@ namespace WebCore {
         virtual bool setData(const String& type, const String& data) = 0;
     
         // extensions beyond IE's API
-        virtual PassRefPtr<DOMStringList> types() const = 0;
+        virtual HashSet<String> types() const = 0;
         virtual PassRefPtr<FileList> files() const = 0;
 
         IntPoint dragLocation() const { return m_dragLoc; }
index 7de91ca..c94621b 100644 (file)
@@ -31,7 +31,7 @@ module core {
     interface Clipboard {
                  attribute [TreatReturnedNullStringAs=Undefined] DOMString dropEffect;
                  attribute [TreatReturnedNullStringAs=Undefined] DOMString effectAllowed;
-        readonly attribute DOMStringList types;
+        readonly attribute [CustomGetter] Array types;
         readonly attribute FileList files;
 
         [Custom] void clearData(in [Optional] DOMString type)
index 1423278..66b7710 100644 (file)
@@ -19,7 +19,6 @@
 #include "config.h"
 #include "ClipboardBlackBerry.h"
 
-#include "DOMStringList.h"
 #include "FileList.h"
 #include "NotImplemented.h"
 
@@ -72,14 +71,14 @@ bool ClipboardBlackBerry::setData(const String& type, const String& text)
     return true;
 }
 
-PassRefPtr<DOMStringList> ClipboardBlackBerry::types() const
+HashSet<String> ClipboardBlackBerry::types() const
 {
     // We use hardcoded list here since there seems to be no API to get the list.
-    RefPtr<DOMStringList> ret = DOMStringList::create();
-    ret->append("text/plain");
-    ret->append("text/html");
-    ret->append("text/url");
-    return ret.release();
+    HashSet<String> ret;
+    ret.add("text/plain");
+    ret.add("text/html");
+    ret.add("text/url");
+    return ret;
 }
 
 PassRefPtr<FileList> ClipboardBlackBerry::files() const
index 0113e01..fed1627 100644 (file)
@@ -36,7 +36,7 @@ public:
     bool setData(const String& type, const String& data);
 
     // extensions beyond IE's API
-    virtual PassRefPtr<DOMStringList> types() const;
+    virtual HashSet<String> types() const;
     virtual PassRefPtr<FileList> files() const;
     virtual DragImageRef createDragImage(IntPoint&) const;
     virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
index d6b73e5..6ad10c7 100644 (file)
@@ -101,36 +101,33 @@ bool ChromiumDataObject::hasData() const
         || m_fileContent;
 }
 
-PassRefPtr<DOMStringList> ChromiumDataObject::types() const
+HashSet<String> ChromiumDataObject::types() const
 {
-    RefPtr<DOMStringList> results = DOMStringList::create();
-
     if (m_storageMode == Pasteboard) {
         bool ignoredContainsFilenames;
-        HashSet<String> hashedResults = PlatformSupport::clipboardReadAvailableTypes(
-            currentPasteboardBuffer(), &ignoredContainsFilenames);
-        for (HashSet<String>::const_iterator it = hashedResults.begin(); it != hashedResults.end(); ++it)
-          results->append(*it);
-        return results.release();
+        return PlatformSupport::clipboardReadAvailableTypes(currentPasteboardBuffer(),
+                                                            &ignoredContainsFilenames);
     }
 
+    HashSet<String> results;
+
     if (!m_plainText.isEmpty()) {
-        results->append(mimeTypeText);
-        results->append(mimeTypeTextPlain);
+        results.add(mimeTypeText);
+        results.add(mimeTypeTextPlain);
     }
 
     if (!m_uriList.isEmpty())
-        results->append(mimeTypeTextURIList);
+        results.add(mimeTypeTextURIList);
 
     if (!m_textHtml.isEmpty())
-        results->append(mimeTypeTextHTML);
+        results.add(mimeTypeTextHTML);
 
     for (HashMap<String, String>::const_iterator::Keys it = m_customData.begin().keys();
          it != m_customData.end().keys(); ++it) {
-        results->append(*it);
+        results.add(*it);
     }
 
-    return results.release();
+    return results;
 }
 
 String ChromiumDataObject::getData(const String& type, bool& success) const
index 9a6f562..7e675bf 100644 (file)
 #ifndef ChromiumDataObject_h
 #define ChromiumDataObject_h
 
-#include "DOMStringList.h"
 #include "KURL.h"
 #include "PlatformString.h"
 #include "SharedBuffer.h"
 #include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
@@ -75,7 +75,7 @@ public:
 
     bool hasData() const;
 
-    PassRefPtr<DOMStringList> types() const;
+    HashSet<String> types() const;
     String getData(const String& type, bool& success) const;
     bool setData(const String& type, const String& data);
 
index 18cdb9d..e238b2d 100644 (file)
@@ -31,7 +31,6 @@
 #include "ChromiumDataObject.h"
 #include "ClipboardMimeTypes.h"
 #include "ClipboardUtilitiesChromium.h"
-#include "DOMStringList.h"
 #include "DataTransferItemChromium.h"
 #include "DataTransferItemListChromium.h"
 #include "Document.h"
@@ -290,20 +289,21 @@ bool ClipboardChromium::platformClipboardChanged() const
 }
 
 // extensions beyond IE's API
-PassRefPtr<DOMStringList> ClipboardChromium::types() const
+HashSet<String> ClipboardChromium::types() const
 {
+    HashSet<String> results;
     if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
-        return DOMStringList::create();
+        return results;
 
     if (!m_dataObject)
-        return DOMStringList::create();
+        return results;
 
-    RefPtr<DOMStringList> results = m_dataObject->types();
+    results = m_dataObject->types();
 
     if (m_dataObject->containsFilenames())
-        results->append(mimeTypeFiles);
+        results.add(mimeTypeFiles);
 
-    return results.release();
+    return results;
 }
 
 PassRefPtr<FileList> ClipboardChromium::files() const
@@ -518,9 +518,9 @@ void ClipboardChromium::mayUpdateItems(Vector<RefPtr<DataTransferItem> >& items)
 
     if (isForCopyAndPaste() && policy() == ClipboardReadable) {
         // Iterate through the types and add them.
-        RefPtr<DOMStringList> types = m_dataObject->types();
-        for (size_t i = 0; i < types->length(); ++i)
-            items.append(DataTransferItemChromium::createFromPasteboard(this, scriptExecutionContext, types->item(i)));
+        HashSet<String> types = m_dataObject->types();
+        for (HashSet<String>::const_iterator it = types.begin(); it != types.end(); ++it)
+            items.append(DataTransferItemChromium::createFromPasteboard(this, scriptExecutionContext, *it));
         return;
     }
 
index 805975a..3777ad5 100644 (file)
@@ -63,7 +63,7 @@ namespace WebCore {
         bool platformClipboardChanged() const;
 
         // extensions beyond IE's API
-        virtual PassRefPtr<DOMStringList> types() const;
+        virtual HashSet<String> types() const;
         virtual PassRefPtr<FileList> files() const;
 
         void setDragImage(CachedImage*, const IntPoint&);
index a7a8535..3d94a19 100644 (file)
@@ -45,19 +45,19 @@ namespace WebCore {
 
 static bool containsHTML(const ChromiumDataObject* dropData)
 {
-    return dropData->types()->contains(mimeTypeTextHTML);
+    return dropData->types().contains(mimeTypeTextHTML);
 }
 
 bool DragData::containsURL(Frame*, FilenameConversionPolicy filenamePolicy) const
 {
-    return m_platformDragData->types()->contains(mimeTypeTextURIList)
+    return m_platformDragData->types().contains(mimeTypeTextURIList)
         || (filenamePolicy == ConvertFilenames && m_platformDragData->containsFilenames());
 }
 
 String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* title) const
 {
     String url;
-    if (m_platformDragData->types()->contains(mimeTypeTextURIList)) {
+    if (m_platformDragData->types().contains(mimeTypeTextURIList)) {
         bool ignoredSuccess;
         url = m_platformDragData->getData(mimeTypeURL, ignoredSuccess);
         if (title)
@@ -87,7 +87,7 @@ void DragData::asFilenames(Vector<String>& result) const
 
 bool DragData::containsPlainText() const
 {
-    return m_platformDragData->types()->contains(mimeTypeTextPlain);
+    return m_platformDragData->types().contains(mimeTypeTextPlain);
 }
 
 String DragData::asPlainText(Frame*) const
@@ -108,8 +108,8 @@ bool DragData::canSmartReplace() const
     // This is allowed whenever the drag data contains a 'range' (ie.,
     // ClipboardWin::writeRange is called).  For example, dragging a link
     // should not result in a space being added.
-    return m_platformDragData->types()->contains(mimeTypeTextPlain)
-        && !m_platformDragData->types()->contains(mimeTypeTextURIList);
+    return m_platformDragData->types().contains(mimeTypeTextPlain)
+        && !m_platformDragData->types().contains(mimeTypeTextURIList);
 }
 
 bool DragData::containsCompatibleContent() const
@@ -141,7 +141,7 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, PassRefPtr<Range
         //    return fragment;
     }
 
-    if (m_platformDragData->types()->contains(mimeTypeTextHTML)) {
+    if (m_platformDragData->types().contains(mimeTypeTextHTML)) {
         bool ignoredSuccess;
         RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(),
             m_platformDragData->getData(mimeTypeTextHTML, ignoredSuccess), m_platformDragData->htmlBaseUrl(), FragmentScriptingNotAllowed);
index 63e5615..884d387 100644 (file)
@@ -21,7 +21,6 @@
 #include "config.h"
 #include "ClipboardEfl.h"
 
-#include "DOMStringList.h"
 #include "DataTransferItemList.h"
 #include "Editor.h"
 #include "FileList.h"
@@ -77,10 +76,10 @@ bool ClipboardEfl::setData(const String&, const String&)
     return false;
 }
 
-PassRefPtr<DOMStringList> ClipboardEfl::types() const
+HashSet<String> ClipboardEfl::types() const
 {
     notImplemented();
-    return DOMStringList::create();
+    return HashSet<String>();
 }
 
 PassRefPtr<FileList> ClipboardEfl::files() const
index 02bb528..3da598e 100644 (file)
@@ -39,7 +39,7 @@ public:
     String getData(const String&) const;
     bool setData(const String&, const String&);
 
-    PassRefPtr<DOMStringList> types() const;
+    HashSet<String> types() const;
     virtual PassRefPtr<FileList> files() const;
 
     IntPoint dragLocation() const;
index ac97622..b22adf4 100644 (file)
@@ -18,7 +18,6 @@
 #include "ClipboardGtk.h"
 
 #include "CachedImage.h"
-#include "DOMStringList.h"
 #include "DragData.h"
 #include "Editor.h"
 #include "Element.h"
@@ -185,33 +184,33 @@ bool ClipboardGtk::setData(const String& typeString, const String& data)
     return success;
 }
 
-PassRefPtr<DOMStringList> ClipboardGtk::types() const
+HashSet<String> ClipboardGtk::types() const
 {
     if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
-        return DOMStringList::create();
+        return HashSet<String>();
 
     if (m_clipboard)
         PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_clipboard);
 
-    RefPtr<DOMStringList> types = DOMStringList::create();
+    HashSet<String> types;
     if (m_dataObject->hasText()) {
-        types->append("text/plain");
-        types->append("Text");
-        types->append("text");
+        types.add("text/plain");
+        types.add("Text");
+        types.add("text");
     }
 
     if (m_dataObject->hasMarkup())
-        types->append("text/html");
+        types.add("text/html");
 
     if (m_dataObject->hasURIList()) {
-        types->append("text/uri-list");
-        types->append("URL");
+        types.add("text/uri-list");
+        types.add("URL");
     }
 
     if (m_dataObject->hasFilenames())
-        types->append("Files");
+        types.add("Files");
 
-    return types.release();
+    return types;
 }
 
 PassRefPtr<FileList> ClipboardGtk::files() const
index 6ad14b7..9af53e5 100644 (file)
@@ -57,7 +57,7 @@ namespace WebCore {
         String getData(const String&) const;
         bool setData(const String&, const String&);
 
-        virtual PassRefPtr<DOMStringList> types() const;
+        virtual HashSet<String> types() const;
         virtual PassRefPtr<FileList> files() const;
 
         void setDragImage(CachedImage*, const IntPoint&);
index f0285ac..7f6ad85 100644 (file)
@@ -55,7 +55,7 @@ public:
     virtual bool hasData();
     
     // extensions beyond IE's API
-    virtual PassRefPtr<DOMStringList> types() const;
+    virtual HashSet<String> types() const;
     virtual PassRefPtr<FileList> files() const;
 
     void setDragImage(CachedImage*, const IntPoint&);
index 0ccff00..a4933f3 100644 (file)
@@ -27,7 +27,6 @@
 #import "ClipboardMac.h"
 
 #import "DOMElementInternal.h"
-#import "DOMStringList.h"
 #import "DragClient.h"
 #import "DragController.h"
 #import "DragData.h"
@@ -112,15 +111,15 @@ static String utiTypeFromCocoaType(const String& type)
     return String();
 }
 
-static void addHTMLClipboardTypesForCocoaType(DOMStringList* resultTypes, const String& cocoaType, const String& pasteboardName)
+static void addHTMLClipboardTypesForCocoaType(HashSet<String>& resultTypes, const String& cocoaType, const String& pasteboardName)
 {
     // UTI may not do these right, so make sure we get the right, predictable result
     if (cocoaType == String(NSStringPboardType)) {
-        resultTypes->append("text/plain");
+        resultTypes.add("text/plain");
         return;
     }
     if (cocoaType == String(NSURLPboardType)) {
-        resultTypes->append("text/uri-list");
+        resultTypes.add("text/uri-list");
         return;
     }
     if (cocoaType == String(NSFilenamesPboardType)) {
@@ -132,18 +131,18 @@ static void addHTMLClipboardTypesForCocoaType(DOMStringList* resultTypes, const
         if (!fileList.isEmpty()) {
             // It is unknown if NSFilenamesPboardType always implies NSURLPboardType in Cocoa,
             // but NSFilenamesPboardType should imply both 'text/uri-list' and 'Files'
-            resultTypes->append("text/uri-list");
-            resultTypes->append("Files");
+            resultTypes.add("text/uri-list");
+            resultTypes.add("Files");
         }
         return;
     }
     String utiType = utiTypeFromCocoaType(cocoaType);
     if (!utiType.isEmpty()) {
-        resultTypes->append(utiType);
+        resultTypes.add(utiType);
         return;
     }
     // No mapping, just pass the whole string though
-    resultTypes->append(cocoaType);
+    resultTypes.add(cocoaType);
 }
 
 void ClipboardMac::clearData(const String& type)
@@ -282,10 +281,10 @@ bool ClipboardMac::setData(const String &type, const String &data)
     return false;
 }
 
-PassRefPtr<DOMStringList> ClipboardMac::types() const
+HashSet<String> ClipboardMac::types() const
 {
     if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
-        return DOMStringList::create();
+        return HashSet<String>();
 
     Vector<String> types;
     platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
@@ -293,19 +292,19 @@ PassRefPtr<DOMStringList> ClipboardMac::types() const
     // Enforce changeCount ourselves for security.  We check after reading instead of before to be
     // sure it doesn't change between our testing the change count and accessing the data.
     if (m_changeCount != platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName))
-        return DOMStringList::create();
+        return HashSet<String>();
 
-    RefPtr<DOMStringList> result = DOMStringList::create();
+    HashSet<String> result;
     // FIXME: This loop could be split into two stages. One which adds all the HTML5 specified types
     // and a second which adds all the extra types from the cocoa clipboard (which is Mac-only behavior).
     for (size_t i = 0; i < types.size(); i++) {
         if (types[i] == "NeXT plain ascii pasteboard type")
             continue;   // skip this ancient type that gets auto-supplied by some system conversion
 
-        addHTMLClipboardTypesForCocoaType(result.get(), types[i], m_pasteboardName);
+        addHTMLClipboardTypesForCocoaType(result, types[i], m_pasteboardName);
     }
 
-    return result.release();
+    return result;
 }
 
 // FIXME: We could cache the computed fileList if necessary
index dff1bb7..6d2ab72 100644 (file)
@@ -30,7 +30,6 @@
 #include "ClipboardQt.h"
 
 #include "CachedImage.h"
-#include "DOMStringList.h"
 #include "DataTransferItemListQt.h"
 #include "Document.h"
 #include "DragData.h"
@@ -183,17 +182,17 @@ bool ClipboardQt::setData(const String& type, const String& data)
 }
 
 // extensions beyond IE's API
-PassRefPtr<DOMStringList> ClipboardQt::types() const
+HashSet<String> ClipboardQt::types() const
 {
     if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
-        return DOMStringList::create();
+        return HashSet<String>();
 
     ASSERT(m_readableData);
-    RefPtr<DOMStringList> result = DOMStringList::create();
+    HashSet<String> result;
     QStringList formats = m_readableData->formats();
     for (int i = 0; i < formats.count(); ++i)
-        result->append(formats.at(i));
-    return result.release();
+        result.add(formats.at(i));
+    return result;
 }
 
 PassRefPtr<FileList> ClipboardQt::files() const
index e93f41f..a03fa3b 100644 (file)
@@ -57,7 +57,7 @@ public:
     bool setData(const String& type, const String& data);
 
     // extensions beyond IE's API
-    virtual PassRefPtr<DOMStringList> types() const;
+    virtual HashSet<String> types() const;
     virtual PassRefPtr<FileList> files() const;
 
     void setDragImage(CachedImage*, const IntPoint&);
index 0801f29..12cb8bf 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "CachedImage.h"
 #include "ClipboardUtilitiesWin.h"
-#include "DOMStringList.h"
 #include "Document.h"
 #include "DragData.h"
 #include "Editor.h"
@@ -485,24 +484,24 @@ bool ClipboardWin::setData(const String& type, const String& data)
     return false;
 }
 
-static void addMimeTypesForFormat(DOMStringList* results, const FORMATETC& format)
+static void addMimeTypesForFormat(HashSet<String>& results, const FORMATETC& format)
 {
     // URL and Text are provided for compatibility with IE's model
     if (format.cfFormat == urlFormat()->cfFormat || format.cfFormat == urlWFormat()->cfFormat) {
-        results->append("URL");
-        results->append("text/uri-list");
+        results.add("URL");
+        results.add("text/uri-list");
     }
 
     if (format.cfFormat == plainTextWFormat()->cfFormat || format.cfFormat == plainTextFormat()->cfFormat) {
-        results->append("Text");
-        results->append("text/plain");
+        results.add("Text");
+        results.add("text/plain");
     }
 }
 
 // extensions beyond IE's API
-PassRefPtr<DOMStringList> ClipboardWin::types() const
+HashSet<String> ClipboardWin::types() const
 { 
-    RefPtr<DOMStringList> results = DOMStringList::create();
+    HashSet<String> results; 
     if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
         return results;
 
@@ -522,16 +521,16 @@ PassRefPtr<DOMStringList> ClipboardWin::types() const
 
         // IEnumFORMATETC::Next returns S_FALSE if there are no more items.
         while (itr->Next(1, &data, 0) == S_OK)
-            addMimeTypesForFormat(results.get(), data);
+            addMimeTypesForFormat(results, data);
     } else {
         for (DragDataMap::const_iterator it = m_dragDataMap.begin(); it != m_dragDataMap.end(); ++it) {
             FORMATETC data;
             data.cfFormat = (*it).first;
-            addMimeTypesForFormat(results.get(), data);
+            addMimeTypesForFormat(results, data);
         }
     }
 
-    return results.release();
+    return results;
 }
 
 PassRefPtr<FileList> ClipboardWin::files() const
index 59245c9..d56ea19 100644 (file)
@@ -64,7 +64,7 @@ public:
     bool setData(const String& type, const String& data);
 
     // extensions beyond IE's API
-    virtual PassRefPtr<DOMStringList> types() const;
+    virtual HashSet<String> types() const;
     virtual PassRefPtr<FileList> files() const;
 
     void setDragImage(CachedImage*, const IntPoint&);
index 8bb9707..8a3a9c8 100644 (file)
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "ClipboardWx.h"
 
-#include "DOMStringList.h"
 #include "FileList.h"
 #include "HashTable.h"
 #include "IntPoint.h"
@@ -71,10 +70,11 @@ bool ClipboardWx::setData(const String& type, const String& data)
 }
 
 // extensions beyond IE's API
-PassRefPtr<DOMStringList> ClipboardWx::types() const 
+HashSet<String> ClipboardWx::types() const 
 {
     notImplemented();
-    return DOMStringList::create();
+    HashSet<String> result;
+    return result;
 }
 
 PassRefPtr<FileList> ClipboardWx::files() const
index 0ed7baf..9e661d7 100644 (file)
@@ -46,7 +46,7 @@ namespace WebCore {
         bool setData(const String& type, const String& data);
     
         // extensions beyond IE's API
-        virtual PassRefPtr<DOMStringList> types() const;
+        virtual HashSet<String> types() const;
         virtual PassRefPtr<FileList> files() const;
     
         IntPoint dragLocation() const;