Replace CaseFoldingHash with ASCIICaseInsensitiveHash
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Jan 2016 21:53:47 +0000 (21:53 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Jan 2016 21:53:47 +0000 (21:53 +0000)
commite88217ee9888dbc019b72d9b664572973f4d2139
tree461a650f6b3517b42b27d151f09486a99163d5cf
parent8d3e98d49ec4fcb62caf8496c84d8fdc3e3438e8
Replace CaseFoldingHash with ASCIICaseInsensitiveHash
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: Reworked FontPlatformDataCacheKey struct:
Made it a conventional struct with non-prefixed data members names. Removed
the "==" operator since it was appropriate for hash table lookup but wasn't
a true equality operator. Tightened the implementations of the constructors.
(WebCore::FontPlatformDataCacheKeyHash::hash): Use ASCIICaseInsensitiveHash.
(WebCore::FontPlatformDataCacheKeyHash::equal): Do the equality check here,
not using the == operator. And use equalIgnoringASCIICase.
(WebCore::FontPlatformDataCacheKeyTraits::isEmptyValue): Added this entire
traits struct so we check empty values in a more efficient way.
(WebCore::FontCache::getCachedFontPlatformData): Added comments and tweaked
style in this function.

* 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@195911 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