Diff
Modified: trunk/Source/WebCore/ChangeLog (130587 => 130588)
--- trunk/Source/WebCore/ChangeLog 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/ChangeLog 2012-10-06 19:14:11 UTC (rev 130588)
@@ -1,3 +1,61 @@
+2012-10-06 Andreas Kling <[email protected]>
+
+ Clipboard::types() should return an ordered collection.
+ <http://webkit.org/b/98547>
+
+ Reviewed by Darin Adler.
+
+ Let Clipboard::types() return a ListHashSet<String> instead of a HashSet<String> to make sure
+ it retains the order in which type strings are added.
+
+ No test, this fixes an issue that was uncovered when lowering the default table size of WTF
+ hash tables, causing the HashSet<String> to rehash and reorder itself.
+
+ * bindings/js/JSClipboardCustom.cpp:
+ (WebCore::JSClipboard::types):
+ * bindings/v8/custom/V8ClipboardCustom.cpp:
+ (WebCore::V8Clipboard::typesAccessorGetter):
+ * dom/Clipboard.h:
+ (Clipboard):
+ * 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):
+ * platform/chromium/ClipboardChromium.h:
+ (ClipboardChromium):
+ * 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-10-06 Geoffrey Garen <[email protected]>
If Node X is reachable from _javascript_, all Nodes in the same tree should be kept alive
Modified: trunk/Source/WebCore/bindings/js/JSClipboardCustom.cpp (130587 => 130588)
--- trunk/Source/WebCore/bindings/js/JSClipboardCustom.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/bindings/js/JSClipboardCustom.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -38,7 +38,6 @@
#include "Node.h"
#include <runtime/ArrayPrototype.h>
#include <runtime/Error.h>
-#include <wtf/HashSet.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
@@ -52,13 +51,13 @@
{
Clipboard* clipboard = impl();
- HashSet<String> types = clipboard->types();
+ ListHashSet<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)
+ 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, globalObject(), list);
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp (130587 => 130588)
--- trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -48,14 +48,14 @@
INC_STATS("DOM.Clipboard.types()");
Clipboard* clipboard = V8Clipboard::toNative(info.Holder());
- HashSet<String> types = clipboard->types();
+ ListHashSet<String> types = clipboard->types();
if (types.isEmpty())
return v8::Null(info.GetIsolate());
v8::Local<v8::Array> result = v8::Array::New(types.size());
- HashSet<String>::const_iterator end = types.end();
+ ListHashSet<String>::const_iterator end = types.end();
int index = 0;
- for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index)
+ for (ListHashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index)
result->Set(v8Integer(index, info.GetIsolate()), v8String(*it, info.GetIsolate()));
return result;
Modified: trunk/Source/WebCore/dom/Clipboard.h (130587 => 130588)
--- trunk/Source/WebCore/dom/Clipboard.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/dom/Clipboard.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -66,7 +66,7 @@
virtual bool setData(const String& type, const String& data) = 0;
// extensions beyond IE's API
- virtual HashSet<String> types() const = 0;
+ virtual ListHashSet<String> types() const = 0;
virtual PassRefPtr<FileList> files() const = 0;
IntPoint dragLocation() const { return m_dragLoc; }
Modified: trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -78,13 +78,13 @@
return true;
}
-HashSet<String> ClipboardBlackBerry::types() const
+ListHashSet<String> ClipboardBlackBerry::types() const
{
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
- return HashSet<String>();
+ return ListHashSet<String>();
// We use hardcoded list here since there seems to be no API to get the list.
- HashSet<String> ret;
+ ListHashSet<String> ret;
ret.add("text/plain");
ret.add("text/html");
ret.add("text/url");
Modified: trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.h (130587 => 130588)
--- trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -39,7 +39,7 @@
bool setData(const String& type, const String& data);
// extensions beyond IE's API
- virtual HashSet<String> types() const;
+ virtual ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
virtual DragImageRef createDragImage(IntPoint&) const;
virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
Modified: trunk/Source/WebCore/platform/chromium/ChromiumDataObject.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/chromium/ChromiumDataObject.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/chromium/ChromiumDataObject.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -126,9 +126,9 @@
}
}
-HashSet<String> ChromiumDataObject::types() const
+ListHashSet<String> ChromiumDataObject::types() const
{
- HashSet<String> results;
+ ListHashSet<String> results;
bool containsFiles = false;
for (size_t i = 0; i < m_itemList.size(); ++i) {
if (m_itemList[i]->kind() == DataTransferItem::kindString)
Modified: trunk/Source/WebCore/platform/chromium/ChromiumDataObject.h (130587 => 130588)
--- trunk/Source/WebCore/platform/chromium/ChromiumDataObject.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/chromium/ChromiumDataObject.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -33,7 +33,7 @@
#include "ChromiumDataObjectItem.h"
#include "Supplementable.h"
-#include <wtf/HashSet.h>
+#include <wtf/ListHashSet.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
@@ -69,7 +69,7 @@
void clearData(const String& type);
void clearAllExceptFiles();
- HashSet<String> types() const;
+ ListHashSet<String> types() const;
String getData(const String& type) const;
bool setData(const String& type, const String& data);
Modified: trunk/Source/WebCore/platform/chromium/ClipboardChromium.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/chromium/ClipboardChromium.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/chromium/ClipboardChromium.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -275,10 +275,10 @@
}
// extensions beyond IE's API
-HashSet<String> ClipboardChromium::types() const
+ListHashSet<String> ClipboardChromium::types() const
{
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
- return HashSet<String>();
+ return ListHashSet<String>();
return m_dataObject->types();
}
Modified: trunk/Source/WebCore/platform/chromium/ClipboardChromium.h (130587 => 130588)
--- trunk/Source/WebCore/platform/chromium/ClipboardChromium.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/chromium/ClipboardChromium.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -84,7 +84,7 @@
bool platformClipboardChanged() const;
// extensions beyond IE's API
- virtual HashSet<String> types() const;
+ virtual ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
void setDragImage(CachedImage*, const IntPoint&);
Modified: trunk/Source/WebCore/platform/efl/ClipboardEfl.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/efl/ClipboardEfl.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/efl/ClipboardEfl.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -76,10 +76,10 @@
return false;
}
-HashSet<String> ClipboardEfl::types() const
+ListHashSet<String> ClipboardEfl::types() const
{
notImplemented();
- return HashSet<String>();
+ return ListHashSet<String>();
}
PassRefPtr<FileList> ClipboardEfl::files() const
Modified: trunk/Source/WebCore/platform/efl/ClipboardEfl.h (130587 => 130588)
--- trunk/Source/WebCore/platform/efl/ClipboardEfl.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/efl/ClipboardEfl.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -39,7 +39,7 @@
String getData(const String&) const;
bool setData(const String&, const String&);
- HashSet<String> types() const;
+ ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
IntPoint dragLocation() const;
Modified: trunk/Source/WebCore/platform/gtk/ClipboardGtk.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/gtk/ClipboardGtk.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/gtk/ClipboardGtk.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -186,15 +186,15 @@
return success;
}
-HashSet<String> ClipboardGtk::types() const
+ListHashSet<String> ClipboardGtk::types() const
{
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
- return HashSet<String>();
+ return ListHashSet<String>();
if (m_clipboard)
PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_clipboard);
- HashSet<String> types;
+ ListHashSet<String> types;
if (m_dataObject->hasText()) {
types.add("text/plain");
types.add("Text");
Modified: trunk/Source/WebCore/platform/gtk/ClipboardGtk.h (130587 => 130588)
--- trunk/Source/WebCore/platform/gtk/ClipboardGtk.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/gtk/ClipboardGtk.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -57,7 +57,7 @@
String getData(const String&) const;
bool setData(const String&, const String&);
- virtual HashSet<String> types() const;
+ virtual ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
void setDragImage(CachedImage*, const IntPoint&);
Modified: trunk/Source/WebCore/platform/mac/ClipboardMac.h (130587 => 130588)
--- trunk/Source/WebCore/platform/mac/ClipboardMac.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/mac/ClipboardMac.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -62,7 +62,7 @@
virtual bool hasData();
// extensions beyond IE's API
- virtual HashSet<String> types() const;
+ virtual ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
void setDragImage(CachedImage*, const IntPoint&);
Modified: trunk/Source/WebCore/platform/mac/ClipboardMac.mm (130587 => 130588)
--- trunk/Source/WebCore/platform/mac/ClipboardMac.mm 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/mac/ClipboardMac.mm 2012-10-06 19:14:11 UTC (rev 130588)
@@ -122,7 +122,7 @@
return String();
}
-static void addHTMLClipboardTypesForCocoaType(HashSet<String>& resultTypes, const String& cocoaType, const String& pasteboardName)
+static void addHTMLClipboardTypesForCocoaType(ListHashSet<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)) {
@@ -284,10 +284,10 @@
return false;
}
-HashSet<String> ClipboardMac::types() const
+ListHashSet<String> ClipboardMac::types() const
{
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
- return HashSet<String>();
+ return ListHashSet<String>();
Vector<String> types;
platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
@@ -295,9 +295,9 @@
// 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 HashSet<String>();
+ return ListHashSet<String>();
- HashSet<String> result;
+ ListHashSet<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++) {
Modified: trunk/Source/WebCore/platform/qt/ClipboardQt.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/qt/ClipboardQt.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/qt/ClipboardQt.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -183,13 +183,13 @@
}
// extensions beyond IE's API
-HashSet<String> ClipboardQt::types() const
+ListHashSet<String> ClipboardQt::types() const
{
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
- return HashSet<String>();
+ return ListHashSet<String>();
ASSERT(m_readableData);
- HashSet<String> result;
+ ListHashSet<String> result;
QStringList formats = m_readableData->formats();
for (int i = 0; i < formats.count(); ++i)
result.add(formats.at(i));
Modified: trunk/Source/WebCore/platform/qt/ClipboardQt.h (130587 => 130588)
--- trunk/Source/WebCore/platform/qt/ClipboardQt.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/qt/ClipboardQt.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -57,7 +57,7 @@
bool setData(const String& type, const String& data);
// extensions beyond IE's API
- virtual HashSet<String> types() const;
+ virtual ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
void setDragImage(CachedImage*, const IntPoint&);
Modified: trunk/Source/WebCore/platform/win/ClipboardWin.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/win/ClipboardWin.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/win/ClipboardWin.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -484,7 +484,7 @@
return false;
}
-static void addMimeTypesForFormat(HashSet<String>& results, const FORMATETC& format)
+static void addMimeTypesForFormat(ListHashSet<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) {
@@ -499,9 +499,9 @@
}
// extensions beyond IE's API
-HashSet<String> ClipboardWin::types() const
+ListHashSet<String> ClipboardWin::types() const
{
- HashSet<String> results;
+ ListHashSet<String> results;
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
return results;
Modified: trunk/Source/WebCore/platform/win/ClipboardWin.h (130587 => 130588)
--- trunk/Source/WebCore/platform/win/ClipboardWin.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/win/ClipboardWin.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -64,7 +64,7 @@
bool setData(const String& type, const String& data);
// extensions beyond IE's API
- virtual HashSet<String> types() const;
+ virtual ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
void setDragImage(CachedImage*, const IntPoint&);
Modified: trunk/Source/WebCore/platform/wx/ClipboardWx.cpp (130587 => 130588)
--- trunk/Source/WebCore/platform/wx/ClipboardWx.cpp 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/wx/ClipboardWx.cpp 2012-10-06 19:14:11 UTC (rev 130588)
@@ -71,10 +71,10 @@
}
// extensions beyond IE's API
-HashSet<String> ClipboardWx::types() const
+ListHashSet<String> ClipboardWx::types() const
{
notImplemented();
- HashSet<String> result;
+ ListHashSet<String> result;
return result;
}
Modified: trunk/Source/WebCore/platform/wx/ClipboardWx.h (130587 => 130588)
--- trunk/Source/WebCore/platform/wx/ClipboardWx.h 2012-10-06 18:51:05 UTC (rev 130587)
+++ trunk/Source/WebCore/platform/wx/ClipboardWx.h 2012-10-06 19:14:11 UTC (rev 130588)
@@ -46,7 +46,7 @@
bool setData(const String& type, const String& data);
// extensions beyond IE's API
- virtual HashSet<String> types() const;
+ virtual ListHashSet<String> types() const;
virtual PassRefPtr<FileList> files() const;
IntPoint dragLocation() const;