Diff
Modified: trunk/Source/WebCore/ChangeLog (154577 => 154578)
--- trunk/Source/WebCore/ChangeLog 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/ChangeLog 2013-08-25 17:24:02 UTC (rev 154578)
@@ -1,3 +1,33 @@
+2013-08-25 Darin Adler <[email protected]>
+
+ Make _javascript_ binding for Clipboard::types more normal
+ https://bugs.webkit.org/show_bug.cgi?id=120271
+
+ Reviewed by Anders Carlsson.
+
+ * bindings/js/JSClipboardCustom.cpp:
+ (WebCore::JSClipboard::types): Make a simple custom binding. Only needed because
+ there is a special value, null, this can return.
+
+ * dom/Clipboard.cpp:
+ (WebCore::Clipboard::types): Return Vector<String> instead of ListHashSet<String>.
+ * dom/Clipboard.h: Ditto.
+ * platform/Pasteboard.h: Ditto.
+ * platform/blackberry/PasteboardBlackBerry.cpp:
+ (WebCore::Pasteboard::types): Ditto.
+ * platform/efl/PasteboardEfl.cpp:
+ (WebCore::Pasteboard::types): Ditto.
+ * platform/gtk/PasteboardGtk.cpp:
+ (WebCore::Pasteboard::types): Ditto.
+ * platform/ios/PasteboardIOS.mm:
+ (WebCore::Pasteboard::types): Ditto.
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::types): Ditto.
+ * platform/qt/PasteboardQt.cpp:
+ (WebCore::Pasteboard::types): Ditto.
+ * platform/win/PasteboardWin.cpp:
+ (WebCore::Pasteboard::types): Ditto.
+
2013-08-25 David Kilzer <[email protected]>
Unreviewed rollout of r154571. Broke internal iOS build.
Modified: trunk/Source/WebCore/bindings/js/JSClipboardCustom.cpp (154577 => 154578)
--- trunk/Source/WebCore/bindings/js/JSClipboardCustom.cpp 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/bindings/js/JSClipboardCustom.cpp 2013-08-25 17:24:02 UTC (rev 154578)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,36 +30,15 @@
#include "JSClipboard.h"
#include "Clipboard.h"
-#include "Element.h"
-#include "HTMLImageElement.h"
-#include "HTMLNames.h"
-#include "IntPoint.h"
-#include "JSNode.h"
-#include "Node.h"
-#include <runtime/ArrayPrototype.h>
-#include <runtime/Error.h>
-#include <wtf/text/StringHash.h>
-#include <wtf/text/WTFString.h>
using namespace JSC;
namespace WebCore {
-using namespace HTMLNames;
-
JSValue JSClipboard::types(ExecState* exec) const
{
- Clipboard* clipboard = impl();
-
- ListHashSet<String> types = clipboard->types();
- if (types.isEmpty())
- return jsNull();
-
- MarkedArgumentBuffer list;
- ListHashSet<String>::const_iterator end = types.end();
- for (ListHashSet<String>::const_iterator it = types.begin(); it != end; ++it)
- list.append(jsStringWithCache(exec, *it));
- return constructArray(exec, 0, globalObject(), list);
+ Vector<String> types = impl()->types();
+ return types.isEmpty() ? jsNull() : jsArray(exec, globalObject(), types);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/Clipboard.cpp (154577 => 154578)
--- trunk/Source/WebCore/dom/Clipboard.cpp 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/dom/Clipboard.cpp 2013-08-25 17:24:02 UTC (rev 154578)
@@ -150,10 +150,10 @@
return m_pasteboard->writeString(type, data);
}
-ListHashSet<String> Clipboard::types() const
+Vector<String> Clipboard::types() const
{
if (!canReadTypes())
- return ListHashSet<String>();
+ return Vector<String>();
return m_pasteboard->types();
}
Modified: trunk/Source/WebCore/dom/Clipboard.h (154577 => 154578)
--- trunk/Source/WebCore/dom/Clipboard.h 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/dom/Clipboard.h 2013-08-25 17:24:02 UTC (rev 154578)
@@ -29,7 +29,6 @@
#include "DragActions.h"
#include "DragImage.h"
#include "IntPoint.h"
-#include <wtf/ListHashSet.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -55,7 +54,7 @@
String effectAllowed() const;
void setEffectAllowed(const String&);
- ListHashSet<String> types() const;
+ Vector<String> types() const;
PassRefPtr<FileList> files() const;
Modified: trunk/Source/WebCore/platform/Pasteboard.h (154577 => 154578)
--- trunk/Source/WebCore/platform/Pasteboard.h 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/Pasteboard.h 2013-08-25 17:24:02 UTC (rev 154578)
@@ -27,7 +27,6 @@
#define Pasteboard_h
#include "DragImage.h"
-#include <wtf/ListHashSet.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
@@ -123,7 +122,7 @@
#endif
bool hasData();
- ListHashSet<String> types();
+ Vector<String> types();
String readString(const String& type);
Vector<String> readFilenames();
Modified: trunk/Source/WebCore/platform/blackberry/PasteboardBlackBerry.cpp (154577 => 154578)
--- trunk/Source/WebCore/platform/blackberry/PasteboardBlackBerry.cpp 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/blackberry/PasteboardBlackBerry.cpp 2013-08-25 17:24:02 UTC (rev 154578)
@@ -155,11 +155,11 @@
return false;
}
-ListHashSet<String> Pasteboard::types()
+Vector<String> Pasteboard::types()
{
// We use hardcoded list here since there seems to be no API to get the list.
// FIXME: Should omit types where we have no data, using the same functions used above in Pasteboard::hasData.
- ListHashSet<String> types;
+ Vector<String> types;
types.add("text/plain");
types.add("text/html");
types.add("text/url");
Modified: trunk/Source/WebCore/platform/efl/PasteboardEfl.cpp (154577 => 154578)
--- trunk/Source/WebCore/platform/efl/PasteboardEfl.cpp 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/efl/PasteboardEfl.cpp 2013-08-25 17:24:02 UTC (rev 154578)
@@ -128,10 +128,10 @@
return false;
}
-ListHashSet<String> Pasteboard::types()
+Vector<String> Pasteboard::types()
{
notImplemented();
- return ListHashSet<String>();
+ return Vector<String>();
}
Vector<String> Pasteboard::readFilenames()
Modified: trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp (154577 => 154578)
--- trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp 2013-08-25 17:24:02 UTC (rev 154578)
@@ -361,28 +361,28 @@
return m_dataObject->hasText() || m_dataObject->hasMarkup() || m_dataObject->hasURIList() || m_dataObject->hasImage();
}
-ListHashSet<String> Pasteboard::types()
+Vector<String> Pasteboard::types()
{
if (m_gtkClipboard)
PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_gtkClipboard);
- ListHashSet<String> types;
+ Vector<String> types;
if (m_dataObject->hasText()) {
- types.add(ASCIILiteral("text/plain"));
- types.add(ASCIILiteral("Text"));
- types.add(ASCIILiteral("text"));
+ types.append(ASCIILiteral("text/plain"));
+ types.append(ASCIILiteral("Text"));
+ types.append(ASCIILiteral("text"));
}
if (m_dataObject->hasMarkup())
- types.add(ASCIILiteral("text/html"));
+ types.append(ASCIILiteral("text/html"));
if (m_dataObject->hasURIList()) {
- types.add(ASCIILiteral("text/uri-list"));
- types.add(ASCIILiteral("URL"));
+ types.append(ASCIILiteral("text/uri-list"));
+ types.append(ASCIILiteral("URL"));
}
if (m_dataObject->hasFilenames())
- types.add(ASCIILiteral("Files"));
+ types.append(ASCIILiteral("Files"));
return types;
}
Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (154577 => 154578)
--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2013-08-25 17:24:02 UTC (rev 154578)
@@ -608,7 +608,7 @@
return true;
}
-ListHashSet<String> Pasteboard::types()
+Vector<String> Pasteboard::types()
{
NSArray* types = supportedPasteboardTypes();
@@ -624,7 +624,9 @@
addHTMLClipboardTypesForCocoaType(result, type);
}
- return result;
+ Vector<String> vector;
+ copyToVector(result, vector);
+ return vector;
}
Vector<String> Pasteboard::readFilenames()
Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (154577 => 154578)
--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2013-08-25 17:24:02 UTC (rev 154578)
@@ -795,7 +795,7 @@
return false;
}
-ListHashSet<String> Pasteboard::types()
+Vector<String> Pasteboard::types()
{
Vector<String> types;
platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
@@ -803,7 +803,7 @@
// 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 ListHashSet<String>();
+ return Vector<String>();
ListHashSet<String> result;
// FIXME: This loop could be split into two stages. One which adds all the HTML5 specified types
@@ -815,7 +815,8 @@
addHTMLClipboardTypesForCocoaType(result, types[i], m_pasteboardName);
}
- return result;
+ copyToVector(result, types);
+ return types;
}
Vector<String> Pasteboard::readFilenames()
Modified: trunk/Source/WebCore/platform/qt/PasteboardQt.cpp (154577 => 154578)
--- trunk/Source/WebCore/platform/qt/PasteboardQt.cpp 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/qt/PasteboardQt.cpp 2013-08-25 17:24:02 UTC (rev 154578)
@@ -315,18 +315,19 @@
return true;
}
-// extensions beyond IE's API
-ListHashSet<String> Pasteboard::types()
+Vector<String> Pasteboard::types()
{
const QMimeData* data = ""
if (!data)
- return ListHashSet<String>();
+ return Vector<String>();
ListHashSet<String> result;
QStringList formats = data->formats();
for (int i = 0; i < formats.count(); ++i)
result.add(formats.at(i));
- return result;
+ Vector<String> vector;
+ copyToVector(result, vector);
+ return vector;
}
Vector<String> Pasteboard::readFilenames()
Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (154577 => 154578)
--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2013-08-25 14:21:44 UTC (rev 154577)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2013-08-25 17:24:02 UTC (rev 154578)
@@ -260,7 +260,7 @@
}
}
-ListHashSet<String> Pasteboard::types()
+Vector<String> Pasteboard::types()
{
ListHashSet<String> results;
@@ -289,7 +289,9 @@
}
}
- return results;
+ Vector<String> vector;
+ copyToVector(results, vector);
+ return vector;
}
String Pasteboard::readString(const String& type)