Changeset 195928 in webkit
- Timestamp:
- Jan 31, 2016, 11:22:31 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r195917 r195928 1 2016-01-31 Darin Adler <darin@apple.com> 2 3 Replace CaseFoldingHash with ASCIICaseInsensitiveHash 4 https://bugs.webkit.org/show_bug.cgi?id=153639 5 6 Reviewed by Filip Pizlo. 7 8 * wtf/text/StringHash.h: Renamed CaseFoldingHash to ASCIICaseInsensitiveHash. 9 (WTF::ASCIICaseInsensitiveHash::foldCase): Use toASCIILower. 10 (WTF::ASCIICaseInsensitiveHash::equal): Use equalIgnoringASCIICase. 11 Also added some assertions. 12 13 * wtf/text/StringImpl.cpp: Made the latin1CaseFoldTable private to this file, 14 since it's no longer needed by CaseFoldingHash. Moved it up before its first use. 15 (WTF::equalCompatibilityCaseless): Fixed typo in the name of this function. 16 (WTF::equalCompatibiltyCaselessNonNull): Deleted. 17 18 * wtf/text/StringImpl.h: Removed declarations of latin1CaseFoldTable and 19 equalCompatibiltyCaselessNonNull 20 1 21 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 22 -
trunk/Source/WTF/wtf/text/StringHash.h
r195917 r195928 1 1 /* 2 * Copyright (C) 2006 , 2007, 2008, 2012, 2013Apple Inc. All rights reserved2 * Copyright (C) 2006-2008, 2012-2013, 2016 Apple Inc. All rights reserved 3 3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 4 4 * … … 34 34 } 35 35 36 // The hash() functions on StringHash and CaseFoldingHash do not support36 // The hash() functions on StringHash and ASCIICaseInsensitiveHash do not support 37 37 // null strings. get(), contains(), and add() on HashMap<String,..., StringHash> 38 38 // cause a null-pointer dereference when passed null strings. … … 72 72 }; 73 73 74 class CaseFoldingHash {74 class ASCIICaseInsensitiveHash { 75 75 public: 76 76 template<typename T> static inline UChar foldCase(T character) 77 77 { 78 if (std::is_same<T, LChar>::value) 79 return StringImpl::latin1CaseFoldTable[character]; 80 81 return u_foldCase(character, U_FOLD_CASE_DEFAULT); 78 return toASCIILower(character); 82 79 } 83 80 … … 106 103 static inline unsigned hash(const char* data, unsigned length) 107 104 { 108 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), length);105 return hash(reinterpret_cast<const LChar*>(data), length); 109 106 } 110 107 108 static inline bool equal(const StringImpl& a, const StringImpl& b) 109 { 110 return equalIgnoringASCIICase(a, b); 111 } 111 112 static inline bool equal(const StringImpl* a, const StringImpl* b) 112 113 { 113 return equalCompatibiltyCaselessNonNull(a, b); 114 ASSERT(a); 115 ASSERT(b); 116 return equal(*a, *b); 114 117 } 115 118 116 119 static unsigned hash(const RefPtr<StringImpl>& key) 117 120 { 118 return hash( *key);121 return hash(key.get()); 119 122 } 120 123 … … 168 171 } 169 172 173 using WTF::ASCIICaseInsensitiveHash; 170 174 using WTF::AlreadyHashed; 171 using WTF::CaseFoldingHash;172 175 using WTF::StringHash; 173 176 -
trunk/Source/WTF/wtf/text/StringImpl.cpp
r195917 r195928 951 951 } 952 952 953 static inline bool equalCompatibiltyCaseless(const LChar* a, const LChar* b, unsigned length) 953 // Table is based on ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt 954 static const UChar latin1CaseFoldTable[256] = { 955 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 956 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 957 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 958 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 959 0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 960 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 961 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 962 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, 963 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 964 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 965 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 966 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x03bc, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 967 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 968 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df, 969 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 970 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, 971 }; 972 973 static inline bool equalCompatibilityCaseless(const LChar* a, const LChar* b, unsigned length) 954 974 { 955 975 while (length--) { 956 if ( StringImpl::latin1CaseFoldTable[*a++] != StringImpl::latin1CaseFoldTable[*b++])976 if (latin1CaseFoldTable[*a++] != latin1CaseFoldTable[*b++]) 957 977 return false; 958 978 } … … 960 980 } 961 981 962 static inline bool equalCompatibil tyCaseless(const UChar* a, const LChar* b, unsigned length)982 static inline bool equalCompatibilityCaseless(const UChar* a, const LChar* b, unsigned length) 963 983 { 964 984 while (length--) { 965 if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != StringImpl::latin1CaseFoldTable[*b++])985 if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != latin1CaseFoldTable[*b++]) 966 986 return false; 967 987 } … … 969 989 } 970 990 971 static inline bool equalCompatibil tyCaseless(const LChar* a, const UChar* b, unsigned length)972 { 973 return equalCompatibil tyCaseless(b, a, length);974 } 975 976 static inline bool equalCompatibil tyCaseless(const UChar* a, const UChar* b, unsigned length)991 static inline bool equalCompatibilityCaseless(const LChar* a, const UChar* b, unsigned length) 992 { 993 return equalCompatibilityCaseless(b, a, length); 994 } 995 996 static inline bool equalCompatibilityCaseless(const UChar* a, const UChar* b, unsigned length) 977 997 { 978 998 return !u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT); … … 1083 1103 1084 1104 unsigned i = 0; 1085 while (!equalCompatibil tyCaseless(searchCharacters + i, matchString, matchLength)) {1105 while (!equalCompatibilityCaseless(searchCharacters + i, matchString, matchLength)) { 1086 1106 if (i == delta) 1087 1107 return notFound; … … 1094 1114 1095 1115 unsigned i = 0; 1096 while (!equalCompatibil tyCaseless(searchCharacters + i, matchString, matchLength)) {1116 while (!equalCompatibilityCaseless(searchCharacters + i, matchString, matchLength)) { 1097 1117 if (i == delta) 1098 1118 return notFound; … … 1158 1178 unsigned i = 0; 1159 1179 // keep looping until we match 1160 while (!equalCompatibil tyCaseless(searchCharacters + i, matchCharacters, matchLength)) {1180 while (!equalCompatibilityCaseless(searchCharacters + i, matchCharacters, matchLength)) { 1161 1181 if (i == delta) 1162 1182 return notFound; … … 1299 1319 1300 1320 // keep looping until we match 1301 while (!equalCompatibil tyCaseless(searchCharacters + delta, matchCharacters, matchLength)) {1321 while (!equalCompatibilityCaseless(searchCharacters + delta, matchCharacters, matchLength)) { 1302 1322 if (!delta) 1303 1323 return notFound; … … 1345 1365 } 1346 1366 if (stringImpl->is8Bit()) 1347 return equalCompatibil tyCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);1348 return equalCompatibil tyCaseless(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);1367 return equalCompatibilityCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength); 1368 return equalCompatibilityCaseless(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength); 1349 1369 } 1350 1370 … … 1919 1939 } 1920 1940 1921 bool equalCompatibiltyCaselessNonNull(const StringImpl* a, const StringImpl* b)1922 {1923 ASSERT(a);1924 ASSERT(b);1925 if (a == b)1926 return true;1927 1928 unsigned length = a->length();1929 if (length != b->length())1930 return false;1931 1932 if (a->is8Bit()) {1933 if (b->is8Bit())1934 return equalCompatibiltyCaseless(a->characters8(), b->characters8(), length);1935 1936 return equalCompatibiltyCaseless(b->characters16(), a->characters8(), length);1937 }1938 1939 if (b->is8Bit())1940 return equalCompatibiltyCaseless(a->characters16(), b->characters8(), length);1941 1942 return equalCompatibiltyCaseless(a->characters16(), b->characters16(), length);1943 }1944 1945 1941 bool equalIgnoringNullity(StringImpl* a, StringImpl* b) 1946 1942 { … … 2142 2138 } 2143 2139 2144 // Table is based on ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt2145 const UChar StringImpl::latin1CaseFoldTable[256] = {2146 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,2147 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,2148 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,2149 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,2150 0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,2151 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,2152 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,2153 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,2154 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,2155 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,2156 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,2157 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x03bc, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,2158 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,2159 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df,2160 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,2161 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,2162 };2163 2164 2140 bool equalIgnoringNullity(const UChar* a, size_t aLength, StringImpl* b) 2165 2141 { -
trunk/Source/WTF/wtf/text/StringImpl.h
r195917 r195928 763 763 #endif 764 764 765 WTF_EXPORT_STRING_API static const UChar latin1CaseFoldTable[256];766 767 765 Ref<StringImpl> extractFoldedStringInSymbol() 768 766 { … … 947 945 WTF_EXPORT_STRING_API bool equal(const StringImpl& a, const StringImpl& b); 948 946 949 // FIXME: Deprecated. Used only by CaseFoldingHash, which itself is soon to be deprecated and removed, replaced by ASCIICaseFoldingHash.950 WTF_EXPORT_STRING_API bool equalCompatibiltyCaselessNonNull(const StringImpl*, const StringImpl*);951 952 947 WTF_EXPORT_STRING_API bool equalIgnoringNullity(StringImpl*, StringImpl*); 953 948 WTF_EXPORT_STRING_API bool equalIgnoringNullity(const UChar*, size_t length, StringImpl*); -
trunk/Source/WebCore/ChangeLog
r195927 r195928 1 2016-01-31 Darin Adler <darin@apple.com> 2 3 Replace CaseFoldingHash with ASCIICaseInsensitiveHash 4 https://bugs.webkit.org/show_bug.cgi?id=153639 5 6 Reviewed by Filip Pizlo. 7 8 * Modules/webdatabase/DatabaseAuthorizer.h: Use ASCIICaseInsensitiveHash 9 for whitelisted functions. Function names are all ASCII. 10 11 * accessibility/AccessibilityObject.cpp: Use ASCIICaseInsensitiveHash 12 for ARIA roles. ARIA roles are all ASCII. 13 14 * crypto/CryptoAlgorithmRegistry.h: Use ASCIICaseInsensitiveHash for 15 crypto algorithm names. Algorithm names are all ASCII. 16 17 * css/CSSFontSelector.cpp: 18 (WebCore::registerLocalFontFacesForFamily): Use ASCIICaseInsensitiveHash 19 for font faces. Face names should use ASCII case insensitive matching; 20 there is no need for non-ASCII case folding. 21 * css/CSSFontSelector.h: Ditto. 22 23 * dom/DOMImplementation.cpp: Use ASCIICaseInsensitiveHash for the 24 FeatureSet. The features are all ASCII. 25 26 * dom/Document.h: Use ASCIICaseInsensitiveHash for the access key 27 map. Access keys are all ASCII. 28 29 * dom/ScriptElement.cpp: 30 (WebCore::isLegacySupportedJavaScriptLanguage): Use ASCIICaseInsensitiveHash 31 for the language set. These strings are all ASCII. 32 33 * editing/EditorCommand.cpp: Use ASCIICaseInsensitiveHash for editor 34 command names. These names are all ASCII. 35 36 * html/HTMLObjectElement.cpp: 37 (WebCore::HTMLObjectElement::parametersForPlugin): Use ASCIICaseInsensitiveHash 38 for parameter names. These names are all ASCII. 39 40 * html/InputType.cpp: Use ASCIICaseInsensitiveHash for the input types. 41 The input types are all ASCII. 42 43 * loader/CrossOriginAccessControl.h: Use ASCIICaseInsensitiveHash for 44 HTTP header field names. These names are all ASCII. 45 * loader/CrossOriginPreflightResultCache.h: Ditto. 46 47 * loader/archive/ArchiveFactory.cpp: Use ASCIICaseInsensitiveHash for 48 MIME types. MIME types are all ASCII. 49 * platform/MIMETypeRegistry.cpp: 50 (WebCore::initializeSupportedImageMIMETypes): Ditto. 51 52 * platform/SchemeRegistry.h: Use ASCIICaseInsensitiveHas for URL schemes. 53 URL schemes are all ASCII. 54 * platform/URL.cpp: Ditto. 55 56 * platform/graphics/FontCache.cpp: 57 (WebCore::FontPlatformDataCacheKey::operator==): Use ASCIICaseInsensitiveHash. 58 (WebCore::FontPlatformDataCacheKeyHash::hash): Use ASCIICaseInsensitiveHash. 59 60 * platform/graphics/FontCascade.cpp: 61 (WebCore::keysMatch): Rename from operator== since this operation is not 62 equality. Changed to equalIgnoringASCIICase and did a little streamlining. 63 (WebCore::makeFontCascadeCacheKey): Use reserveInitialCapacity for slightly 64 better memory use. 65 (WebCore::computeFontCascadeCacheHash): Use IntegerHasher to make computing 66 a hash more efficient by eliminating the overhead of building a vector and 67 even possible heap allocation and deallocation. 68 (WebCore::retrieveOrAddCachedFonts): Use keysMatch instead of ==. 69 70 * platform/graphics/cocoa/FontCacheCoreText.cpp: Use ASCIICaseInsensitiveHash 71 for font family names. These names should use ASCII case insensitive matching; 72 there is no need for non-ASCII case folding. 73 74 * platform/network/HTTPHeaderMap.h: Use ASCIICaseInsensitiveHash for 75 HTTP header field names. These names are all ASCII. 76 77 * rendering/style/RenderStyle.cpp: 78 (WebCore::computeFontHash): Use IntegerHasher to avoid allocating memory just 79 to compute a hash. Use ASCIICaseInsensitiveHash. 80 1 81 2016-01-31 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 82 -
trunk/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h
r195917 r195928 118 118 const String m_databaseInfoTableName; 119 119 120 HashSet<String, CaseFoldingHash> m_whitelistedFunctions;120 HashSet<String, ASCIICaseInsensitiveHash> m_whitelistedFunctions; 121 121 }; 122 122 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r195917 r195928 1989 1989 } 1990 1990 1991 typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;1991 typedef HashMap<String, AccessibilityRole, ASCIICaseInsensitiveHash> ARIARoleMap; 1992 1992 typedef HashMap<AccessibilityRole, String, DefaultHash<int>::Hash, WTF::UnsignedWithZeroKeyHashTraits<int>> ARIAReverseRoleMap; 1993 1993 -
trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.h
r195917 r195928 66 66 void registerAlgorithm(const String& name, CryptoAlgorithmIdentifier, CryptoAlgorithmConstructor); 67 67 68 HashMap<String, CryptoAlgorithmIdentifier, CaseFoldingHash> m_nameToIdentifierMap;68 HashMap<String, CryptoAlgorithmIdentifier, ASCIICaseInsensitiveHash> m_nameToIdentifierMap; 69 69 HashMap<unsigned, String> m_identifierToNameMap; 70 70 HashMap<unsigned, CryptoAlgorithmConstructor> m_identifierToConstructorMap; -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r195917 r195928 225 225 } 226 226 227 static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash>& locallyInstalledFontFaces)227 static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash>& locallyInstalledFontFaces) 228 228 { 229 229 ASSERT(!locallyInstalledFontFaces.contains(familyName)); -
trunk/Source/WebCore/css/CSSFontSelector.h
r195917 r195928 87 87 88 88 Document* m_document; 89 HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash> m_fontFaces;90 HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash> m_locallyInstalledFontFaces;91 HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, CaseFoldingHash> m_fonts;89 HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_fontFaces; 90 HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_locallyInstalledFontFaces; 91 HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, ASCIICaseInsensitiveHash> m_fonts; 92 92 HashSet<FontSelectorClient*> m_clients; 93 93 -
trunk/Source/WebCore/dom/DOMImplementation.cpp
r195917 r195928 65 65 using namespace HTMLNames; 66 66 67 typedef HashSet<String, CaseFoldingHash> FeatureSet;67 typedef HashSet<String, ASCIICaseInsensitiveHash> FeatureSet; 68 68 69 69 static void addString(FeatureSet& set, const char* string) -
trunk/Source/WebCore/dom/Document.h
r195927 r195928 1614 1614 #endif 1615 1615 1616 HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey;1616 HashMap<StringImpl*, Element*, ASCIICaseInsensitiveHash> m_elementsByAccessKey; 1617 1617 bool m_accessKeyMapValid; 1618 1618 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r195917 r195928 119 119 120 120 // FIXME: This function is not HTML5 compliant. These belong in the MIME registry as "text/javascript<version>" entries. 121 typedef HashSet<String, CaseFoldingHash> LanguageSet;121 typedef HashSet<String, ASCIICaseInsensitiveHash> LanguageSet; 122 122 static NeverDestroyed<LanguageSet> languages; 123 123 if (languages.get().isEmpty()) { -
trunk/Source/WebCore/editing/EditorCommand.cpp
r195917 r195928 78 78 }; 79 79 80 typedef HashMap<String, const EditorInternalCommand*, CaseFoldingHash> CommandMap;80 typedef HashMap<String, const EditorInternalCommand*, ASCIICaseInsensitiveHash> CommandMap; 81 81 82 82 static const bool notTextInsertion = false; -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r195917 r195928 167 167 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType) 168 168 { 169 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames;169 HashSet<StringImpl*, ASCIICaseInsensitiveHash> uniqueParamNames; 170 170 String urlParameter; 171 171 -
trunk/Source/WebCore/html/InputType.cpp
r195917 r195928 87 87 typedef const AtomicString& (*InputTypeNameFunction)(); 88 88 typedef std::unique_ptr<InputType> (*InputTypeFactoryFunction)(HTMLInputElement&); 89 typedef HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash> InputTypeFactoryMap;89 typedef HashMap<AtomicString, InputTypeFactoryFunction, ASCIICaseInsensitiveHash> InputTypeFactoryMap; 90 90 91 91 template<class T> -
trunk/Source/WebCore/loader/CrossOriginAccessControl.h
r195917 r195928 35 35 namespace WebCore { 36 36 37 typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet;37 typedef HashSet<String, ASCIICaseInsensitiveHash> HTTPHeaderSet; 38 38 39 39 class HTTPHeaderMap; -
trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.h
r195917 r195928 60 60 StoredCredentials m_credentials; 61 61 HashSet<String> m_methods; 62 HashSet<String, CaseFoldingHash> m_headers;62 HashSet<String, ASCIICaseInsensitiveHash> m_headers; 63 63 }; 64 64 -
trunk/Source/WebCore/loader/archive/ArchiveFactory.cpp
r195917 r195928 48 48 49 49 typedef PassRefPtr<Archive> RawDataCreationFunction(const URL&, SharedBuffer*); 50 typedef HashMap<String, RawDataCreationFunction*, CaseFoldingHash> ArchiveMIMETypesMap;50 typedef HashMap<String, RawDataCreationFunction*, ASCIICaseInsensitiveHash> ArchiveMIMETypesMap; 51 51 52 52 // The create functions in the archive classes return PassRefPtr to concrete subclasses -
trunk/Source/WebCore/platform/MIMETypeRegistry.cpp
r195917 r195928 151 151 static HashSet<String>* unsupportedTextMIMETypes; 152 152 153 typedef HashMap<String, Vector<String>*, CaseFoldingHash> MediaMIMETypeMap;153 typedef HashMap<String, Vector<String>*, ASCIICaseInsensitiveHash> MediaMIMETypeMap; 154 154 155 155 static void initializeSupportedImageMIMETypes() -
trunk/Source/WebCore/platform/SchemeRegistry.h
r195917 r195928 33 33 namespace WebCore { 34 34 35 typedef HashSet<String, CaseFoldingHash> URLSchemesMap;35 typedef HashSet<String, ASCIICaseInsensitiveHash> URLSchemesMap; 36 36 37 37 class SchemeRegistry { -
trunk/Source/WebCore/platform/URL.cpp
r195917 r195928 1991 1991 } 1992 1992 1993 typedef HashMap<String, unsigned short, CaseFoldingHash> DefaultPortsMap;1993 typedef HashMap<String, unsigned short, ASCIICaseInsensitiveHash> DefaultPortsMap; 1994 1994 static const DefaultPortsMap& defaultPortsMap() 1995 1995 { -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r195917 r195928 120 120 if (m_family.isNull() || other.m_family.isNull()) 121 121 return false; 122 return CaseFoldingHash::equal(m_family, other.m_family);122 return ASCIICaseInsensitiveHash::equal(m_family, other.m_family); 123 123 } 124 124 … … 130 130 static unsigned hash(const FontPlatformDataCacheKey& fontKey) 131 131 { 132 return pairIntHash( CaseFoldingHash::hash(fontKey.m_family), fontKey.m_fontDescriptionKey.computeHash());132 return pairIntHash(ASCIICaseInsensitiveHash::hash(fontKey.m_family), fontKey.m_fontDescriptionKey.computeHash()); 133 133 } 134 134 -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r195917 r195928 191 191 }; 192 192 193 // FIXME: Should make hash traits for FontCascadeCacheKey instead of using a hash as the key (so we hash a hash). 193 194 typedef HashMap<unsigned, std::unique_ptr<FontCascadeCacheEntry>, AlreadyHashed> FontCascadeCache; 194 195 195 static bool operator==(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b)196 static bool keysMatch(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b) 196 197 { 197 198 if (a.fontDescriptionKey != b.fontDescriptionKey) … … 199 200 if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion) 200 201 return false; 201 if (a.families.size() != b.families.size()) 202 return false; 203 for (unsigned i = 0; i < a.families.size(); ++i) { 204 auto* aImpl = a.families[i].impl(); 205 auto* bImpl = b.families[i].impl(); 206 if (aImpl == bImpl) 207 continue; 208 if (!aImpl || !bImpl || !CaseFoldingHash::equal(aImpl, bImpl)) 202 unsigned size = a.families.size(); 203 if (size != b.families.size()) 204 return false; 205 for (unsigned i = 0; i < size; ++i) { 206 if (!equalIgnoringASCIICase(a.families[i], b.families[i])) 209 207 return false; 210 208 } … … 233 231 FontCascadeCacheKey key; 234 232 key.fontDescriptionKey = FontDescriptionKey(description); 235 for (unsigned i = 0; i < description.familyCount(); ++i) 236 key.families.append(description.familyAt(i)); 233 unsigned familyCount = description.familyCount(); 234 key.families.reserveInitialCapacity(familyCount); 235 for (unsigned i = 0; i < familyCount; ++i) 236 key.families.uncheckedAppend(description.familyAt(i)); 237 237 key.fontSelectorId = fontSelector ? fontSelector->uniqueId() : 0; 238 238 key.fontSelectorVersion = fontSelector ? fontSelector->version() : 0; … … 240 240 } 241 241 242 // FIXME: Why can't we just teach HashMap about FontCascadeCacheKey instead of hashing a hash?243 242 static unsigned computeFontCascadeCacheHash(const FontCascadeCacheKey& key) 244 243 { 245 Vector<unsigned, 7> hashCodes;246 hashCodes.reserveInitialCapacity(4 + key.families.size());247 248 hash Codes.uncheckedAppend(key.fontDescriptionKey.computeHash());249 hash Codes.uncheckedAppend(key.fontSelectorId);250 hashCodes.uncheckedAppend(key.fontSelectorVersion);251 for (unsigned i = 0; i < key.families.size(); ++i)252 hash Codes.uncheckedAppend(key.families[i].impl() ? CaseFoldingHash::hash(key.families[i]) : 0);253 254 return StringHasher::hashMemory(hashCodes.data(), hashCodes.size() * sizeof(unsigned));244 // FIXME: Should hash the key and the family name characters rather than making a hash out of other hashes. 245 IntegerHasher hasher; 246 hasher.add(key.fontDescriptionKey.computeHash()); 247 hasher.add(key.fontSelectorId); 248 hasher.add(key.fontSelectorVersion); 249 for (unsigned i = 0; i < key.families.size(); ++i) { 250 StringImpl* family = key.families[i].impl(); 251 hasher.add(family ? ASCIICaseInsensitiveHash::hash(family) : 0); 252 } 253 return hasher.hash(); 255 254 } 256 255 … … 273 272 274 273 unsigned hash = computeFontCascadeCacheHash(key); 275 auto addResult = fontCascadeCache().add(hash, std::unique_ptr<FontCascadeCacheEntry>());276 if (!addResult.isNewEntry && addResult.iterator->value->key == key)274 auto addResult = fontCascadeCache().add(hash, nullptr); 275 if (!addResult.isNewEntry && keysMatch(addResult.iterator->value->key, key)) 277 276 return addResult.iterator->value->fonts.get(); 278 277 -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r195917 r195928 646 646 } 647 647 648 typedef HashSet<String, CaseFoldingHash> Whitelist;648 typedef HashSet<String, ASCIICaseInsensitiveHash> Whitelist; 649 649 static Whitelist& fontWhitelist() 650 650 { -
trunk/Source/WebCore/platform/network/HTTPHeaderMap.h
r195917 r195928 49 49 public: 50 50 typedef HashMap<HTTPHeaderName, String, WTF::IntHash<HTTPHeaderName>, WTF::StrongEnumHashTraits<HTTPHeaderName>> CommonHeadersHashMap; 51 typedef HashMap<String, String, CaseFoldingHash> UncommonHeadersHashMap;51 typedef HashMap<String, String, ASCIICaseInsensitiveHash> UncommonHeadersHashMap; 52 52 53 53 class HTTPHeaderMapConstIterator { -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r195917 r195928 367 367 368 368 #if ENABLE(IOS_TEXT_AUTOSIZING) 369 inline unsigned computeFontHash(const FontCascade& font) 370 { 371 unsigned hashCodes[2] ={372 CaseFoldingHash::hash(font.fontDescription().firstFamily().impl()),373 static_cast<unsigned>(font.fontDescription().specifiedSize())374 };375 return StringHasher::computeHash(reinterpret_cast<UChar*>(hashCodes), 2 * sizeof(unsigned) / sizeof(UChar));376 } 377 378 u int32_tRenderStyle::hashForTextAutosizing() const369 370 static inline unsigned computeFontHash(const FontCascade& font) 371 { 372 IntegerHasher hasher; 373 hasher.add(ASCIICaseInsensitiveHash::hash(font.fontDescription().firstFamily())); 374 hasher.add(font.fontDescription().specifiedSize()); 375 return hasher.hash(); 376 } 377 378 unsigned RenderStyle::hashForTextAutosizing() const 379 379 { 380 380 // FIXME: Not a very smart hash. Could be improved upon. See <https://bugs.webkit.org/show_bug.cgi?id=121131>. 381 uint32_t hash = 0; 382 383 hash ^= rareNonInheritedData->m_appearance; 381 unsigned hash = rareNonInheritedData->m_appearance; 384 382 hash ^= rareNonInheritedData->marginBeforeCollapse; 385 383 hash ^= rareNonInheritedData->marginAfterCollapse; … … 422 420 && rareNonInheritedData->textOverflow == other->rareNonInheritedData->textOverflow; 423 421 } 422 424 423 #endif // ENABLE(IOS_TEXT_AUTOSIZING) 425 424 -
trunk/Source/WebKit/win/ChangeLog
r195917 r195928 1 2016-01-31 Darin Adler <darin@apple.com> 2 3 Replace CaseFoldingHash with ASCIICaseInsensitiveHash 4 https://bugs.webkit.org/show_bug.cgi?id=153639 5 6 Reviewed by Filip Pizlo. 7 8 * WebCoreStatistics.cpp: 9 (WebCoreStatistics::memoryStatistics): Use ASCIICaseInsensitiveHash for field names. 10 These names are all ASCII. 11 12 * WebURLResponse.cpp: 13 (WebURLResponse::allHeaderFields): Use ASCIICaseInsensitiveHash for HTTP header 14 field names. These names are all ASCII. 15 1 16 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 17 -
trunk/Source/WebKit/win/WebCoreStatistics.cpp
r195917 r195928 296 296 GlobalMemoryStatistics globalMemoryStats = globalMemoryStatistics(); 297 297 298 HashMap<String, unsigned long long, CaseFoldingHash> fields;298 HashMap<String, unsigned long long, ASCIICaseInsensitiveHash> fields; 299 299 fields.add("FastMallocReservedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.reservedVMBytes)); 300 300 fields.add("FastMallocCommittedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.committedVMBytes)); … … 305 305 fields.add("JavaScriptJITSize", static_cast<unsigned long long>(globalMemoryStats.JITBytes)); 306 306 307 *statistics = COMPropertyBag<unsigned long long, String, CaseFoldingHash>::adopt(fields);307 *statistics = COMPropertyBag<unsigned long long, String, ASCIICaseInsensitiveHash>::adopt(fields); 308 308 309 309 return S_OK; -
trunk/Source/WebKit/win/WebURLResponse.cpp
r195917 r195928 363 363 return E_POINTER; 364 364 365 HashMap<String, String, CaseFoldingHash> fields;365 HashMap<String, String, ASCIICaseInsensitiveHash> fields; 366 366 for (const auto& keyValuePair : m_response.httpHeaderFields()) 367 367 fields.add(keyValuePair.key, keyValuePair.value); 368 368 369 *headerFields = COMPropertyBag<String, String, CaseFoldingHash>::adopt(fields);369 *headerFields = COMPropertyBag<String, String, ASCIICaseInsensitiveHash>::adopt(fields); 370 370 return S_OK; 371 371 } -
trunk/Source/WebKit2/ChangeLog
r195925 r195928 1 2016-01-31 Darin Adler <darin@apple.com> 2 3 Replace CaseFoldingHash with ASCIICaseInsensitiveHash 4 https://bugs.webkit.org/show_bug.cgi?id=153639 5 6 Reviewed by Filip Pizlo. 7 8 * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm: Use ASCIICaseInsensitiveHash 9 for MIME types. MIME types are all ASCII. 10 11 * UIProcess/Plugins/PlugInAutoStartProvider.h: Use ASCIICaseInsensitiveHash for 12 origins. Origin strings should use ASCII case insensitive matching and should not 13 fold non-ASCII case. 14 15 * WebProcess/WebPage/WebPage.h: Use ASCIICaseInsensitiveHash for MIME types. 16 MIME types are all ASCII. 17 18 * WebProcess/WebProcess.cpp: 19 (WebKit::addCaseFoldedCharacters): Use ASCIICaseInsensitiveHash to hash plug-in 20 origin strings. (See rationale above.) 21 (WebKit::hashForPlugInOrigin): Updated comment. 22 1 23 2016-01-31 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 24 -
trunk/Source/WebKit2/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm
r195917 r195928 43 43 44 44 @implementation WKWebViewContentProviderRegistry { 45 HashMap<String, Class <WKWebViewContentProvider>, CaseFoldingHash> _contentProviderForMIMEType;45 HashMap<String, Class <WKWebViewContentProvider>, ASCIICaseInsensitiveHash> _contentProviderForMIMEType; 46 46 HashCountedSet<WebPageProxy*> _pages; 47 47 } -
trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.h
r195917 r195928 70 70 void setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary&, std::function<bool(double expirationTimestamp)>); 71 71 72 typedef HashMap<String, PlugInAutoStartOriginMap, CaseFoldingHash> AutoStartTable;72 typedef HashMap<String, PlugInAutoStartOriginMap, ASCIICaseInsensitiveHash> AutoStartTable; 73 73 typedef HashMap<WebCore::SessionID, AutoStartTable> SessionAutoStartTable; 74 74 SessionAutoStartTable m_autoStartTable; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r195917 r195928 1394 1394 #endif 1395 1395 1396 HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;1396 HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders; 1397 1397 WebCore::Color m_backgroundColor; 1398 1398 -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r195917 r195928 722 722 return; 723 723 if (string.is8Bit()) { 724 hasher.addCharacters<LChar, CaseFoldingHash::foldCase<LChar>>(string.characters8(), string.length());725 return; 726 } 727 hasher.addCharacters<UChar, CaseFoldingHash::foldCase<UChar>>(string.characters16(), string.length());724 hasher.addCharacters<LChar, ASCIICaseInsensitiveHash::foldCase<LChar>>(string.characters8(), string.length()); 725 return; 726 } 727 hasher.addCharacters<UChar, ASCIICaseInsensitiveHash::foldCase<UChar>>(string.characters16(), string.length()); 728 728 } 729 729 … … 731 731 { 732 732 // We want to avoid concatenating the strings and then taking the hash, since that could lead to an expensive conversion. 733 // We also want to avoid using the hash() function in StringImpl or CaseFoldingHash because that masks out bits for the use of flags.733 // We also want to avoid using the hash() function in StringImpl or ASCIICaseInsensitiveHash because that masks out bits for the use of flags. 734 734 StringHasher hasher; 735 735 addCaseFoldedCharacters(hasher, pageOrigin); -
trunk/Tools/ChangeLog
r195917 r195928 1 2016-01-31 Darin Adler <darin@apple.com> 2 3 Replace CaseFoldingHash with ASCIICaseInsensitiveHash 4 https://bugs.webkit.org/show_bug.cgi?id=153639 5 6 Reviewed by Filip Pizlo. 7 8 * Scripts/do-webcore-rename: Use script to do this rename. 9 1 10 2016-01-30 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/Tools/Scripts/do-webcore-rename
r195917 r195928 99 99 my %renames = ( 100 100 # Renames go here in the form of: 101 " deleteAllValues" => "deprecatedDeleteAllValues",101 "CaseFoldingHash" => "ASCIICaseInsensitiveHash", 102 102 ); 103 103
Note:
See TracChangeset
for help on using the changeset viewer.