Replace CaseFoldingHash with ASCIICaseInsensitiveHash
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Jan 2016 19:22:31 +0000 (19:22 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Jan 2016 19:22:31 +0000 (19:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153639

Reviewed by Filip Pizlo.

Source/WebCore:

* Modules/webdatabase/DatabaseAuthorizer.h: Use ASCIICaseInsensitiveHash
for whitelisted functions. Function names are all ASCII.

* accessibility/AccessibilityObject.cpp: Use ASCIICaseInsensitiveHash
for ARIA roles. ARIA roles are all ASCII.

* crypto/CryptoAlgorithmRegistry.h: Use ASCIICaseInsensitiveHash for
crypto algorithm names. Algorithm names are all ASCII.

* css/CSSFontSelector.cpp:
(WebCore::registerLocalFontFacesForFamily): Use ASCIICaseInsensitiveHash
for font faces. Face names should use ASCII case insensitive matching;
there is no need for non-ASCII case folding.
* css/CSSFontSelector.h: Ditto.

* dom/DOMImplementation.cpp: Use ASCIICaseInsensitiveHash for the
FeatureSet. The features are all ASCII.

* dom/Document.h: Use ASCIICaseInsensitiveHash for the access key
map. Access keys are all ASCII.

* dom/ScriptElement.cpp:
(WebCore::isLegacySupportedJavaScriptLanguage): Use ASCIICaseInsensitiveHash
for the language set. These strings are all ASCII.

* editing/EditorCommand.cpp: Use ASCIICaseInsensitiveHash for editor
command names. These names are all ASCII.

* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parametersForPlugin): Use ASCIICaseInsensitiveHash
for parameter names. These names are all ASCII.

* html/InputType.cpp: Use ASCIICaseInsensitiveHash for the input types.
The input types are all ASCII.

* loader/CrossOriginAccessControl.h: Use ASCIICaseInsensitiveHash for
HTTP header field names. These names are all ASCII.
* loader/CrossOriginPreflightResultCache.h: Ditto.

* loader/archive/ArchiveFactory.cpp: Use ASCIICaseInsensitiveHash for
MIME types. MIME types are all ASCII.
* platform/MIMETypeRegistry.cpp:
(WebCore::initializeSupportedImageMIMETypes): Ditto.

* platform/SchemeRegistry.h: Use ASCIICaseInsensitiveHas for URL schemes.
URL schemes are all ASCII.
* platform/URL.cpp: Ditto.

* platform/graphics/FontCache.cpp:
(WebCore::FontPlatformDataCacheKey::operator==): Use ASCIICaseInsensitiveHash.
(WebCore::FontPlatformDataCacheKeyHash::hash): Use ASCIICaseInsensitiveHash.

* platform/graphics/FontCascade.cpp:
(WebCore::keysMatch): Rename from operator== since this operation is not
equality. Changed to equalIgnoringASCIICase and did a little streamlining.
(WebCore::makeFontCascadeCacheKey): Use reserveInitialCapacity for slightly
better memory use.
(WebCore::computeFontCascadeCacheHash): Use IntegerHasher to make computing
a hash more efficient by eliminating the overhead of building a vector and
even possible heap allocation and deallocation.
(WebCore::retrieveOrAddCachedFonts): Use keysMatch instead of ==.

* platform/graphics/cocoa/FontCacheCoreText.cpp: Use ASCIICaseInsensitiveHash
for font family names. These names should use ASCII case insensitive matching;
there is no need for non-ASCII case folding.

* platform/network/HTTPHeaderMap.h: Use ASCIICaseInsensitiveHash for
HTTP header field names. These names are all ASCII.

* rendering/style/RenderStyle.cpp:
(WebCore::computeFontHash): Use IntegerHasher to avoid allocating memory just
to compute a hash. Use ASCIICaseInsensitiveHash.

Source/WebKit/win:

* WebCoreStatistics.cpp:
(WebCoreStatistics::memoryStatistics): Use ASCIICaseInsensitiveHash for field names.
These names are all ASCII.

* WebURLResponse.cpp:
(WebURLResponse::allHeaderFields): Use ASCIICaseInsensitiveHash for HTTP header
field names. These names are all ASCII.

Source/WebKit2:

* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm: Use ASCIICaseInsensitiveHash
for MIME types. MIME types are all ASCII.

* UIProcess/Plugins/PlugInAutoStartProvider.h: Use ASCIICaseInsensitiveHash for
origins. Origin strings should use ASCII case insensitive matching and should not
fold non-ASCII case.

* WebProcess/WebPage/WebPage.h: Use ASCIICaseInsensitiveHash for MIME types.
MIME types are all ASCII.

* WebProcess/WebProcess.cpp:
(WebKit::addCaseFoldedCharacters): Use ASCIICaseInsensitiveHash to hash plug-in
origin strings. (See rationale above.)
(WebKit::hashForPlugInOrigin): Updated comment.

Source/WTF:

* wtf/text/StringHash.h: Renamed CaseFoldingHash to ASCIICaseInsensitiveHash.
(WTF::ASCIICaseInsensitiveHash::foldCase): Use toASCIILower.
(WTF::ASCIICaseInsensitiveHash::equal): Use equalIgnoringASCIICase.
Also added some assertions.

* wtf/text/StringImpl.cpp: Made the latin1CaseFoldTable private to this file,
since it's no longer needed by CaseFoldingHash. Moved it up before its first use.
(WTF::equalCompatibilityCaseless): Fixed typo in the name of this function.
(WTF::equalCompatibiltyCaselessNonNull): Deleted.

* wtf/text/StringImpl.h: Removed declarations of latin1CaseFoldTable and
equalCompatibiltyCaselessNonNull

Tools:

* Scripts/do-webcore-rename: Use script to do this rename.

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

37 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/text/StringHash.h
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.h
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/crypto/CryptoAlgorithmRegistry.h
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSFontSelector.h
Source/WebCore/dom/DOMImplementation.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/InputType.cpp
Source/WebCore/loader/CrossOriginAccessControl.h
Source/WebCore/loader/CrossOriginPreflightResultCache.h
Source/WebCore/loader/archive/ArchiveFactory.cpp
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebCore/platform/SchemeRegistry.h
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/network/HTTPHeaderMap.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreStatistics.cpp
Source/WebKit/win/WebURLResponse.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm
Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.h
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebProcess.cpp
Tools/ChangeLog
Tools/Scripts/do-webcore-rename

index a01268d..4609363 100644 (file)
@@ -1,3 +1,23 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Replace CaseFoldingHash with ASCIICaseInsensitiveHash
+        https://bugs.webkit.org/show_bug.cgi?id=153639
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/text/StringHash.h: Renamed CaseFoldingHash to ASCIICaseInsensitiveHash.
+        (WTF::ASCIICaseInsensitiveHash::foldCase): Use toASCIILower.
+        (WTF::ASCIICaseInsensitiveHash::equal): Use equalIgnoringASCIICase.
+        Also added some assertions.
+
+        * wtf/text/StringImpl.cpp: Made the latin1CaseFoldTable private to this file,
+        since it's no longer needed by CaseFoldingHash. Moved it up before its first use.
+        (WTF::equalCompatibilityCaseless): Fixed typo in the name of this function.
+        (WTF::equalCompatibiltyCaselessNonNull): Deleted.
+
+        * wtf/text/StringImpl.h: Removed declarations of latin1CaseFoldTable and
+        equalCompatibiltyCaselessNonNull
+
 2016-01-30  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r195911.
index 346c104..26ad291 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved
+ * Copyright (C) 2006-2008, 2012-2013, 2016 Apple Inc. All rights reserved
  * Copyright (C) Research In Motion Limited 2009. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -33,7 +33,7 @@ namespace WTF {
         return value.isNull();
     }
 
-    // The hash() functions on StringHash and CaseFoldingHash do not support
+    // The hash() functions on StringHash and ASCIICaseInsensitiveHash do not support
     // null strings. get(), contains(), and add() on HashMap<String,..., StringHash>
     // cause a null-pointer dereference when passed null strings.
 
@@ -71,14 +71,11 @@ namespace WTF {
         static const bool safeToCompareToEmptyOrDeleted = false;
     };
 
-    class CaseFoldingHash {
+    class ASCIICaseInsensitiveHash {
     public:
         template<typename T> static inline UChar foldCase(T character)
         {
-            if (std::is_same<T, LChar>::value)
-                return StringImpl::latin1CaseFoldTable[character];
-            
-            return u_foldCase(character, U_FOLD_CASE_DEFAULT);
+            return toASCIILower(character);
         }
 
         static unsigned hash(const UChar* data, unsigned length)
@@ -105,17 +102,23 @@ namespace WTF {
 
         static inline unsigned hash(const char* data, unsigned length)
         {
-            return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), length);
+            return hash(reinterpret_cast<const LChar*>(data), length);
         }
         
+        static inline bool equal(const StringImpl& a, const StringImpl& b)
+        {
+            return equalIgnoringASCIICase(a, b);
+        }
         static inline bool equal(const StringImpl* a, const StringImpl* b)
         {
-            return equalCompatibiltyCaselessNonNull(a, b);
+            ASSERT(a);
+            ASSERT(b);
+            return equal(*a, *b);
         }
 
         static unsigned hash(const RefPtr<StringImpl>& key) 
         {
-            return hash(*key);
+            return hash(key.get());
         }
 
         static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
@@ -167,8 +170,8 @@ namespace WTF {
 
 }
 
+using WTF::ASCIICaseInsensitiveHash;
 using WTF::AlreadyHashed;
-using WTF::CaseFoldingHash;
 using WTF::StringHash;
 
 #endif
index a676d2b..cb3d024 100644 (file)
@@ -950,30 +950,50 @@ float StringImpl::toFloat(bool* ok)
     return charactersToFloat(characters16(), m_length, ok);
 }
 
-static inline bool equalCompatibiltyCaseless(const LChar* a, const LChar* b, unsigned length)
+// Table is based on ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt
+static const UChar latin1CaseFoldTable[256] = {
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
+    0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
+    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
+    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
+    0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
+    0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x03bc, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
+    0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
+    0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df,
+    0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
+    0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
+};
+
+static inline bool equalCompatibilityCaseless(const LChar* a, const LChar* b, unsigned length)
 {
     while (length--) {
-        if (StringImpl::latin1CaseFoldTable[*a++] != StringImpl::latin1CaseFoldTable[*b++])
+        if (latin1CaseFoldTable[*a++] != latin1CaseFoldTable[*b++])
             return false;
     }
     return true;
 }
 
-static inline bool equalCompatibiltyCaseless(const UChar* a, const LChar* b, unsigned length)
+static inline bool equalCompatibilityCaseless(const UChar* a, const LChar* b, unsigned length)
 {
     while (length--) {
-        if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != StringImpl::latin1CaseFoldTable[*b++])
+        if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != latin1CaseFoldTable[*b++])
             return false;
     }
     return true;
 }
 
-static inline bool equalCompatibiltyCaseless(const LChar* a, const UChar* b, unsigned length)
+static inline bool equalCompatibilityCaseless(const LChar* a, const UChar* b, unsigned length)
 {
-    return equalCompatibiltyCaseless(b, a, length);
+    return equalCompatibilityCaseless(b, a, length);
 }
 
-static inline bool equalCompatibiltyCaseless(const UChar* a, const UChar* b, unsigned length)
+static inline bool equalCompatibilityCaseless(const UChar* a, const UChar* b, unsigned length)
 {
     return !u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT);
 }
@@ -1082,7 +1102,7 @@ size_t StringImpl::findIgnoringCase(const LChar* matchString, unsigned index)
         const LChar* searchCharacters = characters8() + index;
 
         unsigned i = 0;
-        while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) {
+        while (!equalCompatibilityCaseless(searchCharacters + i, matchString, matchLength)) {
             if (i == delta)
                 return notFound;
             ++i;
@@ -1093,7 +1113,7 @@ size_t StringImpl::findIgnoringCase(const LChar* matchString, unsigned index)
     const UChar* searchCharacters = characters16() + index;
 
     unsigned i = 0;
-    while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) {
+    while (!equalCompatibilityCaseless(searchCharacters + i, matchString, matchLength)) {
         if (i == delta)
             return notFound;
         ++i;
@@ -1157,7 +1177,7 @@ ALWAYS_INLINE static size_t findIgnoringCaseInner(const SearchCharacterType* sea
 
     unsigned i = 0;
     // keep looping until we match
-    while (!equalCompatibiltyCaseless(searchCharacters + i, matchCharacters, matchLength)) {
+    while (!equalCompatibilityCaseless(searchCharacters + i, matchCharacters, matchLength)) {
         if (i == delta)
             return notFound;
         ++i;
@@ -1298,7 +1318,7 @@ ALWAYS_INLINE static size_t reverseFindIgnoringCaseInner(const SearchCharacterTy
     unsigned delta = std::min(index, length - matchLength);
 
     // keep looping until we match
-    while (!equalCompatibiltyCaseless(searchCharacters + delta, matchCharacters, matchLength)) {
+    while (!equalCompatibilityCaseless(searchCharacters + delta, matchCharacters, matchLength)) {
         if (!delta)
             return notFound;
         --delta;
@@ -1344,8 +1364,8 @@ ALWAYS_INLINE static bool equalInner(const StringImpl* stringImpl, unsigned star
         return equal(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
     }
     if (stringImpl->is8Bit())
-        return equalCompatibiltyCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
-    return equalCompatibiltyCaseless(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+        return equalCompatibilityCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+    return equalCompatibilityCaseless(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
 }
 
 ALWAYS_INLINE static bool equalInner(const StringImpl& stringImpl, unsigned startOffset, const StringImpl& matchString)
@@ -1918,30 +1938,6 @@ bool equal(const StringImpl& a, const StringImpl& b)
     return equalCommon(a, b);
 }
 
-bool equalCompatibiltyCaselessNonNull(const StringImpl* a, const StringImpl* b)
-{
-    ASSERT(a);
-    ASSERT(b);
-    if (a == b)
-        return true;
-
-    unsigned length = a->length();
-    if (length != b->length())
-        return false;
-
-    if (a->is8Bit()) {
-        if (b->is8Bit())
-            return equalCompatibiltyCaseless(a->characters8(), b->characters8(), length);
-
-        return equalCompatibiltyCaseless(b->characters16(), a->characters8(), length);
-    }
-
-    if (b->is8Bit())
-        return equalCompatibiltyCaseless(a->characters16(), b->characters8(), length);
-
-    return equalCompatibiltyCaseless(a->characters16(), b->characters16(), length);
-}
-
 bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
 {
     if (!a && b && !b->length())
@@ -2141,26 +2137,6 @@ CString StringImpl::utf8(ConversionMode mode) const
     return utf8ForRange(0, length(), mode);
 }
 
-// Table is based on ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt
-const UChar StringImpl::latin1CaseFoldTable[256] = {
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
-    0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
-    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
-    0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
-    0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
-    0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x03bc, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
-    0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
-    0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df,
-    0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
-    0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, 
-};
-
 bool equalIgnoringNullity(const UChar* a, size_t aLength, StringImpl* b)
 {
     if (!b)
index d44e5cf..e6870ba 100644 (file)
@@ -762,8 +762,6 @@ public:
     ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; }
 #endif
 
-    WTF_EXPORT_STRING_API static const UChar latin1CaseFoldTable[256];
-
     Ref<StringImpl> extractFoldedStringInSymbol()
     {
         ASSERT(isSymbol());
@@ -946,9 +944,6 @@ inline bool equal(const LChar* a, StringImpl* b) { return equal(b, a); }
 inline bool equal(const char* a, StringImpl* b) { return equal(b, reinterpret_cast<const LChar*>(a)); }
 WTF_EXPORT_STRING_API bool equal(const StringImpl& a, const StringImpl& b);
 
-// FIXME: Deprecated. Used only by CaseFoldingHash, which itself is soon to be deprecated and removed, replaced by ASCIICaseFoldingHash.
-WTF_EXPORT_STRING_API bool equalCompatibiltyCaselessNonNull(const StringImpl*, const StringImpl*);
-
 WTF_EXPORT_STRING_API bool equalIgnoringNullity(StringImpl*, StringImpl*);
 WTF_EXPORT_STRING_API bool equalIgnoringNullity(const UChar*, size_t length, StringImpl*);
 
index d096d19..40616ca 100644 (file)
@@ -1,3 +1,83 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Replace CaseFoldingHash with ASCIICaseInsensitiveHash
+        https://bugs.webkit.org/show_bug.cgi?id=153639
+
+        Reviewed by Filip Pizlo.
+
+        * Modules/webdatabase/DatabaseAuthorizer.h: Use ASCIICaseInsensitiveHash
+        for whitelisted functions. Function names are all ASCII.
+
+        * accessibility/AccessibilityObject.cpp: Use ASCIICaseInsensitiveHash
+        for ARIA roles. ARIA roles are all ASCII.
+
+        * crypto/CryptoAlgorithmRegistry.h: Use ASCIICaseInsensitiveHash for
+        crypto algorithm names. Algorithm names are all ASCII.
+
+        * css/CSSFontSelector.cpp:
+        (WebCore::registerLocalFontFacesForFamily): Use ASCIICaseInsensitiveHash
+        for font faces. Face names should use ASCII case insensitive matching;
+        there is no need for non-ASCII case folding.
+        * css/CSSFontSelector.h: Ditto.
+
+        * dom/DOMImplementation.cpp: Use ASCIICaseInsensitiveHash for the
+        FeatureSet. The features are all ASCII.
+
+        * dom/Document.h: Use ASCIICaseInsensitiveHash for the access key
+        map. Access keys are all ASCII.
+
+        * dom/ScriptElement.cpp:
+        (WebCore::isLegacySupportedJavaScriptLanguage): Use ASCIICaseInsensitiveHash
+        for the language set. These strings are all ASCII.
+
+        * editing/EditorCommand.cpp: Use ASCIICaseInsensitiveHash for editor
+        command names. These names are all ASCII.
+
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::parametersForPlugin): Use ASCIICaseInsensitiveHash
+        for parameter names. These names are all ASCII.
+
+        * html/InputType.cpp: Use ASCIICaseInsensitiveHash for the input types.
+        The input types are all ASCII.
+
+        * loader/CrossOriginAccessControl.h: Use ASCIICaseInsensitiveHash for
+        HTTP header field names. These names are all ASCII.
+        * loader/CrossOriginPreflightResultCache.h: Ditto.
+
+        * loader/archive/ArchiveFactory.cpp: Use ASCIICaseInsensitiveHash for
+        MIME types. MIME types are all ASCII.
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::initializeSupportedImageMIMETypes): Ditto.
+
+        * platform/SchemeRegistry.h: Use ASCIICaseInsensitiveHas for URL schemes.
+        URL schemes are all ASCII.
+        * platform/URL.cpp: Ditto.
+
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontPlatformDataCacheKey::operator==): Use ASCIICaseInsensitiveHash.
+        (WebCore::FontPlatformDataCacheKeyHash::hash): Use ASCIICaseInsensitiveHash.
+
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::keysMatch): Rename from operator== since this operation is not
+        equality. Changed to equalIgnoringASCIICase and did a little streamlining.
+        (WebCore::makeFontCascadeCacheKey): Use reserveInitialCapacity for slightly
+        better memory use.
+        (WebCore::computeFontCascadeCacheHash): Use IntegerHasher to make computing
+        a hash more efficient by eliminating the overhead of building a vector and
+        even possible heap allocation and deallocation.
+        (WebCore::retrieveOrAddCachedFonts): Use keysMatch instead of ==.
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp: Use ASCIICaseInsensitiveHash
+        for font family names. These names should use ASCII case insensitive matching;
+        there is no need for non-ASCII case folding.
+
+        * platform/network/HTTPHeaderMap.h: Use ASCIICaseInsensitiveHash for
+        HTTP header field names. These names are all ASCII.
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::computeFontHash): Use IntegerHasher to avoid allocating memory just
+        to compute a hash. Use ASCIICaseInsensitiveHash.
+
 2016-01-31  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Reduce PassRefPtr uses in dom - 5
index 5a77461..55278a7 100644 (file)
@@ -117,7 +117,7 @@ private:
 
     const String m_databaseInfoTableName;
 
-    HashSet<String, CaseFoldingHash> m_whitelistedFunctions;
+    HashSet<String, ASCIICaseInsensitiveHash> m_whitelistedFunctions;
 };
 
 } // namespace WebCore
index 768d0d2..b07988e 100644 (file)
@@ -1988,7 +1988,7 @@ AccessibilityObject* AccessibilityObject::firstAnonymousBlockChild() const
     return nullptr;
 }
 
-typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
+typedef HashMap<String, AccessibilityRole, ASCIICaseInsensitiveHash> ARIARoleMap;
 typedef HashMap<AccessibilityRole, String, DefaultHash<int>::Hash, WTF::UnsignedWithZeroKeyHashTraits<int>> ARIAReverseRoleMap;
 
 static ARIARoleMap* gAriaRoleMap = nullptr;
index bd64b14..ed972c6 100644 (file)
@@ -65,7 +65,7 @@ private:
 
     void registerAlgorithm(const String& name, CryptoAlgorithmIdentifier, CryptoAlgorithmConstructor);
 
-    HashMap<String, CryptoAlgorithmIdentifier, CaseFoldingHash> m_nameToIdentifierMap;
+    HashMap<String, CryptoAlgorithmIdentifier, ASCIICaseInsensitiveHash> m_nameToIdentifierMap;
     HashMap<unsigned, String> m_identifierToNameMap;
     HashMap<unsigned, CryptoAlgorithmConstructor> m_identifierToConstructorMap;
 };
index 24b5eb2..93b04d1 100644 (file)
@@ -224,7 +224,7 @@ static String familyNameFromPrimitive(const CSSPrimitiveValue& value)
     }
 }
 
-static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash>& locallyInstalledFontFaces)
+static void registerLocalFontFacesForFamily(const String& familyName, HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash>& locallyInstalledFontFaces)
 {
     ASSERT(!locallyInstalledFontFaces.contains(familyName));
 
index 26dead1..ef89acd 100644 (file)
@@ -86,9 +86,9 @@ private:
     void beginLoadTimerFired();
 
     Document* m_document;
-    HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash> m_fontFaces;
-    HashMap<String, Vector<Ref<CSSFontFace>>, CaseFoldingHash> m_locallyInstalledFontFaces;
-    HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, CaseFoldingHash> m_fonts;
+    HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_fontFaces;
+    HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_locallyInstalledFontFaces;
+    HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, ASCIICaseInsensitiveHash> m_fonts;
     HashSet<FontSelectorClient*> m_clients;
 
     Vector<CachedResourceHandle<CachedFont>> m_fontsToBeginLoading;
index 0da3619..ae0e70b 100644 (file)
@@ -64,7 +64,7 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-typedef HashSet<String, CaseFoldingHash> FeatureSet;
+typedef HashSet<String, ASCIICaseInsensitiveHash> FeatureSet;
 
 static void addString(FeatureSet& set, const char* string)
 {
index 4d68701..ee5ce6c 100644 (file)
@@ -1613,7 +1613,7 @@ private:
     HashSet<HTMLMediaElement*> m_allowsMediaDocumentInlinePlaybackElements;
 #endif
 
-    HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey;
+    HashMap<StringImpl*, Element*, ASCIICaseInsensitiveHash> m_elementsByAccessKey;
     bool m_accessKeyMapValid;
 
     DocumentOrderedMap m_imagesByUsemap;
index d9c56fe..3b1e547 100644 (file)
@@ -118,7 +118,7 @@ static bool isLegacySupportedJavaScriptLanguage(const String& language)
     // We want to accept all the values that either of these browsers accept, but not other values.
 
     // FIXME: This function is not HTML5 compliant. These belong in the MIME registry as "text/javascript<version>" entries.
-    typedef HashSet<String, CaseFoldingHash> LanguageSet;
+    typedef HashSet<String, ASCIICaseInsensitiveHash> LanguageSet;
     static NeverDestroyed<LanguageSet> languages;
     if (languages.get().isEmpty()) {
         languages.get().add("javascript");
index 62cf7ec..79e52b5 100644 (file)
@@ -77,7 +77,7 @@ public:
     bool allowExecutionWhenDisabled;
 };
 
-typedef HashMap<String, const EditorInternalCommand*, CaseFoldingHash> CommandMap;
+typedef HashMap<String, const EditorInternalCommand*, ASCIICaseInsensitiveHash> CommandMap;
 
 static const bool notTextInsertion = false;
 static const bool isTextInsertion = true;
index c6b620f..8b28310 100644 (file)
@@ -166,7 +166,7 @@ static bool shouldNotPerformURLAdjustment()
 // FIXME: This function should not deal with url or serviceType!
 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType)
 {
-    HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames;
+    HashSet<StringImpl*, ASCIICaseInsensitiveHash> uniqueParamNames;
     String urlParameter;
     
     // Scan the PARAM children and store their name/value pairs.
index 7da4f4a..f77f134 100644 (file)
@@ -86,7 +86,7 @@ using namespace HTMLNames;
 typedef bool (RuntimeEnabledFeatures::*InputTypeConditionalFunction)() const;
 typedef const AtomicString& (*InputTypeNameFunction)();
 typedef std::unique_ptr<InputType> (*InputTypeFactoryFunction)(HTMLInputElement&);
-typedef HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash> InputTypeFactoryMap;
+typedef HashMap<AtomicString, InputTypeFactoryFunction, ASCIICaseInsensitiveHash> InputTypeFactoryMap;
 
 template<class T>
 static std::unique_ptr<InputType> createInputType(HTMLInputElement& element)
index 90f9be6..7438c03 100644 (file)
@@ -34,7 +34,7 @@
 
 namespace WebCore {
 
-typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet;
+typedef HashSet<String, ASCIICaseInsensitiveHash> HTTPHeaderSet;
 
 class HTTPHeaderMap;
 enum class HTTPHeaderName;
index f4785ff..afe4f76 100644 (file)
@@ -59,7 +59,7 @@ private:
     std::chrono::steady_clock::time_point m_absoluteExpiryTime;
     StoredCredentials m_credentials;
     HashSet<String> m_methods;
-    HashSet<String, CaseFoldingHash> m_headers;
+    HashSet<String, ASCIICaseInsensitiveHash> m_headers;
 };
 
 class CrossOriginPreflightResultCache {
index 07091e3..012401c 100644 (file)
@@ -47,7 +47,7 @@
 namespace WebCore {
 
 typedef PassRefPtr<Archive> RawDataCreationFunction(const URL&, SharedBuffer*);
-typedef HashMap<String, RawDataCreationFunction*, CaseFoldingHash> ArchiveMIMETypesMap;
+typedef HashMap<String, RawDataCreationFunction*, ASCIICaseInsensitiveHash> ArchiveMIMETypesMap;
 
 // The create functions in the archive classes return PassRefPtr to concrete subclasses
 // of Archive. This adaptor makes the functions have a uniform return type.
index 620f1c3..dcde693 100644 (file)
@@ -150,7 +150,7 @@ static HashSet<String>* pdfMIMETypes;
 static HashSet<String>* pdfAndPostScriptMIMETypes;
 static HashSet<String>* unsupportedTextMIMETypes;
 
-typedef HashMap<String, Vector<String>*, CaseFoldingHash> MediaMIMETypeMap;
+typedef HashMap<String, Vector<String>*, ASCIICaseInsensitiveHash> MediaMIMETypeMap;
     
 static void initializeSupportedImageMIMETypes()
 {
index 71ee999..79b1593 100644 (file)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-typedef HashSet<String, CaseFoldingHash> URLSchemesMap;
+typedef HashSet<String, ASCIICaseInsensitiveHash> URLSchemesMap;
 
 class SchemeRegistry {
 public:
index f2f3569..7261003 100644 (file)
@@ -1990,7 +1990,7 @@ bool URL::isBlankURL() const
     return protocolIs("about");
 }
 
-typedef HashMap<String, unsigned short, CaseFoldingHash> DefaultPortsMap;
+typedef HashMap<String, unsigned short, ASCIICaseInsensitiveHash> DefaultPortsMap;
 static const DefaultPortsMap& defaultPortsMap()
 {
     static NeverDestroyed<const DefaultPortsMap> defaultPortsMap(DefaultPortsMap({
index 4af0916..83ffe1b 100644 (file)
@@ -119,7 +119,7 @@ public:
             return true;
         if (m_family.isNull() || other.m_family.isNull())
             return false;
-        return CaseFoldingHash::equal(m_family, other.m_family);
+        return ASCIICaseInsensitiveHash::equal(m_family, other.m_family);
     }
 
     FontDescriptionKey m_fontDescriptionKey;
@@ -129,7 +129,7 @@ public:
 struct FontPlatformDataCacheKeyHash {
     static unsigned hash(const FontPlatformDataCacheKey& fontKey)
     {
-        return pairIntHash(CaseFoldingHash::hash(fontKey.m_family), fontKey.m_fontDescriptionKey.computeHash());
+        return pairIntHash(ASCIICaseInsensitiveHash::hash(fontKey.m_family), fontKey.m_fontDescriptionKey.computeHash());
     }
          
     static bool equal(const FontPlatformDataCacheKey& a, const FontPlatformDataCacheKey& b)
index 16dfd67..1f51de0 100644 (file)
@@ -190,22 +190,20 @@ public:
     Ref<FontCascadeFonts> fonts;
 };
 
+// FIXME: Should make hash traits for FontCascadeCacheKey instead of using a hash as the key (so we hash a hash).
 typedef HashMap<unsigned, std::unique_ptr<FontCascadeCacheEntry>, AlreadyHashed> FontCascadeCache;
 
-static bool operator==(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b)
+static bool keysMatch(const FontCascadeCacheKey& a, const FontCascadeCacheKey& b)
 {
     if (a.fontDescriptionKey != b.fontDescriptionKey)
         return false;
     if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion)
         return false;
-    if (a.families.size() != b.families.size())
+    unsigned size = a.families.size();
+    if (size != b.families.size())
         return false;
-    for (unsigned i = 0; i < a.families.size(); ++i) {
-        auto* aImpl = a.families[i].impl();
-        auto* bImpl = b.families[i].impl();
-        if (aImpl == bImpl)
-            continue;
-        if (!aImpl || !bImpl || !CaseFoldingHash::equal(aImpl, bImpl))
+    for (unsigned i = 0; i < size; ++i) {
+        if (!equalIgnoringASCIICase(a.families[i], b.families[i]))
             return false;
     }
     return true;
@@ -232,26 +230,27 @@ static FontCascadeCacheKey makeFontCascadeCacheKey(const FontCascadeDescription&
 {
     FontCascadeCacheKey key;
     key.fontDescriptionKey = FontDescriptionKey(description);
-    for (unsigned i = 0; i < description.familyCount(); ++i)
-        key.families.append(description.familyAt(i));
+    unsigned familyCount = description.familyCount();
+    key.families.reserveInitialCapacity(familyCount);
+    for (unsigned i = 0; i < familyCount; ++i)
+        key.families.uncheckedAppend(description.familyAt(i));
     key.fontSelectorId = fontSelector ? fontSelector->uniqueId() : 0;
     key.fontSelectorVersion = fontSelector ? fontSelector->version() : 0;
     return key;
 }
 
-// FIXME: Why can't we just teach HashMap about FontCascadeCacheKey instead of hashing a hash?
 static unsigned computeFontCascadeCacheHash(const FontCascadeCacheKey& key)
 {
-    Vector<unsigned, 7> hashCodes;
-    hashCodes.reserveInitialCapacity(4 + key.families.size());
-
-    hashCodes.uncheckedAppend(key.fontDescriptionKey.computeHash());
-    hashCodes.uncheckedAppend(key.fontSelectorId);
-    hashCodes.uncheckedAppend(key.fontSelectorVersion);
-    for (unsigned i = 0; i < key.families.size(); ++i)
-        hashCodes.uncheckedAppend(key.families[i].impl() ? CaseFoldingHash::hash(key.families[i]) : 0);
-
-    return StringHasher::hashMemory(hashCodes.data(), hashCodes.size() * sizeof(unsigned));
+    // FIXME: Should hash the key and the family name characters rather than making a hash out of other hashes.
+    IntegerHasher hasher;
+    hasher.add(key.fontDescriptionKey.computeHash());
+    hasher.add(key.fontSelectorId);
+    hasher.add(key.fontSelectorVersion);
+    for (unsigned i = 0; i < key.families.size(); ++i) {
+        StringImpl* family = key.families[i].impl();
+        hasher.add(family ? ASCIICaseInsensitiveHash::hash(family) : 0);
+    }
+    return hasher.hash();
 }
 
 void pruneUnreferencedEntriesFromFontCascadeCache()
@@ -272,8 +271,8 @@ static Ref<FontCascadeFonts> retrieveOrAddCachedFonts(const FontCascadeDescripti
     auto key = makeFontCascadeCacheKey(fontDescription, fontSelector.get());
 
     unsigned hash = computeFontCascadeCacheHash(key);
-    auto addResult = fontCascadeCache().add(hash, std::unique_ptr<FontCascadeCacheEntry>());
-    if (!addResult.isNewEntry && addResult.iterator->value->key == key)
+    auto addResult = fontCascadeCache().add(hash, nullptr);
+    if (!addResult.isNewEntry && keysMatch(addResult.iterator->value->key, key))
         return addResult.iterator->value->fonts.get();
 
     auto& newEntry = addResult.iterator->value;
index 6d325c0..d965531 100644 (file)
@@ -645,7 +645,7 @@ SynthesisPair computeNecessarySynthesis(CTFontRef font, const FontDescription& f
     return SynthesisPair(needsSyntheticBold, needsSyntheticOblique);
 }
 
-typedef HashSet<String, CaseFoldingHash> Whitelist;
+typedef HashSet<String, ASCIICaseInsensitiveHash> Whitelist;
 static Whitelist& fontWhitelist()
 {
     static NeverDestroyed<Whitelist> whitelist;
index 2cdd3c6..e4de058 100644 (file)
@@ -48,7 +48,7 @@ struct CrossThreadHTTPHeaderMapData {
 class HTTPHeaderMap {
 public:
     typedef HashMap<HTTPHeaderName, String, WTF::IntHash<HTTPHeaderName>, WTF::StrongEnumHashTraits<HTTPHeaderName>> CommonHeadersHashMap;
-    typedef HashMap<String, String, CaseFoldingHash> UncommonHeadersHashMap;
+    typedef HashMap<String, String, ASCIICaseInsensitiveHash> UncommonHeadersHashMap;
 
     class HTTPHeaderMapConstIterator {
     public:
index 0728422..d80d07f 100644 (file)
@@ -366,21 +366,19 @@ bool RenderStyle::inheritedNotEqual(const RenderStyle* other) const
 }
 
 #if ENABLE(IOS_TEXT_AUTOSIZING)
-inline unsigned computeFontHash(const FontCascade& font)
+
+static inline unsigned computeFontHash(const FontCascade& font)
 {
-    unsigned hashCodes[2] = {
-        CaseFoldingHash::hash(font.fontDescription().firstFamily().impl()),
-        static_cast<unsigned>(font.fontDescription().specifiedSize())
-    };
-    return StringHasher::computeHash(reinterpret_cast<UChar*>(hashCodes), 2 * sizeof(unsigned) / sizeof(UChar));
+    IntegerHasher hasher;
+    hasher.add(ASCIICaseInsensitiveHash::hash(font.fontDescription().firstFamily()));
+    hasher.add(font.fontDescription().specifiedSize());
+    return hasher.hash();
 }
 
-uint32_t RenderStyle::hashForTextAutosizing() const
+unsigned RenderStyle::hashForTextAutosizing() const
 {
     // FIXME: Not a very smart hash. Could be improved upon. See <https://bugs.webkit.org/show_bug.cgi?id=121131>.
-    uint32_t hash = 0;
-    
-    hash ^= rareNonInheritedData->m_appearance;
+    unsigned hash = rareNonInheritedData->m_appearance;
     hash ^= rareNonInheritedData->marginBeforeCollapse;
     hash ^= rareNonInheritedData->marginAfterCollapse;
     hash ^= rareNonInheritedData->lineClamp.value();
@@ -421,6 +419,7 @@ bool RenderStyle::equalForTextAutosizing(const RenderStyle* other) const
         && noninherited_flags.floating() == other->noninherited_flags.floating()
         && rareNonInheritedData->textOverflow == other->rareNonInheritedData->textOverflow;
 }
+
 #endif // ENABLE(IOS_TEXT_AUTOSIZING)
 
 bool RenderStyle::inheritedDataShared(const RenderStyle* other) const
index 475b433..083d91d 100644 (file)
@@ -1,3 +1,18 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Replace CaseFoldingHash with ASCIICaseInsensitiveHash
+        https://bugs.webkit.org/show_bug.cgi?id=153639
+
+        Reviewed by Filip Pizlo.
+
+        * WebCoreStatistics.cpp:
+        (WebCoreStatistics::memoryStatistics): Use ASCIICaseInsensitiveHash for field names.
+        These names are all ASCII.
+
+        * WebURLResponse.cpp:
+        (WebURLResponse::allHeaderFields): Use ASCIICaseInsensitiveHash for HTTP header
+        field names. These names are all ASCII.
+
 2016-01-30  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r195911.
index 27f15ac..fb8dcd3 100644 (file)
@@ -295,7 +295,7 @@ HRESULT WebCoreStatistics::memoryStatistics(_COM_Outptr_opt_ IPropertyBag** stat
     unsigned long long heapFree = JSDOMWindow::commonVM().heap.capacity() - heapSize;
     GlobalMemoryStatistics globalMemoryStats = globalMemoryStatistics();
 
-    HashMap<String, unsigned long long, CaseFoldingHash> fields;
+    HashMap<String, unsigned long long, ASCIICaseInsensitiveHash> fields;
     fields.add("FastMallocReservedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.reservedVMBytes));
     fields.add("FastMallocCommittedVMBytes", static_cast<unsigned long long>(fastMallocStatistics.committedVMBytes));
     fields.add("FastMallocFreeListBytes", static_cast<unsigned long long>(fastMallocStatistics.freeListBytes));
@@ -304,7 +304,7 @@ HRESULT WebCoreStatistics::memoryStatistics(_COM_Outptr_opt_ IPropertyBag** stat
     fields.add("JavaScriptStackSize", static_cast<unsigned long long>(globalMemoryStats.stackBytes));
     fields.add("JavaScriptJITSize", static_cast<unsigned long long>(globalMemoryStats.JITBytes));
 
-    *statistics = COMPropertyBag<unsigned long long, String, CaseFoldingHash>::adopt(fields);
+    *statistics = COMPropertyBag<unsigned long long, String, ASCIICaseInsensitiveHash>::adopt(fields);
 
     return S_OK;
 }
index 04a830d..cc9e497 100644 (file)
@@ -362,11 +362,11 @@ HRESULT WebURLResponse::allHeaderFields(_COM_Outptr_opt_ IPropertyBag** headerFi
     if (!headerFields)
         return E_POINTER;
 
-    HashMap<String, String, CaseFoldingHash> fields;
+    HashMap<String, String, ASCIICaseInsensitiveHash> fields;
     for (const auto& keyValuePair : m_response.httpHeaderFields())
         fields.add(keyValuePair.key, keyValuePair.value);
 
-    *headerFields = COMPropertyBag<String, String, CaseFoldingHash>::adopt(fields);
+    *headerFields = COMPropertyBag<String, String, ASCIICaseInsensitiveHash>::adopt(fields);
     return S_OK;
 }
 
index cb37d3f..82903f6 100644 (file)
@@ -1,3 +1,25 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Replace CaseFoldingHash with ASCIICaseInsensitiveHash
+        https://bugs.webkit.org/show_bug.cgi?id=153639
+
+        Reviewed by Filip Pizlo.
+
+        * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm: Use ASCIICaseInsensitiveHash
+        for MIME types. MIME types are all ASCII.
+
+        * UIProcess/Plugins/PlugInAutoStartProvider.h: Use ASCIICaseInsensitiveHash for
+        origins. Origin strings should use ASCII case insensitive matching and should not
+        fold non-ASCII case.
+
+        * WebProcess/WebPage/WebPage.h: Use ASCIICaseInsensitiveHash for MIME types.
+        MIME types are all ASCII.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::addCaseFoldedCharacters): Use ASCIICaseInsensitiveHash to hash plug-in
+        origin strings. (See rationale above.)
+        (WebKit::hashForPlugInOrigin): Updated comment.
+
 2016-01-31  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Use std::make_unique<> when creating an unique_ptr object.
index 00ff15c..1489781 100644 (file)
@@ -42,7 +42,7 @@
 using namespace WebKit;
 
 @implementation WKWebViewContentProviderRegistry {
-    HashMap<String, Class <WKWebViewContentProvider>, CaseFoldingHash> _contentProviderForMIMEType;
+    HashMap<String, Class <WKWebViewContentProvider>, ASCIICaseInsensitiveHash> _contentProviderForMIMEType;
     HashCountedSet<WebPageProxy*> _pages;
 }
 
index 501d68a..fe6bc6f 100644 (file)
@@ -69,7 +69,7 @@ private:
 
     void setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary&, std::function<bool(double expirationTimestamp)>);
 
-    typedef HashMap<String, PlugInAutoStartOriginMap, CaseFoldingHash> AutoStartTable;
+    typedef HashMap<String, PlugInAutoStartOriginMap, ASCIICaseInsensitiveHash> AutoStartTable;
     typedef HashMap<WebCore::SessionID, AutoStartTable> SessionAutoStartTable;
     SessionAutoStartTable m_autoStartTable;
 
index a8e89f9..10ffa5e 100644 (file)
@@ -1393,7 +1393,7 @@ private:
     WebCore::Timer m_volatilityTimer;
 #endif
 
-    HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;
+    HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
     WebCore::Color m_backgroundColor;
 
     HashSet<unsigned> m_activeRenderingSuppressionTokens;
index 303b1f7..27a2c27 100644 (file)
@@ -721,16 +721,16 @@ static inline void addCaseFoldedCharacters(StringHasher& hasher, const String& s
     if (string.isEmpty())
         return;
     if (string.is8Bit()) {
-        hasher.addCharacters<LChar, CaseFoldingHash::foldCase<LChar>>(string.characters8(), string.length());
+        hasher.addCharacters<LChar, ASCIICaseInsensitiveHash::foldCase<LChar>>(string.characters8(), string.length());
         return;
     }
-    hasher.addCharacters<UChar, CaseFoldingHash::foldCase<UChar>>(string.characters16(), string.length());
+    hasher.addCharacters<UChar, ASCIICaseInsensitiveHash::foldCase<UChar>>(string.characters16(), string.length());
 }
 
 static unsigned hashForPlugInOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType)
 {
     // We want to avoid concatenating the strings and then taking the hash, since that could lead to an expensive conversion.
-    // We also want to avoid using the hash() function in StringImpl or CaseFoldingHash because that masks out bits for the use of flags.
+    // We also want to avoid using the hash() function in StringImpl or ASCIICaseInsensitiveHash because that masks out bits for the use of flags.
     StringHasher hasher;
     addCaseFoldedCharacters(hasher, pageOrigin);
     hasher.addCharacter(0);
index 3858ae1..f7b88eb 100644 (file)
@@ -1,3 +1,12 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Replace CaseFoldingHash with ASCIICaseInsensitiveHash
+        https://bugs.webkit.org/show_bug.cgi?id=153639
+
+        Reviewed by Filip Pizlo.
+
+        * Scripts/do-webcore-rename: Use script to do this rename.
+
 2016-01-30  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r195911.
index f0ccb21..24ea970 100755 (executable)
@@ -98,7 +98,7 @@ sub wanted
 my $isDOMTypeRename = 0;
 my %renames = (
     # Renames go here in the form of:
-    "deleteAllValues" => "deprecatedDeleteAllValues",
+    "CaseFoldingHash" => "ASCIICaseInsensitiveHash",
 );
 
 my %renamesContemplatedForTheFuture = (