Changeset 130588 in webkit
- Timestamp:
- Oct 6, 2012 12:14:11 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r130587 r130588 1 2012-10-06 Andreas Kling <kling@webkit.org> 2 3 Clipboard::types() should return an ordered collection. 4 <http://webkit.org/b/98547> 5 6 Reviewed by Darin Adler. 7 8 Let Clipboard::types() return a ListHashSet<String> instead of a HashSet<String> to make sure 9 it retains the order in which type strings are added. 10 11 No test, this fixes an issue that was uncovered when lowering the default table size of WTF 12 hash tables, causing the HashSet<String> to rehash and reorder itself. 13 14 * bindings/js/JSClipboardCustom.cpp: 15 (WebCore::JSClipboard::types): 16 * bindings/v8/custom/V8ClipboardCustom.cpp: 17 (WebCore::V8Clipboard::typesAccessorGetter): 18 * dom/Clipboard.h: 19 (Clipboard): 20 * platform/blackberry/ClipboardBlackBerry.cpp: 21 (WebCore::ClipboardBlackBerry::types): 22 * platform/blackberry/ClipboardBlackBerry.h: 23 (ClipboardBlackBerry): 24 * platform/chromium/ChromiumDataObject.cpp: 25 (WebCore::ChromiumDataObject::types): 26 * platform/chromium/ChromiumDataObject.h: 27 (ChromiumDataObject): 28 * platform/chromium/ClipboardChromium.cpp: 29 (WebCore::ClipboardChromium::types): 30 * platform/chromium/ClipboardChromium.h: 31 (ClipboardChromium): 32 * platform/efl/ClipboardEfl.cpp: 33 (WebCore::ClipboardEfl::types): 34 * platform/efl/ClipboardEfl.h: 35 (ClipboardEfl): 36 * platform/gtk/ClipboardGtk.cpp: 37 (WebCore::ClipboardGtk::types): 38 * platform/gtk/ClipboardGtk.h: 39 (ClipboardGtk): 40 * platform/mac/ClipboardMac.h: 41 (ClipboardMac): 42 * platform/mac/ClipboardMac.mm: 43 (WebCore::addHTMLClipboardTypesForCocoaType): 44 (WebCore::ClipboardMac::types): 45 * platform/qt/ClipboardQt.cpp: 46 (WebCore::ClipboardQt::types): 47 * platform/qt/ClipboardQt.h: 48 (ClipboardQt): 49 * platform/win/ClipboardWin.cpp: 50 (WebCore::addMimeTypesForFormat): 51 (WebCore::ClipboardWin::types): 52 * platform/win/ClipboardWin.h: 53 (ClipboardWin): 54 * platform/wx/ClipboardWx.cpp: 55 (WebCore::ClipboardWx::types): 56 * platform/wx/ClipboardWx.h: 57 (ClipboardWx): 58 1 59 2012-10-06 Geoffrey Garen <ggaren@apple.com> 2 60 -
trunk/Source/WebCore/bindings/js/JSClipboardCustom.cpp
r127757 r130588 39 39 #include <runtime/ArrayPrototype.h> 40 40 #include <runtime/Error.h> 41 #include <wtf/HashSet.h>42 41 #include <wtf/text/StringHash.h> 43 42 #include <wtf/text/WTFString.h> … … 53 52 Clipboard* clipboard = impl(); 54 53 55 HashSet<String> types = clipboard->types();54 ListHashSet<String> types = clipboard->types(); 56 55 if (types.isEmpty()) 57 56 return jsNull(); 58 57 59 58 MarkedArgumentBuffer list; 60 HashSet<String>::const_iterator end = types.end();61 for ( HashSet<String>::const_iterator it = types.begin(); it != end; ++it)59 ListHashSet<String>::const_iterator end = types.end(); 60 for (ListHashSet<String>::const_iterator it = types.begin(); it != end; ++it) 62 61 list.append(jsStringWithCache(exec, *it)); 63 62 return constructArray(exec, globalObject(), list); -
trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
r126399 r130588 49 49 Clipboard* clipboard = V8Clipboard::toNative(info.Holder()); 50 50 51 HashSet<String> types = clipboard->types();51 ListHashSet<String> types = clipboard->types(); 52 52 if (types.isEmpty()) 53 53 return v8::Null(info.GetIsolate()); 54 54 55 55 v8::Local<v8::Array> result = v8::Array::New(types.size()); 56 HashSet<String>::const_iterator end = types.end();56 ListHashSet<String>::const_iterator end = types.end(); 57 57 int index = 0; 58 for ( HashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index)58 for (ListHashSet<String>::const_iterator it = types.begin(); it != end; ++it, ++index) 59 59 result->Set(v8Integer(index, info.GetIsolate()), v8String(*it, info.GetIsolate())); 60 60 -
trunk/Source/WebCore/dom/Clipboard.h
r126390 r130588 67 67 68 68 // extensions beyond IE's API 69 virtual HashSet<String> types() const = 0;69 virtual ListHashSet<String> types() const = 0; 70 70 virtual PassRefPtr<FileList> files() const = 0; 71 71 -
trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.cpp
r126390 r130588 79 79 } 80 80 81 HashSet<String> ClipboardBlackBerry::types() const81 ListHashSet<String> ClipboardBlackBerry::types() const 82 82 { 83 83 if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) 84 return HashSet<String>();84 return ListHashSet<String>(); 85 85 86 86 // We use hardcoded list here since there seems to be no API to get the list. 87 HashSet<String> ret;87 ListHashSet<String> ret; 88 88 ret.add("text/plain"); 89 89 ret.add("text/html"); -
trunk/Source/WebCore/platform/blackberry/ClipboardBlackBerry.h
r126390 r130588 40 40 41 41 // extensions beyond IE's API 42 virtual HashSet<String> types() const;42 virtual ListHashSet<String> types() const; 43 43 virtual PassRefPtr<FileList> files() const; 44 44 virtual DragImageRef createDragImage(IntPoint&) const; -
trunk/Source/WebCore/platform/chromium/ChromiumDataObject.cpp
r126390 r130588 127 127 } 128 128 129 HashSet<String> ChromiumDataObject::types() const130 { 131 HashSet<String> results;129 ListHashSet<String> ChromiumDataObject::types() const 130 { 131 ListHashSet<String> results; 132 132 bool containsFiles = false; 133 133 for (size_t i = 0; i < m_itemList.size(); ++i) { -
trunk/Source/WebCore/platform/chromium/ChromiumDataObject.h
r127757 r130588 34 34 #include "ChromiumDataObjectItem.h" 35 35 #include "Supplementable.h" 36 #include <wtf/ HashSet.h>36 #include <wtf/ListHashSet.h> 37 37 #include <wtf/RefPtr.h> 38 38 #include <wtf/Vector.h> … … 70 70 void clearAllExceptFiles(); 71 71 72 HashSet<String> types() const;72 ListHashSet<String> types() const; 73 73 String getData(const String& type) const; 74 74 bool setData(const String& type, const String& data); -
trunk/Source/WebCore/platform/chromium/ClipboardChromium.cpp
r129962 r130588 276 276 277 277 // extensions beyond IE's API 278 HashSet<String> ClipboardChromium::types() const278 ListHashSet<String> ClipboardChromium::types() const 279 279 { 280 280 if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) 281 return HashSet<String>();281 return ListHashSet<String>(); 282 282 283 283 return m_dataObject->types(); -
trunk/Source/WebCore/platform/chromium/ClipboardChromium.h
r126390 r130588 85 85 86 86 // extensions beyond IE's API 87 virtual HashSet<String> types() const;87 virtual ListHashSet<String> types() const; 88 88 virtual PassRefPtr<FileList> files() const; 89 89 -
trunk/Source/WebCore/platform/efl/ClipboardEfl.cpp
r126390 r130588 77 77 } 78 78 79 HashSet<String> ClipboardEfl::types() const79 ListHashSet<String> ClipboardEfl::types() const 80 80 { 81 81 notImplemented(); 82 return HashSet<String>();82 return ListHashSet<String>(); 83 83 } 84 84 -
trunk/Source/WebCore/platform/efl/ClipboardEfl.h
r126390 r130588 40 40 bool setData(const String&, const String&); 41 41 42 HashSet<String> types() const;42 ListHashSet<String> types() const; 43 43 virtual PassRefPtr<FileList> files() const; 44 44 -
trunk/Source/WebCore/platform/gtk/ClipboardGtk.cpp
r129962 r130588 187 187 } 188 188 189 HashSet<String> ClipboardGtk::types() const189 ListHashSet<String> ClipboardGtk::types() const 190 190 { 191 191 if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) 192 return HashSet<String>();192 return ListHashSet<String>(); 193 193 194 194 if (m_clipboard) 195 195 PasteboardHelper::defaultPasteboardHelper()->getClipboardContents(m_clipboard); 196 196 197 HashSet<String> types;197 ListHashSet<String> types; 198 198 if (m_dataObject->hasText()) { 199 199 types.add("text/plain"); -
trunk/Source/WebCore/platform/gtk/ClipboardGtk.h
r126390 r130588 58 58 bool setData(const String&, const String&); 59 59 60 virtual HashSet<String> types() const;60 virtual ListHashSet<String> types() const; 61 61 virtual PassRefPtr<FileList> files() const; 62 62 -
trunk/Source/WebCore/platform/mac/ClipboardMac.h
r126390 r130588 63 63 64 64 // extensions beyond IE's API 65 virtual HashSet<String> types() const;65 virtual ListHashSet<String> types() const; 66 66 virtual PassRefPtr<FileList> files() const; 67 67 -
trunk/Source/WebCore/platform/mac/ClipboardMac.mm
r129962 r130588 123 123 } 124 124 125 static void addHTMLClipboardTypesForCocoaType( HashSet<String>& resultTypes, const String& cocoaType, const String& pasteboardName)125 static void addHTMLClipboardTypesForCocoaType(ListHashSet<String>& resultTypes, const String& cocoaType, const String& pasteboardName) 126 126 { 127 127 // UTI may not do these right, so make sure we get the right, predictable result … … 285 285 } 286 286 287 HashSet<String> ClipboardMac::types() const287 ListHashSet<String> ClipboardMac::types() const 288 288 { 289 289 if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) 290 return HashSet<String>();290 return ListHashSet<String>(); 291 291 292 292 Vector<String> types; … … 296 296 // sure it doesn't change between our testing the change count and accessing the data. 297 297 if (m_changeCount != platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName)) 298 return HashSet<String>();299 300 HashSet<String> result;298 return ListHashSet<String>(); 299 300 ListHashSet<String> result; 301 301 // FIXME: This loop could be split into two stages. One which adds all the HTML5 specified types 302 302 // and a second which adds all the extra types from the cocoa clipboard (which is Mac-only behavior). -
trunk/Source/WebCore/platform/qt/ClipboardQt.cpp
r129647 r130588 184 184 185 185 // extensions beyond IE's API 186 HashSet<String> ClipboardQt::types() const186 ListHashSet<String> ClipboardQt::types() const 187 187 { 188 188 if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) 189 return HashSet<String>();189 return ListHashSet<String>(); 190 190 191 191 ASSERT(m_readableData); 192 HashSet<String> result;192 ListHashSet<String> result; 193 193 QStringList formats = m_readableData->formats(); 194 194 for (int i = 0; i < formats.count(); ++i) -
trunk/Source/WebCore/platform/qt/ClipboardQt.h
r126390 r130588 58 58 59 59 // extensions beyond IE's API 60 virtual HashSet<String> types() const;60 virtual ListHashSet<String> types() const; 61 61 virtual PassRefPtr<FileList> files() const; 62 62 -
trunk/Source/WebCore/platform/win/ClipboardWin.cpp
r129962 r130588 485 485 } 486 486 487 static void addMimeTypesForFormat( HashSet<String>& results, const FORMATETC& format)487 static void addMimeTypesForFormat(ListHashSet<String>& results, const FORMATETC& format) 488 488 { 489 489 // URL and Text are provided for compatibility with IE's model … … 500 500 501 501 // extensions beyond IE's API 502 HashSet<String> ClipboardWin::types() const502 ListHashSet<String> ClipboardWin::types() const 503 503 { 504 HashSet<String> results;504 ListHashSet<String> results; 505 505 if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable) 506 506 return results; -
trunk/Source/WebCore/platform/win/ClipboardWin.h
r126390 r130588 65 65 66 66 // extensions beyond IE's API 67 virtual HashSet<String> types() const;67 virtual ListHashSet<String> types() const; 68 68 virtual PassRefPtr<FileList> files() const; 69 69 -
trunk/Source/WebCore/platform/wx/ClipboardWx.cpp
r127757 r130588 72 72 73 73 // extensions beyond IE's API 74 HashSet<String> ClipboardWx::types() const 74 ListHashSet<String> ClipboardWx::types() const 75 75 { 76 76 notImplemented(); 77 HashSet<String> result;77 ListHashSet<String> result; 78 78 return result; 79 79 } -
trunk/Source/WebCore/platform/wx/ClipboardWx.h
r126390 r130588 47 47 48 48 // extensions beyond IE's API 49 virtual HashSet<String> types() const;49 virtual ListHashSet<String> types() const; 50 50 virtual PassRefPtr<FileList> files() const; 51 51
Note: See TracChangeset
for help on using the changeset viewer.