Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jan 2016 17:26:41 +0000 (17:26 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jan 2016 17:26:41 +0000 (17:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153411

Reviewed by Ryosuke Niwa.

Source/WebCore:

Tests: fast/media/media-query-non-ASCII-case-folding.html
       fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html
       fast/xpath/xpath-non-ASCII-case-folding.html

No tests included that cover the minor behavior changes in Document::setDomain,
CSPSource::schemeMatches, CSPSource::hostMatches, OriginAccessEntry::operator==,
UserContentURLPattern::matches, UserContentURLPattern::matchesHost,
ContentFilterUnblockHandler::canHandleRequest. Would like to add tests for those
if possible, but it seems clear all are progressions.

For background on why this is the right thing to do in almost every case:

- MIME types are all ASCII and not case sensitive (details in RFC 2045)
  <http://tools.ietf.org/html/rfc2045>
- case insensitive comparisons in HTML are all "ASCII case-insensitive"
  https://www.w3.org/TR/html/infrastructure.html#ascii-case-insensitive
- same for CSS

* Modules/webdatabase/DatabaseAuthorizer.cpp:
(WebCore::DatabaseAuthorizer::denyBasedOnTableName): Use equalIgnoringASCIICase.
No change in behavior since the string we are comparing with is always
"__WebKitDatabaseInfoTable__" in practice.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::siblingWithAriaRole): Changed argument type to take a const char*,
added some FIXMEs and use equalIgnoringCase. No change in behavior since the
strings we are comparing with are "menu" and "menuitem".
(WebCore::AccessibilityNodeObject::menuElementForMenuButton): Updated to pass
arguments in reverse order.
(WebCore::AccessibilityNodeObject::menuItemElementForMenu): Ditto.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseFontFaceValue): Use equalIgnoringASCIICase.
No change in behavior because the property names are all ASCII constants.

* css/CSSParserValues.h: Removed unused equalIgnoringCase function.

* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::mediaTypeMatch): Use equalIgnoringASCIICase.
Changes behavior: No non-ASCII case folding when matching media types.
Covered by new test.
(WebCore::MediaQueryEvaluator::mediaTypeMatchSpecific): Use equalIgnoringASCIICase.
No change in behavior since the only string this is ever called with is "print".

* dom/DataTransfer.cpp:
(WebCore::DataTransfer::hasFileOfType): Use equalIgnoringASCIICase.
No change in behavior because local files will not have content types with
non-ASCII characters in them. In the extremely unlikely case that this is incorrect,
the change in behavior is a progression.

* dom/Document.cpp:
(WebCore::Document::setDomain): Use equalIgnoringASCIICase.
Changes behavior: Domains considered equal because of non-ASCII case folding
would get through without an error before, and now will properly throw an exception.

* dom/Element.cpp:
(WebCore::isStyleAttribute): Refactored into a helper function. Use
equalLettersIgnoringASCIICase. No change in behavior.
(WebCore::Element::synchronizeAttribute): Use isStyleAttribute.

* dom/TreeScope.cpp:
(WebCore::TreeScope::findAnchor): Use equalIgnoringASCIICase.
Changes behavior: Could go to an anchor and it would be considered a match because
of non-ASCII case folding. Covered by new test.

* html/HiddenInputType.cpp:
(WebCore::HiddenInputType::appendFormData): Use equalIgnoringASCIICase.
No change in behavior: comparing with an ASCII literal.
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getExtension): Ditto.
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getExtension): Ditto.

* html/parser/CSSPreloadScanner.cpp:
(WebCore::CSSPreloadScanner::emitRule): Use equalLettersIgnoringASCIICase and
StringView to avoid needing a special ruleEqualIgnoringCase function.
No change in behavior.

* inspector/InspectorNodeFinder.cpp:
(WebCore::InspectorNodeFinder::matchesElement): Use equalIgnoringASCIICase.
Changes behavior, but it's an inspector UI thing, not a web behavior thing,
so I don't think a new regression test is needed.

* loader/HistoryController.cpp:
(WebCore::HistoryController::currentItemShouldBeReplaced): Use
equalIgnoringASCIICase. No change in behavior because we are comparing
with "about:blank".

* loader/SubframeLoader.cpp:
(WebCore::findPluginMIMETypeFromURL): Use equalIgnoringASCIICase.
No change in behavior unless a plug-in claims an extension with non-ASCII
characters. I don't think a new regression test is needed.

* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache):
Use equalIgnoringASCIICase. No change in behavior because both strings are
protocols from URLs and we don't parse non-ASCII characters into protocol strings;
non-ASCII are already encoding as punycode.
* loader/appcache/ManifestParser.cpp:
(WebCore::parseManifest): Ditto.

* page/ContentSecurityPolicy.cpp:
(WebCore::isExperimentalDirectiveName): Added. Used by isDirectiveName.
Uses equalLettersIgnoringASCIICase. No change in behavior.
(WebCore::isDirectiveName): Use equalLettersIgnoringASCIICase.
No change in behavior.
(WebCore::isSourceListNone): Use equalLettersIgnoringASCIICase. No
change in behavior.
(WebCore::CSPSource::schemeMatches): Use equalLettersIgnoringASCIICase
and equalIgnoringASCIICase. It's all about comparing URL protocols. The
old code might have done something strange if someone specified a protocol
with a non-ASCII character in it.
(WebCore::CSPSource::hostMatches): Use equalIgnoringASCIICase.
(WebCore::CSPSourceList::parseSource): Use equalLettersIgnoringASCIICase.
No change in behavior.
(WebCore::CSPDirectiveList::checkSourceAndReportViolation): Tweaked code
to do less unnecessary String allocation.
(WebCore::CSPDirectiveList::parseReflectedXSS): Use
equalLettersIgnoringASCIICase. No change in behavior.
(WebCore::CSPDirectiveList::addDirective): Ditto.
(WebCore::ContentSecurityPolicy::reportUnsupportedDirective): Use
equalLettersIgnoringASCIICase and remove unneeded global constant strings.
No change in behavior.
(WebCore::ContentSecurityPolicy::reportDirectiveAsSourceExpression):
Tweak code to eliminate unneeded local.
(WebCore::ContentSecurityPolicy::reportDuplicateDirective): Ditto.
(WebCore::ContentSecurityPolicy::reportInvalidSourceExpression): Use
equalLettersIgnoringASCIICase. No change in behavior.

* page/OriginAccessEntry.h:
(WebCore::operator==): Use equalLettersIgnoringASCIICase.

* page/Performance.cpp:
(WebCore::Performance::webkitGetEntriesByName): Use equalLettersIgnoringASCIICase.
No change in behavior.

* page/UserContentURLPattern.cpp:
(WebCore::UserContentURLPattern::matches): Use equalIgnoringASCIICase to match
schemes.
(WebCore::UserContentURLPattern::matchesHost): Use equalIgnoringASCIICase to
match host names.

* platform/URL.cpp:
(WebCore::URL::init): Use equalIgnoringASCIICase, and also use StringView to
avoid having to allocate a second string just for comparison purposes. Should be
better for efficiency with no change in behavior.

* platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
(WebCore::ContentFilterUnblockHandler::canHandleRequest): Use equalIgnoringASCIICase
to compare hosts.

* platform/efl/PlatformSpeechSynthesisProviderEfl.cpp:
(WebCore::PlatformSpeechSynthesisProviderEfl::voiceName): Use StringView and
equalIgnoringASCIICase to compare language tags. No test needed because there are
no language tags with non-ASCII characters in them.

* platform/graphics/FontCache.cpp:
(WebCore::FontPlatformDataCacheKey::operator==): Changed to use the equal
function from CaseFoldingHash. In a subsequent patch we will change this to be
ASCIICaseFoldingHash since font names don't need to compare non-ASCII characters
in a case folding manner, but for now preserve behavior.
(WebCore::alternateFamilyName): Use equalLettersIgnoringASCIICase to avoid having
to use a special familyNameEqualIgnoringCase function. This does mean there will
be a null check and a length check that wasn't there before, but the actual
comparison function will be tighter. Guessing it will be a wash. Also improved
the comments and sorted the Windows cases in with the others. No behavior change.

* platform/graphics/FontCascade.cpp:
(WebCore::operator==): Changed to use the equal function from CaseFoldingHash.
Same rationale as above in FontPlatformDataCacheKey.

* platform/graphics/FontDescription.cpp:
(WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
equalIgnoringASCIICase to compare font family names. Only possible change in
behavior would be if actual fonts with non-ASCII names but that were specified
with different case in style sheets. Highly unlikely this exists.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::supportsType): Use equalLettersIgnoringASCIICase.
No change in behavior.
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::keySystemIsSupported): Ditto.

* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::isCommonlyUsedGenericFamily): Added.
(WebCore::FontCache::createFontPlatformData): Moved code into the
isCommonlyUsedGenericFamily helper and used equalIgnoringASCIICase.

* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::FontCustomPlatformData::supportsFormat): Use
equalLettersIgnoringASCIICase. No change in behavior.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::adjustedGDIFontWeight): Ditto.
(WebCore::FontCache::createFontPlatformData): Ditto.
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::supportsFormat): Ditto.
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::supportsFormat): Ditto.

* platform/mac/PlatformSpeechSynthesizerMac.mm:
(-[WebSpeechSynthesisWrapper speakUtterance:]): Use equalIgnoringASCIICase to
compare languages. No change in behavior because languages have all-ASCII names.

* platform/network/CacheValidation.cpp:
(WebCore::shouldUpdateHeaderAfterRevalidation): Use equalIgnoringASCIICase.
No change in behavior since it's a fixed list of all ASCII headers.
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::isAppendableHeader): Ditto.

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::willSendRequest): Use equalIgnoringASCIICase.
No change in behavior because HTTP methods are all ASCII letters.

* platform/text/mac/LocaleMac.mm:
(WebCore::determineLocale): Use equalIgnoringASCIICase. No change in behavior
because locale languages identifiers are all ASCII.
* platform/text/win/LocaleWin.cpp:
(WebCore::LCIDFromLocaleInternal): Ditto.

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendArabicReplacementSubtable):
Use equalIgnoringASCIICase. No change in behavior because Arabic form attribute
values are all ASCII.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod): Use equalIgnoringASCIICase.
No change in behavior because these are all fixed known ASCII HTTP method names.

* xml/XPathFunctions.cpp:
(WebCore::XPath::FunLang::evaluate): Use equalIgnoringASCIICase. Changes behavior
if specifying a non-ASCII character. Covered by new test.

* xml/XPathStep.cpp:
(WebCore::XPath::nodeMatchesBasicTest): Use equalIgnoringASCIICase. Changes
behavior if an element local name or XPath predicate has a non-ASCII character.
Covered by new test.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(parameterValue): Use equalIgnoringASCIICase. No behavior change because the
only name we ever search for with this is "pluginspage".

Source/WebKit/win:

* Plugins/PluginDatabase.cpp:
(WebCore::PluginDatabase::MIMETypeForExtension): Use equalIgnoringASCIICase to compare
file extensions.
* Plugins/PluginDatabaseWin.cpp:
(WebCore::PluginDatabase::getPluginPathsInDirectories): Use equalLettersIgnoringASCIICase
to compare filenames.
* Plugins/PluginPackageWin.cpp:
(WebCore::PluginPackage::isPluginBlacklisted): Use equalLettersIgnoringASCIICase to
compare DLL filenames.
* Plugins/PluginStream.cpp:
(WebCore::PluginStream::destroyStream): Use equalLettersIgnoringASCIICase to check HTTP method.
* Plugins/PluginView.cpp:
(WebCore::PluginView::setParameters): Use equalLettersIgnoringASCIICase to check
plug-in parameter name.
* WebView.cpp:
(WebView::canHandleRequest): Use URL::protocolIs instead of equalIgnoringCase.

Source/WebKit2:

* Shared/API/c/WKString.cpp:
(WKStringIsEqualToUTF8CStringIgnoringCase): Use equalIgnoringASCIICase.
This is a change in behavior for callers who passed non-ASCII letters to
this function and expected case insensitive comparison.

* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::PDFPlugin::streamDidReceiveResponse): Use equalIgnoringASCIICase.
No change in behavior because this is just checking a fixed ASCII MIME type.
(WebKit::PDFPlugin::manualStreamDidReceiveResponse): Ditto.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::streamDidReceiveResponse): Ditto.
(WebKit::PDFPlugin::manualStreamDidReceiveResponse): Ditto.

Source/WTF:

* wtf/text/AtomicString.h: Removed equalIgnoringCase.
Added some overloads for equalIgnoringASCIICase and moved the function bodies to
bottom of the file to make the function declarations easier to read and scan through.
I plan to do this for more of the functions in this class in the future.

* wtf/text/StringCommon.h: Added overloads for equalIgnoringASCIICase,
equalPossiblyIgnoringASCIICase, and a helper named equalIgnoringASCIICaseCommon.
Added an overload for equalLettersIgnoringASCIICase.

* wtf/text/StringImpl.cpp:
(WTF::equalIgnoringCase): Made the few remaining versions of this function private
to this file. Once we get done moving every client that should be using ASCII case
instead to new functions, these will almost certainly be deleted.
(WTF::equalIgnoringASCIICaseNonNull): Tweaked implementation a tiny bit.

* wtf/text/StringImpl.h: Sorted forward declarations at the top of the file.
Fixed some small formatting mistakes. Removed equalIgnoringCase, but left
equalIgnoringCaseNonNull behind for use by CaseFoldingHash until it is replaced
with ASCIICaseFoldingHash. Improved equalIgnoringASCIICase implementation.
Removed unneeded using for equalIgnoringASCIICase now that StringCommon.h takes
care of it.

* wtf/text/StringView.cpp:
(WTF::equalIgnoringASCIICase): Deleted. We no longer pass in the length for this,
so the arguments have changed and the implementation is also now in ASCIICommon.h
so it's an inline in the header file.

* wtf/text/StringView.h: Added an overload of equalIgnoringASCIICase,while
removing another.

* wtf/text/WTFString.h: Removed some unneeded forward delcarations. Fixed formatting
of the type name NSString *. Improved some comments. Removed equalIgnoringCase.
Separated declaration from implementation in a few cases to start making the
function declarations easier to read and scan through. I plan to do more in the future.

Tools:

* Scripts/do-webcore-rename: Removed rename of equalIgnoringCase since we
have removed the function instead.

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST): Updated test since nullptr is now ambiguous since we
added overloads for const char*.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::isPressActionSupported): Use equalLettersIgnoringASCIICase.
(WTR::AccessibilityUIElement::hasPopup): Ditto.
* WebKitTestRunner/cocoa/CrashReporterInfo.mm:
(WTR::testPathFromURL): Ditto.

LayoutTests:

* fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html: Added.
* fast/dom/HTMLAnchorElement/resources/iframe-with-non-ASCII-matching-anchor.html: Added.

* fast/media/media-query-non-ASCII-case-folding-expected.txt: Added.
* fast/media/media-query-non-ASCII-case-folding.html: Added.

* fast/xpath/xpath-non-ASCII-case-folding-expected.txt: Added.
* fast/xpath/xpath-non-ASCII-case-folding.html: Added.

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

81 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLAnchorElement/resources/iframe-with-non-ASCII-matching-anchor.html [new file with mode: 0644]
LayoutTests/fast/media/media-query-non-ASCII-case-folding-expected.txt [new file with mode: 0644]
LayoutTests/fast/media/media-query-non-ASCII-case-folding.html [new file with mode: 0644]
LayoutTests/fast/xpath/xpath-non-ASCII-case-folding-expected.txt [new file with mode: 0644]
LayoutTests/fast/xpath/xpath-non-ASCII-case-folding.html [new file with mode: 0644]
Source/WTF/ChangeLog
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringCommon.h
Source/WTF/wtf/text/StringHash.h
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/StringView.cpp
Source/WTF/wtf/text/StringView.h
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParserValues.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/dom/DataTransfer.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/TreeScope.cpp
Source/WebCore/html/HiddenInputType.cpp
Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/parser/CSSPreloadScanner.cpp
Source/WebCore/inspector/InspectorNodeFinder.cpp
Source/WebCore/loader/HistoryController.cpp
Source/WebCore/loader/SubframeLoader.cpp
Source/WebCore/loader/appcache/ApplicationCacheHost.cpp
Source/WebCore/loader/appcache/ManifestParser.cpp
Source/WebCore/page/OriginAccessEntry.h
Source/WebCore/page/Performance.cpp
Source/WebCore/page/UserContentURLPattern.cpp
Source/WebCore/page/csp/ContentSecurityPolicy.cpp
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm
Source/WebCore/platform/efl/PlatformSpeechSynthesisProviderEfl.cpp
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontDescription.cpp
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm
Source/WebCore/platform/network/CacheValidation.cpp
Source/WebCore/platform/network/curl/ResourceHandleManager.cpp
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/text/mac/LocaleMac.mm
Source/WebCore/platform/text/win/LocaleWin.cpp
Source/WebCore/svg/SVGToOTFFontConversion.cpp
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XPathFunctions.cpp
Source/WebCore/xml/XPathStep.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/Plugins/PluginDatabase.cpp
Source/WebKit/win/Plugins/PluginDatabaseWin.cpp
Source/WebKit/win/Plugins/PluginPackageWin.cpp
Source/WebKit/win/Plugins/PluginStream.cpp
Source/WebKit/win/Plugins/PluginView.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/WKString.cpp
Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
Tools/ChangeLog
Tools/Scripts/do-webcore-rename
Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
Tools/WebKitTestRunner/cocoa/CrashReporterInfo.mm

index 7e8949a..5bae232 100644 (file)
@@ -1,3 +1,20 @@
+2016-01-28  Darin Adler  <darin@apple.com>
+
+        Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
+        https://bugs.webkit.org/show_bug.cgi?id=153411
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding-expected.txt: Added.
+        * fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html: Added.
+        * fast/dom/HTMLAnchorElement/resources/iframe-with-non-ASCII-matching-anchor.html: Added.
+
+        * fast/media/media-query-non-ASCII-case-folding-expected.txt: Added.
+        * fast/media/media-query-non-ASCII-case-folding.html: Added.
+
+        * fast/xpath/xpath-non-ASCII-case-folding-expected.txt: Added.
+        * fast/xpath/xpath-non-ASCII-case-folding.html: Added.
+
 2016-01-28  Zalan Bujtas  <zalan@apple.com>
 
         Unexpected content wrapping at http://email.osh.com/H/2/v100000152474feb8ec7c1a1f4bbe5c7c0/HTML
diff --git a/LayoutTests/fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding-expected.txt b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding-expected.txt
new file mode 100644 (file)
index 0000000..254ac95
--- /dev/null
@@ -0,0 +1,3 @@
+This tests whether clicking on an anchor that only matches because of incorrect non-ASCII case folding will scroll to anchor. If clicking on the link below triggers a scroll, the test fails.
+
+PASS
diff --git a/LayoutTests/fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html b/LayoutTests/fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html
new file mode 100644 (file)
index 0000000..33b91b8
--- /dev/null
@@ -0,0 +1,2 @@
+<p>This tests whether clicking on an anchor that only matches because of incorrect non-ASCII case folding will scroll to anchor. If clicking on the link below triggers a scroll, the test fails.</p>
+<iframe src="resources/iframe-with-non-ASCII-matching-anchor.html" width="100%" height="2000"></iframe>
diff --git a/LayoutTests/fast/dom/HTMLAnchorElement/resources/iframe-with-non-ASCII-matching-anchor.html b/LayoutTests/fast/dom/HTMLAnchorElement/resources/iframe-with-non-ASCII-matching-anchor.html
new file mode 100644 (file)
index 0000000..99a5ca0
--- /dev/null
@@ -0,0 +1,41 @@
+<meta charset="utf-8">
+<script>
+
+function runTest()
+{
+    if (!window.testRunner)
+        return;
+    if (!window.eventSender)
+        return;
+
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+
+    var anchor = document.getElementById("start");
+    var x = frameElement.offsetLeft + anchor.offsetLeft + 2;
+    var y = frameElement.offsetTop + anchor.offsetTop + 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    setTimeout(finish, 1000);
+}
+
+function finish()
+{
+    var result;
+    if (top.scrollY == 0)
+        result = "PASS";
+    else
+        result = "FAIL: should not match the anchor and should not trigger a scroll";
+
+    top.document.body.appendChild(document.createTextNode(result));
+
+    testRunner.notifyDone();
+}
+
+</script>
+<body onload="runTest();">
+    <a id="start" href="#scroll">Go to anchor</a>
+    <div style="height: 1000px"></div>
+    <a name="ſcroll">Anchor</a>
+</body>
diff --git a/LayoutTests/fast/media/media-query-non-ASCII-case-folding-expected.txt b/LayoutTests/fast/media/media-query-non-ASCII-case-folding-expected.txt
new file mode 100644 (file)
index 0000000..6861443
--- /dev/null
@@ -0,0 +1,12 @@
+Test media queries to make sure only ASCII case is folded, and other non-ASCII case folding is not performed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS matchMedia('screen').matches is true
+PASS matchMedia('SCREEN').matches is true
+PASS matchMedia('ſcreen').matches is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/media/media-query-non-ASCII-case-folding.html b/LayoutTests/fast/media/media-query-non-ASCII-case-folding.html
new file mode 100644 (file)
index 0000000..a23cbc7
--- /dev/null
@@ -0,0 +1,9 @@
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+    description("Test media queries to make sure only ASCII case is folded, and other non-ASCII case folding is not performed.");
+    shouldBeTrue("matchMedia('screen').matches");
+    shouldBeTrue("matchMedia('SCREEN').matches");
+    shouldBeFalse("matchMedia('ſcreen').matches");
+</script>
+<script src="../../resources/js-test-post.js"></script>
diff --git a/LayoutTests/fast/xpath/xpath-non-ASCII-case-folding-expected.txt b/LayoutTests/fast/xpath/xpath-non-ASCII-case-folding-expected.txt
new file mode 100644 (file)
index 0000000..204e618
--- /dev/null
@@ -0,0 +1,15 @@
+Test XPath element tag and language matching to make sure only ASCII case is folded, and other non-ASCII case folding is not performed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.evaluate('count(.//span[attribute::id])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue is 1
+PASS document.evaluate('count(.//ſpan[attribute::id])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue is 0
+PASS document.evaluate('count(.//p[lang("en")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue is 1
+PASS document.evaluate('count(.//p[lang("sv")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue is 1
+PASS document.evaluate('count(.//p[lang("SV")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue is 1
+PASS document.evaluate('count(.//p[lang("ſv")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/xpath/xpath-non-ASCII-case-folding.html b/LayoutTests/fast/xpath/xpath-non-ASCII-case-folding.html
new file mode 100644 (file)
index 0000000..682641c
--- /dev/null
@@ -0,0 +1,26 @@
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+<body>
+<div id="test">
+    <p id="English">This paragraph is marked as being in English.</p>
+    <p id="Swedish">This paragraph is marked as being in Swedish.</p>
+    <p><span id="anything">The span element containing the text in this paragraph has an ID specified on it.</span></p>
+</div>
+</body>
+<script>
+    description("Test XPath element tag and language matching to make sure only ASCII case is folded, and other non-ASCII case folding is not performed.");
+
+    document.getElementById("English").setAttributeNS("http://www.w3.org/XML/1998/namespace", "lang", "en");
+    document.getElementById("Swedish").setAttributeNS("http://www.w3.org/XML/1998/namespace", "lang", "sv");
+
+    shouldBe("document.evaluate('count(.//span[attribute::id])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue", "1");
+    shouldBe("document.evaluate('count(.//ſpan[attribute::id])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue", "0");
+
+    shouldBe("document.evaluate('count(.//p[lang(\"en\")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue", "1");
+    shouldBe("document.evaluate('count(.//p[lang(\"sv\")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue", "1");
+    shouldBe("document.evaluate('count(.//p[lang(\"SV\")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue", "1");
+    shouldBe("document.evaluate('count(.//p[lang(\"ſv\")])', document.body, null, XPathResult.NUMBER_TYPE, null).numberValue", "0");
+
+    document.body.removeChild(document.getElementById("test"));
+</script>
+<script src="../../resources/js-test-post.js"></script>
index 9b9c8c2..94118df 100644 (file)
@@ -1,3 +1,45 @@
+2016-01-28  Darin Adler  <darin@apple.com>
+
+        Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
+        https://bugs.webkit.org/show_bug.cgi?id=153411
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/text/AtomicString.h: Removed equalIgnoringCase.
+        Added some overloads for equalIgnoringASCIICase and moved the function bodies to
+        bottom of the file to make the function declarations easier to read and scan through.
+        I plan to do this for more of the functions in this class in the future.
+
+        * wtf/text/StringCommon.h: Added overloads for equalIgnoringASCIICase,
+        equalPossiblyIgnoringASCIICase, and a helper named equalIgnoringASCIICaseCommon.
+        Added an overload for equalLettersIgnoringASCIICase.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::equalIgnoringCase): Made the few remaining versions of this function private
+        to this file. Once we get done moving every client that should be using ASCII case
+        instead to new functions, these will almost certainly be deleted.
+        (WTF::equalIgnoringASCIICaseNonNull): Tweaked implementation a tiny bit.
+
+        * wtf/text/StringImpl.h: Sorted forward declarations at the top of the file.
+        Fixed some small formatting mistakes. Removed equalIgnoringCase, but left
+        equalIgnoringCaseNonNull behind for use by CaseFoldingHash until it is replaced
+        with ASCIICaseFoldingHash. Improved equalIgnoringASCIICase implementation.
+        Removed unneeded using for equalIgnoringASCIICase now that StringCommon.h takes
+        care of it.
+
+        * wtf/text/StringView.cpp:
+        (WTF::equalIgnoringASCIICase): Deleted. We no longer pass in the length for this,
+        so the arguments have changed and the implementation is also now in ASCIICommon.h
+        so it's an inline in the header file.
+
+        * wtf/text/StringView.h: Added an overload of equalIgnoringASCIICase,while
+        removing another.
+
+        * wtf/text/WTFString.h: Removed some unneeded forward delcarations. Fixed formatting
+        of the type name NSString *. Improved some comments. Removed equalIgnoringCase.
+        Separated declaration from implementation in a few cases to start making the
+        function declarations easier to read and scan through. I plan to do more in the future.
+
 2016-01-27  Chris Dumez  <cdumez@apple.com>
 
         window.atob() should ignore spaces in input
index 0edd2b5..73f2688 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2005, 2006, 2008, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2006, 2008, 2014-2016 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -215,17 +215,10 @@ inline bool operator!=(const LChar* a, const AtomicString& b) { return !(b == a)
 inline bool operator!=(const String& a, const AtomicString& b) { return !equal(a.impl(), b.impl()); }
 inline bool operator!=(const Vector<UChar>& a, const AtomicString& b) { return !(a == b); }
 
-inline bool equalIgnoringCase(const AtomicString& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
-inline bool equalIgnoringCase(const AtomicString& a, const LChar* b) { return equalIgnoringCase(a.impl(), b); }
-inline bool equalIgnoringCase(const AtomicString& a, const char* b) { return equalIgnoringCase(a.impl(), reinterpret_cast<const LChar*>(b)); }
-inline bool equalIgnoringCase(const AtomicString& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
-inline bool equalIgnoringCase(const LChar* a, const AtomicString& b) { return equalIgnoringCase(a, b.impl()); }
-inline bool equalIgnoringCase(const char* a, const AtomicString& b) { return equalIgnoringCase(reinterpret_cast<const LChar*>(a), b.impl()); }
-inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
-
-inline bool equalIgnoringASCIICase(const AtomicString& a, const AtomicString& b) { return equalIgnoringASCIICase(a.impl(), b.impl()); }
-inline bool equalIgnoringASCIICase(const AtomicString& a, const String& b) { return equalIgnoringASCIICase(a.impl(), b.impl()); }
-inline bool equalIgnoringASCIICase(const String& a, const AtomicString& b) { return equalIgnoringASCIICase(a.impl(), b.impl()); }
+bool equalIgnoringASCIICase(const AtomicString&, const AtomicString&);
+bool equalIgnoringASCIICase(const AtomicString&, const String&);
+bool equalIgnoringASCIICase(const String&, const AtomicString&);
+bool equalIgnoringASCIICase(const AtomicString&, const char*);
 
 template<unsigned length> bool equalLettersIgnoringASCIICase(const AtomicString&, const char (&lowercaseLetters)[length]);
 
@@ -344,6 +337,26 @@ template<unsigned length> inline bool equalLettersIgnoringASCIICase(const Atomic
     return equalLettersIgnoringASCIICase(string.string(), lowercaseLetters);
 }
 
+inline bool equalIgnoringASCIICase(const AtomicString& a, const AtomicString& b)
+{
+    return equalIgnoringASCIICase(a.string(), b.string());
+}
+
+inline bool equalIgnoringASCIICase(const AtomicString& a, const String& b)
+{
+    return equalIgnoringASCIICase(a.string(), b);
+}
+
+inline bool equalIgnoringASCIICase(const String& a, const AtomicString& b)
+{
+    return equalIgnoringASCIICase(a, b.string());
+}
+
+inline bool equalIgnoringASCIICase(const AtomicString& a, const char* b)
+{
+    return equalIgnoringASCIICase(a.string(), b);
+}
+
 } // namespace WTF
 
 #ifndef ATOMICSTRING_HIDE_GLOBALS
index 09f4e34..22529c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 namespace WTF {
 
+template<typename CharacterTypeA, typename CharacterTypeB> bool equalIgnoringASCIICase(const CharacterTypeA*, const CharacterTypeB*, unsigned length);
+template<typename CharacterTypeA, typename CharacterTypeB> bool equalIgnoringASCIICase(const CharacterTypeA*, unsigned lengthA, const CharacterTypeB*, unsigned lengthB);
+
+template<typename StringClassA, typename StringClassB> bool equalIgnoringASCIICaseCommon(const StringClassA&, const StringClassB&);
+
 template<typename CharacterType> bool equalLettersIgnoringASCIICase(const CharacterType*, const char* lowercaseLetters, unsigned length);
+template<typename CharacterType, unsigned lowercaseLettersLength> bool equalLettersIgnoringASCIICase(const CharacterType*, unsigned charactersLength, const char (&lowercaseLetters)[lowercaseLettersLength]);
+
 template<typename StringClass, unsigned length> bool equalLettersIgnoringASCIICaseCommon(const StringClass&, const char (&lowercaseLetters)[length]);
 
 template<typename T>
@@ -326,6 +333,11 @@ inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB
     return true;
 }
 
+template<typename CharacterTypeA, typename CharacterTypeB> inline bool equalIgnoringASCIICase(const CharacterTypeA* a, unsigned lengthA, const CharacterTypeB* b, unsigned lengthB)
+{
+    return lengthA == lengthB && equalIgnoringASCIICase(a, b, lengthA);
+}
+
 template<typename StringClassA, typename StringClassB>
 bool equalIgnoringASCIICaseCommon(const StringClassA& a, const StringClassB& b)
 {
@@ -346,6 +358,18 @@ bool equalIgnoringASCIICaseCommon(const StringClassA& a, const StringClassB& b)
     return equalIgnoringASCIICase(a.characters16(), b.characters16(), length);
 }
 
+template<typename StringClassA> bool equalIgnoringASCIICaseCommon(const StringClassA& a, const char* b)
+{
+    unsigned length = a.length();
+    if (length != strlen(b))
+        return false;
+
+    if (a.is8Bit())
+        return equalIgnoringASCIICase(a.characters8(), b, length);
+
+    return equalIgnoringASCIICase(a.characters16(), b, length);
+}
+
 template<typename StringClassA, typename StringClassB>
 bool startsWith(const StringClassA& reference, const StringClassB& prefix)
 {
@@ -559,6 +583,13 @@ template<typename CharacterType> inline bool equalLettersIgnoringASCIICase(const
     return true;
 }
 
+template<typename CharacterType, unsigned lowercaseLettersLength> inline bool equalLettersIgnoringASCIICase(const CharacterType* characters, unsigned charactersLength, const char (&lowercaseLetters)[lowercaseLettersLength])
+{
+    ASSERT(strlen(lowercaseLetters) == lowercaseLettersLength - 1);
+    unsigned lowercaseLettersStringLength = lowercaseLettersLength - 1;
+    return charactersLength == lowercaseLettersStringLength && equalLettersIgnoringASCIICase(characters, lowercaseLetters, lowercaseLettersStringLength);
+}
+
 // This is intentionally not marked inline because it's used often and is not speed-critical enough to want it inlined everywhere.
 template<typename StringClass> bool equalLettersIgnoringASCIICaseCommonWithoutLength(const StringClass& string, const char* lowercaseLetters)
 {
@@ -578,12 +609,14 @@ template<typename StringClass> bool equalLettersIgnoringASCIICaseCommonWithoutLe
 template<typename StringClass, unsigned length> inline bool equalLettersIgnoringASCIICaseCommon(const StringClass& string, const char (&lowercaseLetters)[length])
 {
     // Don't actually use the length; we are choosing code size over speed.
+    ASSERT(strlen(lowercaseLetters) == length - 1);
     const char* pointer = lowercaseLetters;
     return equalLettersIgnoringASCIICaseCommonWithoutLength(string, pointer);
 }
 
 }
 
+using WTF::equalIgnoringASCIICase;
 using WTF::equalLettersIgnoringASCIICase;
 
 #endif // StringCommon_h
index 590ff5b..346c104 100644 (file)
@@ -110,7 +110,7 @@ namespace WTF {
         
         static inline bool equal(const StringImpl* a, const StringImpl* b)
         {
-            return equalIgnoringCaseNonNull(a, b);
+            return equalCompatibiltyCaselessNonNull(a, b);
         }
 
         static unsigned hash(const RefPtr<StringImpl>& key) 
index d5b7dd6..a676d2b 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Dirk Mueller ( mueller@kde.org )
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2009, 2013-2016 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
  *
  * This library is free software; you can redistribute it and/or
@@ -950,7 +950,7 @@ float StringImpl::toFloat(bool* ok)
     return charactersToFloat(characters16(), m_length, ok);
 }
 
-bool equalIgnoringCase(const LChar* a, const LChar* b, unsigned length)
+static inline bool equalCompatibiltyCaseless(const LChar* a, const LChar* b, unsigned length)
 {
     while (length--) {
         if (StringImpl::latin1CaseFoldTable[*a++] != StringImpl::latin1CaseFoldTable[*b++])
@@ -959,7 +959,7 @@ bool equalIgnoringCase(const LChar* a, const LChar* b, unsigned length)
     return true;
 }
 
-bool equalIgnoringCase(const UChar* a, const LChar* b, unsigned length)
+static inline bool equalCompatibiltyCaseless(const UChar* a, const LChar* b, unsigned length)
 {
     while (length--) {
         if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != StringImpl::latin1CaseFoldTable[*b++])
@@ -968,6 +968,16 @@ bool equalIgnoringCase(const UChar* a, const LChar* b, unsigned length)
     return true;
 }
 
+static inline bool equalCompatibiltyCaseless(const LChar* a, const UChar* b, unsigned length)
+{
+    return equalCompatibiltyCaseless(b, a, length);
+}
+
+static inline bool equalCompatibiltyCaseless(const UChar* a, const UChar* b, unsigned length)
+{
+    return !u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT);
+}
+
 size_t StringImpl::find(CharacterMatchFunctionPtr matchFunction, unsigned start)
 {
     if (is8Bit())
@@ -1072,7 +1082,7 @@ size_t StringImpl::findIgnoringCase(const LChar* matchString, unsigned index)
         const LChar* searchCharacters = characters8() + index;
 
         unsigned i = 0;
-        while (!equalIgnoringCase(searchCharacters + i, matchString, matchLength)) {
+        while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) {
             if (i == delta)
                 return notFound;
             ++i;
@@ -1083,7 +1093,7 @@ size_t StringImpl::findIgnoringCase(const LChar* matchString, unsigned index)
     const UChar* searchCharacters = characters16() + index;
 
     unsigned i = 0;
-    while (!equalIgnoringCase(searchCharacters + i, matchString, matchLength)) {
+    while (!equalCompatibiltyCaseless(searchCharacters + i, matchString, matchLength)) {
         if (i == delta)
             return notFound;
         ++i;
@@ -1147,7 +1157,7 @@ ALWAYS_INLINE static size_t findIgnoringCaseInner(const SearchCharacterType* sea
 
     unsigned i = 0;
     // keep looping until we match
-    while (!equalIgnoringCase(searchCharacters + i, matchCharacters, matchLength)) {
+    while (!equalCompatibiltyCaseless(searchCharacters + i, matchCharacters, matchLength)) {
         if (i == delta)
             return notFound;
         ++i;
@@ -1288,7 +1298,7 @@ ALWAYS_INLINE static size_t reverseFindIgnoringCaseInner(const SearchCharacterTy
     unsigned delta = std::min(index, length - matchLength);
 
     // keep looping until we match
-    while (!equalIgnoringCase(searchCharacters + delta, matchCharacters, matchLength)) {
+    while (!equalCompatibiltyCaseless(searchCharacters + delta, matchCharacters, matchLength)) {
         if (!delta)
             return notFound;
         --delta;
@@ -1334,8 +1344,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 equalIgnoringCase(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
-    return equalIgnoringCase(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+        return equalCompatibiltyCaseless(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+    return equalCompatibiltyCaseless(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
 }
 
 ALWAYS_INLINE static bool equalInner(const StringImpl& stringImpl, unsigned startOffset, const StringImpl& matchString)
@@ -1908,73 +1918,10 @@ bool equal(const StringImpl& a, const StringImpl& b)
     return equalCommon(a, b);
 }
 
-bool equalIgnoringCase(const StringImpl* a, const StringImpl* b)
-{
-    if (a == b)
-        return true;
-    if (!a || !b)
-        return false;
-
-    return CaseFoldingHash::equal(a, b);
-}
-
-bool equalIgnoringCase(const StringImpl* a, const LChar* b)
-{
-    if (!a)
-        return !b;
-    if (!b)
-        return !a;
-
-    unsigned length = a->length();
-
-    // Do a faster loop for the case where all the characters are ASCII.
-    UChar ored = 0;
-    bool equal = true;
-    if (a->is8Bit()) {
-        const LChar* as = a->characters8();
-        for (unsigned i = 0; i != length; ++i) {
-            LChar bc = b[i];
-            if (!bc)
-                return false;
-            UChar ac = as[i];
-            ored |= ac;
-            equal = equal && (toASCIILower(ac) == toASCIILower(bc));
-        }
-        
-        // Do a slower implementation for cases that include non-ASCII characters.
-        if (ored & ~0x7F) {
-            equal = true;
-            for (unsigned i = 0; i != length; ++i)
-                equal = equal && u_foldCase(as[i], U_FOLD_CASE_DEFAULT) == u_foldCase(b[i], U_FOLD_CASE_DEFAULT);
-        }
-        
-        return equal && !b[length];        
-    }
-
-    const UChar* as = a->characters16();
-    for (unsigned i = 0; i != length; ++i) {
-        LChar bc = b[i];
-        if (!bc)
-            return false;
-        UChar ac = as[i];
-        ored |= ac;
-        equal = equal && (toASCIILower(ac) == toASCIILower(bc));
-    }
-
-    // Do a slower implementation for cases that include non-ASCII characters.
-    if (ored & ~0x7F) {
-        equal = true;
-        for (unsigned i = 0; i != length; ++i) {
-            equal = equal && u_foldCase(as[i], U_FOLD_CASE_DEFAULT) == u_foldCase(b[i], U_FOLD_CASE_DEFAULT);
-        }
-    }
-
-    return equal && !b[length];
-}
-
-bool equalIgnoringCaseNonNull(const StringImpl* a, const StringImpl* b)
+bool equalCompatibiltyCaselessNonNull(const StringImpl* a, const StringImpl* b)
 {
-    ASSERT(a && b);
+    ASSERT(a);
+    ASSERT(b);
     if (a == b)
         return true;
 
@@ -1984,15 +1931,15 @@ bool equalIgnoringCaseNonNull(const StringImpl* a, const StringImpl* b)
 
     if (a->is8Bit()) {
         if (b->is8Bit())
-            return equalIgnoringCase(a->characters8(), b->characters8(), length);
+            return equalCompatibiltyCaseless(a->characters8(), b->characters8(), length);
 
-        return equalIgnoringCase(b->characters16(), a->characters8(), length);
+        return equalCompatibiltyCaseless(b->characters16(), a->characters8(), length);
     }
 
     if (b->is8Bit())
-        return equalIgnoringCase(a->characters16(), b->characters8(), length);
+        return equalCompatibiltyCaseless(a->characters16(), b->characters8(), length);
 
-    return equalIgnoringCase(a->characters16(), b->characters16(), length);
+    return equalCompatibiltyCaseless(a->characters16(), b->characters16(), length);
 }
 
 bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
@@ -2004,12 +1951,7 @@ bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
     return equal(a, b);
 }
 
-bool equalIgnoringASCIICase(const StringImpl& a, const StringImpl& b)
-{
-    return equalIgnoringASCIICaseCommon(a, b);
-}
-
-bool equalIgnoringASCIICase(const StringImpl* a, const StringImpl*b)
+bool equalIgnoringASCIICase(const StringImpl* a, const StringImpl* b)
 {
     if (a == b)
         return true;
@@ -2018,22 +1960,11 @@ bool equalIgnoringASCIICase(const StringImpl* a, const StringImpl*b)
     return equalIgnoringASCIICaseCommon(*a, *b);
 }
 
-bool equalIgnoringASCIICase(const StringImpl& a, const char* b, unsigned bLength)
-{
-    if (bLength != a.length())
-        return false;
-
-    if (a.is8Bit())
-        return equalIgnoringASCIICase(a.characters8(), b, bLength);
-
-    return equalIgnoringASCIICase(a.characters16(), b, bLength);
-}
-
 bool equalIgnoringASCIICaseNonNull(const StringImpl* a, const StringImpl* b)
 {
     ASSERT(a);
     ASSERT(b);
-    return equalIgnoringASCIICaseCommon(*a, *b);
+    return equalIgnoringASCIICase(*a, *b);
 }
 
 UCharDirection StringImpl::defaultWritingDirection(bool* hasStrongDirectionality)
index ca293c6..d44e5cf 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2005-2010, 2013-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2010, 2013-2016 Apple Inc. All rights reserved.
  * Copyright (C) 2009 Google Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -50,16 +50,20 @@ class LLIntOffsetsExtractor;
 
 namespace WTF {
 
+class SymbolImpl;
+class SymbolRegistry;
+
 struct CStringTranslator;
-template<typename CharacterType> struct HashAndCharactersTranslator;
+struct CharBufferFromLiteralDataTranslator;
 struct HashAndUTF8CharactersTranslator;
 struct LCharBufferTranslator;
-struct CharBufferFromLiteralDataTranslator;
+struct StringHash;
 struct SubstringTranslator;
 struct UCharBufferTranslator;
+
 template<typename> class RetainPtr;
-class SymbolImpl;
-class SymbolRegistry;
+
+template<typename> struct HashAndCharactersTranslator;
 
 enum TextCaseSensitivity {
     TextCaseSensitive,
@@ -751,7 +755,7 @@ public:
     RetainPtr<CFStringRef> createCFString();
 #endif
 #ifdef __OBJC__
-    WTF_EXPORT_STRING_API operator NSString*();
+    WTF_EXPORT_STRING_API operator NSString *();
 #endif
 
 #if STRING_STATS
@@ -942,35 +946,18 @@ 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);
 
-WTF_EXPORT_STRING_API bool equalIgnoringCase(const StringImpl*, const StringImpl*);
-WTF_EXPORT_STRING_API bool equalIgnoringCase(const StringImpl*, const LChar*);
-inline bool equalIgnoringCase(const LChar* a, const StringImpl* b) { return equalIgnoringCase(b, a); }
-WTF_EXPORT_STRING_API bool equalIgnoringCase(const LChar*, const LChar*, unsigned);
-WTF_EXPORT_STRING_API bool equalIgnoringCase(const UChar*, const LChar*, unsigned);
-inline bool equalIgnoringCase(const UChar* a, const char* b, unsigned length) { return equalIgnoringCase(a, reinterpret_cast<const LChar*>(b), length); }
-inline bool equalIgnoringCase(const LChar* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, a, length); }
-inline bool equalIgnoringCase(const char* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
-inline bool equalIgnoringCase(const char* a, const LChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
-inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length)
-{
-    ASSERT(length >= 0);
-    return !u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT);
-}
-WTF_EXPORT_STRING_API bool equalIgnoringCaseNonNull(const StringImpl*, const StringImpl*);
+// 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*);
 
-WTF_EXPORT_STRING_API bool equalIgnoringASCIICase(const StringImpl&, const StringImpl&);
+bool equalIgnoringASCIICase(const StringImpl&, const StringImpl&);
 WTF_EXPORT_STRING_API bool equalIgnoringASCIICase(const StringImpl*, const StringImpl*);
-WTF_EXPORT_STRING_API bool equalIgnoringASCIICase(const StringImpl& a, const char* b, unsigned bLength);
-WTF_EXPORT_STRING_API bool equalIgnoringASCIICaseNonNull(const StringImpl*, const StringImpl*);
+WTF_EXPORT_STRING_API bool equalIgnoringASCIICase(const StringImpl&, const char*);
+WTF_EXPORT_STRING_API bool equalIgnoringASCIICase(const StringImpl*, const char*);
 
-template<unsigned charactersCount>
-bool equalIgnoringASCIICase(const StringImpl* a, const char (&b)[charactersCount])
-{
-    return a ? equalIgnoringASCIICase(*a, b, charactersCount - 1) : false;
-}
+WTF_EXPORT_STRING_API bool equalIgnoringASCIICaseNonNull(const StringImpl*, const StringImpl*);
 
 template<unsigned length> bool equalLettersIgnoringASCIICase(const StringImpl&, const char (&lowercaseLetters)[length]);
 template<unsigned length> bool equalLettersIgnoringASCIICase(const StringImpl*, const char (&lowercaseLetters)[length]);
@@ -1179,8 +1166,6 @@ inline Ref<StringImpl> StringImpl::isolatedCopy() const
     return create(m_data16, m_length);
 }
 
-struct StringHash;
-
 // StringHash is the default hash for StringImpl* and RefPtr<StringImpl>
 template<typename T> struct DefaultHash;
 template<> struct DefaultHash<StringImpl*> {
@@ -1190,6 +1175,21 @@ template<> struct DefaultHash<RefPtr<StringImpl>> {
     typedef StringHash Hash;
 };
 
+inline bool equalIgnoringASCIICase(const StringImpl& a, const StringImpl& b)
+{
+    return equalIgnoringASCIICaseCommon(a, b);
+}
+
+inline bool equalIgnoringASCIICase(const StringImpl& a, const char* b)
+{
+    return equalIgnoringASCIICaseCommon(a, b);
+}
+
+inline bool equalIgnoringASCIICase(const StringImpl* a, const char* b)
+{
+    return a && equalIgnoringASCIICase(*a, b);
+}
+
 template<unsigned length> inline bool equalLettersIgnoringASCIICase(const StringImpl& string, const char (&lowercaseLetters)[length])
 {
     return equalLettersIgnoringASCIICaseCommon(string, lowercaseLetters);
@@ -1204,7 +1204,6 @@ template<unsigned length> inline bool equalLettersIgnoringASCIICase(const String
 
 using WTF::StringImpl;
 using WTF::equal;
-using WTF::equalIgnoringASCIICase;
 using WTF::TextCaseSensitivity;
 using WTF::TextCaseSensitive;
 using WTF::TextCaseInsensitive;
index 997f050..e206717 100644 (file)
@@ -77,17 +77,6 @@ bool StringView::endsWithIgnoringASCIICase(const StringView& suffix) const
     return ::WTF::endsWithIgnoringASCIICase(*this, suffix);
 }
 
-bool equalIgnoringASCIICase(StringView a, const char* b, unsigned bLength)
-{
-    if (bLength != a.length())
-        return false;
-
-    if (a.is8Bit())
-        return equalIgnoringASCIICase(a.characters8(), b, bLength);
-
-    return equalIgnoringASCIICase(a.characters16(), b, bLength);
-}
-
 CString StringView::utf8(ConversionMode mode) const
 {
     if (isNull())
index aff4c96..4ddfe64 100644 (file)
@@ -162,13 +162,9 @@ template<typename CharacterType, size_t inlineCapacity> void append(Vector<Chara
 bool equal(StringView, StringView);
 bool equal(StringView, const LChar*);
 bool equal(StringView, const char*);
+
 bool equalIgnoringASCIICase(StringView, StringView);
-WTF_EXPORT_STRING_API bool equalIgnoringASCIICase(StringView a, const char* b, unsigned bLength);
-template<unsigned charactersCount>
-bool equalIgnoringASCIICase(StringView a, const char (&b)[charactersCount])
-{
-    return equalIgnoringASCIICase(a, b, charactersCount - 1);
-}
+bool equalIgnoringASCIICase(StringView, const char*);
 
 template<unsigned length> bool equalLettersIgnoringASCIICase(StringView, const char (&lowercaseLetters)[length]);
 
@@ -539,6 +535,11 @@ inline bool equalIgnoringASCIICase(StringView a, StringView b)
     return equalIgnoringASCIICaseCommon(a, b);
 }
 
+inline bool equalIgnoringASCIICase(StringView a, const char* b)
+{
+    return equalIgnoringASCIICaseCommon(a, b);
+}
+
 class StringView::CodePoints {
 public:
     explicit CodePoints(const StringView&);
index 3ca0fbf..88c13da 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * (C) 1999 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2016 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -34,9 +34,6 @@
 
 namespace WTF {
 
-class CString;
-struct StringHash;
-
 // Declarations of string operations
 
 WTF_EXPORT_STRING_API int charactersToIntStrict(const LChar*, size_t, bool* ok = 0, int base = 10);
@@ -406,7 +403,7 @@ public:
     WTF_EXPORT_STRING_API bool isSafeToSendToAnotherThread() const;
 
     // Prevent Strings from being implicitly convertable to bool as it will be ambiguous on any platform that
-    // allows implicit conversion to another pointer type (e.g., Mac allows implicit conversion to NSString*).
+    // allows implicit conversion to another pointer type (e.g., Mac allows implicit conversion to NSString *).
     typedef struct ImplicitConversionFromWTFStringToBoolDisallowedA* (String::*UnspecifiedBoolTypeA);
     typedef struct ImplicitConversionFromWTFStringToBoolDisallowedB* (String::*UnspecifiedBoolTypeB);
     operator UnspecifiedBoolTypeA() const;
@@ -418,11 +415,12 @@ public:
 #endif
 
 #ifdef __OBJC__
-    WTF_EXPORT_STRING_API String(NSString*);
+    WTF_EXPORT_STRING_API String(NSString *);
     
-    // This conversion maps NULL to "", which loses the meaning of NULL, but we
-    // need this mapping because AppKit crashes when passed nil NSStrings.
-    operator NSString*() const { if (!m_impl) return @""; return *m_impl; }
+    // This conversion converts the null string to an empty NSString rather than to nil.
+    // Given Cocoa idioms, this is a more useful default. Clients that need to preserve the
+    // null string can check isNull explicitly.
+    operator NSString *() const;
 #endif
 
     WTF_EXPORT_STRING_API static String make8BitFrom16BitSource(const UChar*, size_t);
@@ -505,16 +503,8 @@ inline bool operator!=(const char* a, const String& b) { return !equal(reinterpr
 template<size_t inlineCapacity> inline bool operator!=(const Vector<char, inlineCapacity>& a, const String& b) { return !(a == b); }
 template<size_t inlineCapacity> inline bool operator!=(const String& a, const Vector<char, inlineCapacity>& b) { return b != a; }
 
-inline bool equalIgnoringCase(const String& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
-inline bool equalIgnoringCase(const String& a, const LChar* b) { return equalIgnoringCase(a.impl(), b); }
-inline bool equalIgnoringCase(const String& a, const char* b) { return equalIgnoringCase(a.impl(), reinterpret_cast<const LChar*>(b)); }
-inline bool equalIgnoringCase(const LChar* a, const String& b) { return equalIgnoringCase(a, b.impl()); }
-inline bool equalIgnoringCase(const char* a, const String& b) { return equalIgnoringCase(reinterpret_cast<const LChar*>(a), b.impl()); }
-
-bool equalPossiblyIgnoringCase(const String&, const String&, bool ignoreCase);
-
-inline bool equalIgnoringASCIICase(const String& a, const String& b) { return equalIgnoringASCIICase(a.impl(), b.impl()); }
-template<unsigned charactersCount> inline bool equalIgnoringASCIICase(const String& a, const char (&b)[charactersCount]) { return equalIgnoringASCIICase<charactersCount>(a.impl(), b); }
+bool equalIgnoringASCIICase(const String&, const String&);
+bool equalIgnoringASCIICase(const String&, const char*);
 
 template<unsigned length> bool equalLettersIgnoringASCIICase(const String&, const char (&lowercaseLetters)[length]);
 
@@ -525,6 +515,13 @@ inline bool operator!(const String& str) { return str.isNull(); }
 
 inline void swap(String& a, String& b) { a.swap(b); }
 
+#ifdef __OBJC__
+
+// Used in a small number of places where the long standing behavior has been "nil if empty".
+NSString * nsStringNilIfEmpty(const String&);
+
+#endif
+
 // Definitions of string operations
 
 inline String::String(StringImpl& impl)
@@ -597,12 +594,22 @@ inline bool String::containsOnlyLatin1() const
     return !(ored & 0xFF00);
 }
 
-
 #ifdef __OBJC__
-// This is for situations in WebKit where the long standing behavior has been
-// "nil if empty", so we try to maintain longstanding behavior for the sake of
-// entrenched clients
-inline NSString* nsStringNilIfEmpty(const String& str) {  return str.isEmpty() ? nil : (NSString*)str; }
+
+inline String::operator NSString *() const
+{
+    if (!m_impl)
+        return @"";
+    return *m_impl;
+}
+
+inline NSString * nsStringNilIfEmpty(const String& string)
+{
+    if (string.isEmpty())
+        return nil;
+    return *string.impl();
+}
+
 #endif
 
 inline bool String::containsOnlyASCII() const
@@ -669,11 +676,6 @@ inline bool String::isAllSpecialCharacters() const
     return WTF::isAllSpecialCharacters<isSpecialCharacter, UChar>(characters16(), len);
 }
 
-inline bool equalPossiblyIgnoringCase(const String& a, const String& b, bool ignoreCase)
-{
-    return ignoreCase ? equalIgnoringCase(a, b) : (a == b);
-}
-
 // StringHash is the default hash for String
 template<typename T> struct DefaultHash;
 template<> struct DefaultHash<String> {
@@ -718,6 +720,16 @@ template<unsigned length> inline bool equalLettersIgnoringASCIICase(const String
     return equalLettersIgnoringASCIICase(string.impl(), lowercaseLetters);
 }
 
+inline bool equalIgnoringASCIICase(const String& a, const String& b)
+{
+    return equalIgnoringASCIICase(a.impl(), b.impl());
+}
+
+inline bool equalIgnoringASCIICase(const String& a, const char* b)
+{
+    return equalIgnoringASCIICase(a.impl(), b);
+}
+
 }
 
 using WTF::CString;
@@ -739,8 +751,6 @@ using WTF::charactersToIntPtr;
 using WTF::charactersToDouble;
 using WTF::charactersToFloat;
 using WTF::equal;
-using WTF::equalIgnoringCase;
-using WTF::equalLettersIgnoringASCIICase;
 using WTF::find;
 using WTF::isAllSpecialCharacters;
 using WTF::isSpaceOrNewline;
@@ -749,4 +759,5 @@ using WTF::ASCIILiteral;
 using WTF::StringCapture;
 
 #include <wtf/text/AtomicString.h>
+
 #endif
index 806fddf..7c218a4 100644 (file)
@@ -1,3 +1,247 @@
+2016-01-28  Darin Adler  <darin@apple.com>
+
+        Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
+        https://bugs.webkit.org/show_bug.cgi?id=153411
+
+        Reviewed by Ryosuke Niwa.
+
+        Tests: fast/media/media-query-non-ASCII-case-folding.html
+               fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html
+               fast/xpath/xpath-non-ASCII-case-folding.html
+
+        No tests included that cover the minor behavior changes in Document::setDomain,
+        CSPSource::schemeMatches, CSPSource::hostMatches, OriginAccessEntry::operator==,
+        UserContentURLPattern::matches, UserContentURLPattern::matchesHost,
+        ContentFilterUnblockHandler::canHandleRequest. Would like to add tests for those
+        if possible, but it seems clear all are progressions.
+
+        For background on why this is the right thing to do in almost every case:
+
+        - MIME types are all ASCII and not case sensitive (details in RFC 2045)
+          <http://tools.ietf.org/html/rfc2045>
+        - case insensitive comparisons in HTML are all "ASCII case-insensitive"
+          https://www.w3.org/TR/html/infrastructure.html#ascii-case-insensitive
+        - same for CSS
+
+        * Modules/webdatabase/DatabaseAuthorizer.cpp:
+        (WebCore::DatabaseAuthorizer::denyBasedOnTableName): Use equalIgnoringASCIICase.
+        No change in behavior since the string we are comparing with is always
+        "__WebKitDatabaseInfoTable__" in practice.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::siblingWithAriaRole): Changed argument type to take a const char*,
+        added some FIXMEs and use equalIgnoringCase. No change in behavior since the
+        strings we are comparing with are "menu" and "menuitem".
+        (WebCore::AccessibilityNodeObject::menuElementForMenuButton): Updated to pass
+        arguments in reverse order.
+        (WebCore::AccessibilityNodeObject::menuItemElementForMenu): Ditto.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseFontFaceValue): Use equalIgnoringASCIICase.
+        No change in behavior because the property names are all ASCII constants.
+
+        * css/CSSParserValues.h: Removed unused equalIgnoringCase function.
+
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::MediaQueryEvaluator::mediaTypeMatch): Use equalIgnoringASCIICase.
+        Changes behavior: No non-ASCII case folding when matching media types.
+        Covered by new test.
+        (WebCore::MediaQueryEvaluator::mediaTypeMatchSpecific): Use equalIgnoringASCIICase.
+        No change in behavior since the only string this is ever called with is "print".
+
+        * dom/DataTransfer.cpp:
+        (WebCore::DataTransfer::hasFileOfType): Use equalIgnoringASCIICase.
+        No change in behavior because local files will not have content types with
+        non-ASCII characters in them. In the extremely unlikely case that this is incorrect,
+        the change in behavior is a progression.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setDomain): Use equalIgnoringASCIICase.
+        Changes behavior: Domains considered equal because of non-ASCII case folding
+        would get through without an error before, and now will properly throw an exception.
+
+        * dom/Element.cpp:
+        (WebCore::isStyleAttribute): Refactored into a helper function. Use
+        equalLettersIgnoringASCIICase. No change in behavior.
+        (WebCore::Element::synchronizeAttribute): Use isStyleAttribute.
+
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::findAnchor): Use equalIgnoringASCIICase.
+        Changes behavior: Could go to an anchor and it would be considered a match because
+        of non-ASCII case folding. Covered by new test.
+
+        * html/HiddenInputType.cpp:
+        (WebCore::HiddenInputType::appendFormData): Use equalIgnoringASCIICase.
+        No change in behavior: comparing with an ASCII literal.
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::getExtension): Ditto.
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::getExtension): Ditto.
+
+        * html/parser/CSSPreloadScanner.cpp:
+        (WebCore::CSSPreloadScanner::emitRule): Use equalLettersIgnoringASCIICase and
+        StringView to avoid needing a special ruleEqualIgnoringCase function.
+        No change in behavior.
+
+        * inspector/InspectorNodeFinder.cpp:
+        (WebCore::InspectorNodeFinder::matchesElement): Use equalIgnoringASCIICase.
+        Changes behavior, but it's an inspector UI thing, not a web behavior thing,
+        so I don't think a new regression test is needed.
+
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::currentItemShouldBeReplaced): Use
+        equalIgnoringASCIICase. No change in behavior because we are comparing
+        with "about:blank".
+
+        * loader/SubframeLoader.cpp:
+        (WebCore::findPluginMIMETypeFromURL): Use equalIgnoringASCIICase.
+        No change in behavior unless a plug-in claims an extension with non-ASCII
+        characters. I don't think a new regression test is needed.
+
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache):
+        Use equalIgnoringASCIICase. No change in behavior because both strings are
+        protocols from URLs and we don't parse non-ASCII characters into protocol strings;
+        non-ASCII are already encoding as punycode.
+        * loader/appcache/ManifestParser.cpp:
+        (WebCore::parseManifest): Ditto.
+
+        * page/ContentSecurityPolicy.cpp:
+        (WebCore::isExperimentalDirectiveName): Added. Used by isDirectiveName.
+        Uses equalLettersIgnoringASCIICase. No change in behavior.
+        (WebCore::isDirectiveName): Use equalLettersIgnoringASCIICase.
+        No change in behavior.
+        (WebCore::isSourceListNone): Use equalLettersIgnoringASCIICase. No
+        change in behavior.
+        (WebCore::CSPSource::schemeMatches): Use equalLettersIgnoringASCIICase
+        and equalIgnoringASCIICase. It's all about comparing URL protocols. The
+        old code might have done something strange if someone specified a protocol
+        with a non-ASCII character in it.
+        (WebCore::CSPSource::hostMatches): Use equalIgnoringASCIICase.
+        (WebCore::CSPSourceList::parseSource): Use equalLettersIgnoringASCIICase.
+        No change in behavior.
+        (WebCore::CSPDirectiveList::checkSourceAndReportViolation): Tweaked code
+        to do less unnecessary String allocation.
+        (WebCore::CSPDirectiveList::parseReflectedXSS): Use
+        equalLettersIgnoringASCIICase. No change in behavior.
+        (WebCore::CSPDirectiveList::addDirective): Ditto.
+        (WebCore::ContentSecurityPolicy::reportUnsupportedDirective): Use
+        equalLettersIgnoringASCIICase and remove unneeded global constant strings.
+        No change in behavior.
+        (WebCore::ContentSecurityPolicy::reportDirectiveAsSourceExpression):
+        Tweak code to eliminate unneeded local.
+        (WebCore::ContentSecurityPolicy::reportDuplicateDirective): Ditto.
+        (WebCore::ContentSecurityPolicy::reportInvalidSourceExpression): Use
+        equalLettersIgnoringASCIICase. No change in behavior.
+
+        * page/OriginAccessEntry.h:
+        (WebCore::operator==): Use equalLettersIgnoringASCIICase.
+
+        * page/Performance.cpp:
+        (WebCore::Performance::webkitGetEntriesByName): Use equalLettersIgnoringASCIICase.
+        No change in behavior.
+
+        * page/UserContentURLPattern.cpp:
+        (WebCore::UserContentURLPattern::matches): Use equalIgnoringASCIICase to match
+        schemes.
+        (WebCore::UserContentURLPattern::matchesHost): Use equalIgnoringASCIICase to
+        match host names.
+
+        * platform/URL.cpp:
+        (WebCore::URL::init): Use equalIgnoringASCIICase, and also use StringView to
+        avoid having to allocate a second string just for comparison purposes. Should be
+        better for efficiency with no change in behavior.
+
+        * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
+        (WebCore::ContentFilterUnblockHandler::canHandleRequest): Use equalIgnoringASCIICase
+        to compare hosts.
+
+        * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp:
+        (WebCore::PlatformSpeechSynthesisProviderEfl::voiceName): Use StringView and
+        equalIgnoringASCIICase to compare language tags. No test needed because there are
+        no language tags with non-ASCII characters in them.
+
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontPlatformDataCacheKey::operator==): Changed to use the equal
+        function from CaseFoldingHash. In a subsequent patch we will change this to be
+        ASCIICaseFoldingHash since font names don't need to compare non-ASCII characters
+        in a case folding manner, but for now preserve behavior.
+        (WebCore::alternateFamilyName): Use equalLettersIgnoringASCIICase to avoid having
+        to use a special familyNameEqualIgnoringCase function. This does mean there will
+        be a null check and a length check that wasn't there before, but the actual
+        comparison function will be tighter. Guessing it will be a wash. Also improved
+        the comments and sorted the Windows cases in with the others. No behavior change.
+
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::operator==): Changed to use the equal function from CaseFoldingHash.
+        Same rationale as above in FontPlatformDataCacheKey.
+
+        * platform/graphics/FontDescription.cpp:
+        (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
+        equalIgnoringASCIICase to compare font family names. Only possible change in
+        behavior would be if actual fonts with non-ASCII names but that were specified
+        with different case in style sheets. Highly unlikely this exists.
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::supportsType): Use equalLettersIgnoringASCIICase.
+        No change in behavior.
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::keySystemIsSupported): Ditto.
+
+        * platform/graphics/freetype/FontCacheFreeType.cpp:
+        (WebCore::isCommonlyUsedGenericFamily): Added.
+        (WebCore::FontCache::createFontPlatformData): Moved code into the
+        isCommonlyUsedGenericFamily helper and used equalIgnoringASCIICase.
+
+        * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Use
+        equalLettersIgnoringASCIICase. No change in behavior.
+        * platform/graphics/win/FontCacheWin.cpp:
+        (WebCore::adjustedGDIFontWeight): Ditto.
+        (WebCore::FontCache::createFontPlatformData): Ditto.
+        * platform/graphics/win/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
+        * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
+
+        * platform/mac/PlatformSpeechSynthesizerMac.mm:
+        (-[WebSpeechSynthesisWrapper speakUtterance:]): Use equalIgnoringASCIICase to
+        compare languages. No change in behavior because languages have all-ASCII names.
+
+        * platform/network/CacheValidation.cpp:
+        (WebCore::shouldUpdateHeaderAfterRevalidation): Use equalIgnoringASCIICase.
+        No change in behavior since it's a fixed list of all ASCII headers.
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::isAppendableHeader): Ditto.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::willSendRequest): Use equalIgnoringASCIICase.
+        No change in behavior because HTTP methods are all ASCII letters.
+
+        * platform/text/mac/LocaleMac.mm:
+        (WebCore::determineLocale): Use equalIgnoringASCIICase. No change in behavior
+        because locale languages identifiers are all ASCII.
+        * platform/text/win/LocaleWin.cpp:
+        (WebCore::LCIDFromLocaleInternal): Ditto.
+
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::SVGToOTFFontConverter::appendArabicReplacementSubtable):
+        Use equalIgnoringASCIICase. No change in behavior because Arabic form attribute
+        values are all ASCII.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod): Use equalIgnoringASCIICase.
+        No change in behavior because these are all fixed known ASCII HTTP method names.
+
+        * xml/XPathFunctions.cpp:
+        (WebCore::XPath::FunLang::evaluate): Use equalIgnoringASCIICase. Changes behavior
+        if specifying a non-ASCII character. Covered by new test.
+
+        * xml/XPathStep.cpp:
+        (WebCore::XPath::nodeMatchesBasicTest): Use equalIgnoringASCIICase. Changes
+        behavior if an element local name or XPath predicate has a non-ASCII character.
+        Covered by new test.
+
 2016-01-28  Zalan Bujtas  <zalan@apple.com>
 
         Unexpected content wrapping at http://email.osh.com/H/2/v100000152474feb8ec7c1a1f4bbe5c7c0/HTML
index 3ed2eb6..0933f20 100644 (file)
@@ -407,12 +407,14 @@ int DatabaseAuthorizer::denyBasedOnTableName(const String& tableName) const
         return SQLAuthAllow;
 
     // Sadly, normal creates and drops end up affecting sqlite_master in an authorizer callback, so
-    // it will be tough to enforce all of the following policies
-    //if (equalIgnoringCase(tableName, "sqlite_master") || equalIgnoringCase(tableName, "sqlite_temp_master") ||
-    //    equalIgnoringCase(tableName, "sqlite_sequence") || equalIgnoringCase(tableName, Database::databaseInfoTableName()))
-    //        return SQLAuthDeny;
-
-    if (equalIgnoringCase(tableName, m_databaseInfoTableName))
+    // it will be tough to enforce all of the following policies.
+    // if (equalIgnoringASCIICase(tableName, "sqlite_master")
+    //      || equalIgnoringASCIICase(tableName, "sqlite_temp_master")
+    //      || equalIgnoringASCIICase(tableName, "sqlite_sequence")
+    //      || equalIgnoringASCIICase(tableName, Database::databaseInfoTableName()))
+    //    return SQLAuthDeny;
+
+    if (equalIgnoringASCIICase(tableName, m_databaseInfoTableName))
         return SQLAuthDeny;
 
     return SQLAuthAllow;
index ea8e20b..a00df3d 100644 (file)
@@ -1193,15 +1193,16 @@ String AccessibilityNodeObject::ariaAccessibilityDescription() const
     return String();
 }
 
-static Element* siblingWithAriaRole(String role, Node* node)
+static Element* siblingWithAriaRole(Node* node, const char* role)
 {
+    // FIXME: Either we should add a null check here or change the function to take a reference instead of a pointer.
     ContainerNode* parent = node->parentNode();
     if (!parent)
         return nullptr;
 
     for (auto& sibling : childrenOfType<Element>(*parent)) {
-        const AtomicString& siblingAriaRole = sibling.fastGetAttribute(roleAttr);
-        if (equalIgnoringCase(siblingAriaRole, role))
+        // FIXME: Should skip sibling that is the same as the node.
+        if (equalIgnoringASCIICase(sibling.fastGetAttribute(roleAttr), role))
             return &sibling;
     }
 
@@ -1213,7 +1214,7 @@ Element* AccessibilityNodeObject::menuElementForMenuButton() const
     if (ariaRoleAttribute() != MenuButtonRole)
         return nullptr;
 
-    return siblingWithAriaRole("menu", node());
+    return siblingWithAriaRole(node(), "menu");
 }
 
 AccessibilityObject* AccessibilityNodeObject::menuForMenuButton() const
@@ -1228,7 +1229,7 @@ Element* AccessibilityNodeObject::menuItemElementForMenu() const
     if (ariaRoleAttribute() != MenuRole)
         return nullptr;
     
-    return siblingWithAriaRole("menuitem", node());    
+    return siblingWithAriaRole(node(), "menuitem");
 }
 
 AccessibilityObject* AccessibilityNodeObject::menuButtonForMenu() const
index ad77ae7..bc4a760 100644 (file)
@@ -1310,7 +1310,7 @@ RefPtr<CSSValueList> CSSParser::parseFontFaceValue(const AtomicString& string)
 
         RefPtr<CSSValue> value;
         for (auto propertyID : { CSSValueSerif, CSSValueSansSerif, CSSValueCursive, CSSValueFantasy, CSSValueMonospace, CSSValueWebkitBody }) {
-            if (equalIgnoringCase(stripped, getValueName(propertyID))) {
+            if (equalIgnoringASCIICase(stripped, getValueName(propertyID))) {
                 value = cssValuePool.createIdentifierValue(propertyID);
                 break;
             }
index ecb79ac..4845a24 100644 (file)
@@ -89,13 +89,6 @@ struct CSSParserString {
         return m_data.characters16[i];
     }
 
-    bool equalIgnoringCase(const char* str) const
-    {
-        if (is8Bit())
-            return WTF::equalIgnoringCase(str, characters8(), length());
-        return WTF::equalIgnoringCase(str, characters16(), length());
-    }
-
     operator String() const { return is8Bit() ? String(m_data.characters8, m_length) : String(m_data.characters16, m_length); }
     operator AtomicString() const { return is8Bit() ? AtomicString(m_data.characters8, m_length) : AtomicString(m_data.characters16, m_length); }
 
index 99b54ae..ee25de1 100644 (file)
@@ -105,7 +105,7 @@ bool MediaQueryEvaluator::mediaTypeMatch(const String& mediaTypeToMatch) const
 {
     return mediaTypeToMatch.isEmpty()
         || equalLettersIgnoringASCIICase(mediaTypeToMatch, "all")
-        || equalIgnoringCase(mediaTypeToMatch, m_mediaType);
+        || equalIgnoringASCIICase(mediaTypeToMatch, m_mediaType);
 }
 
 bool MediaQueryEvaluator::mediaTypeMatchSpecific(const char* mediaTypeToMatch) const
@@ -114,7 +114,7 @@ bool MediaQueryEvaluator::mediaTypeMatchSpecific(const char* mediaTypeToMatch) c
     ASSERT(mediaTypeToMatch);
     ASSERT(mediaTypeToMatch[0] != '\0');
     ASSERT(!equalLettersIgnoringASCIICase(StringView(mediaTypeToMatch), "all"));
-    return equalIgnoringCase(mediaTypeToMatch, m_mediaType);
+    return equalIgnoringASCIICase(m_mediaType, mediaTypeToMatch);
 }
 
 static bool applyRestrictor(MediaQuery::Restrictor r, bool value)
index 2f3b050..0c8f2cb 100644 (file)
@@ -189,7 +189,7 @@ bool DataTransfer::hasFileOfType(const String& type)
     ASSERT_WITH_SECURITY_IMPLICATION(canReadTypes());
 
     for (const String& path : m_pasteboard->readFilenames()) {
-        if (equalIgnoringCase(File::contentTypeForFile(path), type))
+        if (equalIgnoringASCIICase(File::contentTypeForFile(path), type))
             return true;
     }
 
index 0e7c61f..98d7a75 100644 (file)
@@ -3342,7 +3342,7 @@ void Document::processViewport(const String& features, ViewportArguments::Type o
         return;
 
     m_viewportArguments = ViewportArguments(origin);
-    processArguments(features, (void*)&m_viewportArguments, &setViewportFeature);
+    processArguments(features, (void*)&m_viewportArguments, setViewportFeature);
 
     updateViewportArguments();
 }
@@ -3361,6 +3361,7 @@ void Document::updateViewportArguments()
 }
 
 #if PLATFORM(IOS)
+
 // FIXME: Find a better place for this functionality.
 void setParserFeature(const String& key, const String& value, Document* document, void*)
 {
@@ -3371,7 +3372,7 @@ void setParserFeature(const String& key, const String& value, Document* document
 void Document::processFormatDetection(const String& features)
 {
     ASSERT(!features.isNull());
-    processArguments(features, nullptr, &setParserFeature);
+    processArguments(features, nullptr, setParserFeature);
 }
 
 void Document::processWebAppOrientations()
@@ -3379,6 +3380,7 @@ void Document::processWebAppOrientations()
     if (Page* page = this->page())
         page->chrome().client().webAppOrientationsUpdated();
 }
+
 #endif
 
 void Document::processReferrerPolicy(const String& policy)
@@ -4394,7 +4396,7 @@ void Document::setDomain(const String& newDomain, ExceptionCode& ec)
     // assigns its current domain using document.domain, the page will
     // allow other pages loaded on different ports in the same domain that
     // have also assigned to access this page.
-    if (equalIgnoringCase(domain(), newDomain)) {
+    if (equalIgnoringASCIICase(domain(), newDomain)) {
         securityOrigin()->setDomainFromDOM(newDomain);
         return;
     }
index 3420176..f5c77a9 100644 (file)
@@ -438,19 +438,24 @@ ALWAYS_INLINE void Element::synchronizeAttribute(const QualifiedName& name) cons
     }
 }
 
+static ALWAYS_INLINE bool isStyleAttribute(const Element& element, const AtomicString& attributeLocalName)
+{
+    if (shouldIgnoreAttributeCase(element))
+        return equalLettersIgnoringASCIICase(attributeLocalName, "style");
+    return attributeLocalName == styleAttr.localName();
+}
+
 ALWAYS_INLINE void Element::synchronizeAttribute(const AtomicString& localName) const
 {
     // This version of synchronizeAttribute() is streamlined for the case where you don't have a full QualifiedName,
     // e.g when called from DOM API.
     if (!elementData())
         return;
-    // FIXME: this should be comparing in the ASCII range.
-    if (elementData()->styleAttributeIsDirty() && equalPossiblyIgnoringCase(localName, styleAttr.localName(), shouldIgnoreAttributeCase(*this))) {
+    if (elementData()->styleAttributeIsDirty() && isStyleAttribute(*this, localName)) {
         ASSERT_WITH_SECURITY_IMPLICATION(isStyledElement());
         static_cast<const StyledElement*>(this)->synchronizeStyleAttributeInternal();
         return;
     }
-
     if (elementData()->animatedSVGAttributesAreDirty()) {
         // We're not passing a namespace argument on purpose. SVGNames::*Attr are defined w/o namespaces as well.
         ASSERT_WITH_SECURITY_IMPLICATION(isSVGElement());
@@ -2882,7 +2887,6 @@ SpellcheckAttributeState Element::spellcheckAttributeState() const
         return SpellcheckAttributeTrue;
     if (equalLettersIgnoringASCIICase(value, "false"))
         return SpellcheckAttributeFalse;
-
     return SpellcheckAttributeDefault;
 }
 
index 12388f1..d46a3a6 100644 (file)
@@ -270,8 +270,10 @@ Element* TreeScope::findAnchor(const String& name)
         return element;
     for (auto& anchor : descendantsOfType<HTMLAnchorElement>(m_rootNode)) {
         if (m_rootNode.document().inQuirksMode()) {
-            // Quirks mode, case insensitive comparison of names.
-            if (equalIgnoringCase(anchor.name(), name))
+            // Quirks mode, ASCII case-insensitive comparison of names.
+            // FIXME: This behavior is not mentioned in the HTML specification.
+            // We should either remove this or get this into the specification.
+            if (equalIgnoringASCIICase(anchor.name(), name))
                 return &anchor;
         } else {
             // Strict mode, names need to match exactly.
index d6ee167..a4c9c4b 100644 (file)
@@ -99,7 +99,7 @@ bool HiddenInputType::isHiddenType() const
 
 bool HiddenInputType::appendFormData(FormDataList& encoding, bool isMultipartForm) const
 {
-    if (equalIgnoringCase(element().name(), "_charset_")) {
+    if (equalIgnoringASCIICase(element().name(), "_charset_")) {
         encoding.appendData(element().name(), String(encoding.encoding().name()));
         return true;
     }
index acc67d8..53c8856 100644 (file)
@@ -950,7 +950,7 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name)
     if (isContextLostOrPending())
         return nullptr;
 
-    if ((equalIgnoringCase(name, "EXT_texture_filter_anisotropic") || equalIgnoringCase(name, "WEBKIT_EXT_texture_filter_anisotropic"))
+    if ((equalIgnoringASCIICase(name, "EXT_texture_filter_anisotropic") || equalIgnoringASCIICase(name, "WEBKIT_EXT_texture_filter_anisotropic"))
         && m_context->getExtensions()->supports("GL_EXT_texture_filter_anisotropic")) {
         if (!m_extTextureFilterAnisotropic) {
             m_context->getExtensions()->ensureEnabled("GL_EXT_texture_filter_anisotropic");
@@ -958,7 +958,7 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name)
         }
         return m_extTextureFilterAnisotropic.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_float")
+    if (equalIgnoringASCIICase(name, "OES_texture_float")
         && m_context->getExtensions()->supports("GL_OES_texture_float")) {
         if (!m_oesTextureFloat) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_float");
@@ -966,7 +966,7 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name)
         }
         return m_oesTextureFloat.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_float_linear")
+    if (equalIgnoringASCIICase(name, "OES_texture_float_linear")
         && m_context->getExtensions()->supports("GL_OES_texture_float_linear")) {
         if (!m_oesTextureFloatLinear) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_float_linear");
@@ -974,7 +974,7 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name)
         }
         return m_oesTextureFloatLinear.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_half_float")
+    if (equalIgnoringASCIICase(name, "OES_texture_half_float")
         && m_context->getExtensions()->supports("GL_OES_texture_half_float")) {
         if (!m_oesTextureHalfFloat) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_half_float");
@@ -982,7 +982,7 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name)
         }
         return m_oesTextureHalfFloat.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_half_float_linear")
+    if (equalIgnoringASCIICase(name, "OES_texture_half_float_linear")
         && m_context->getExtensions()->supports("GL_OES_texture_half_float_linear")) {
         if (!m_oesTextureHalfFloatLinear) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_half_float_linear");
@@ -990,30 +990,30 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name)
         }
         return m_oesTextureHalfFloatLinear.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_lose_context")) {
+    if (equalIgnoringASCIICase(name, "WEBGL_lose_context")) {
         if (!m_webglLoseContext)
             m_webglLoseContext = std::make_unique<WebGLLoseContext>(this);
         return m_webglLoseContext.get();
     }
-    if ((equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_texture_atc"))
+    if ((equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_atc"))
         && WebGLCompressedTextureATC::supported(this)) {
         if (!m_webglCompressedTextureATC)
             m_webglCompressedTextureATC = std::make_unique<WebGLCompressedTextureATC>(this);
         return m_webglCompressedTextureATC.get();
     }
-    if ((equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_texture_pvrtc"))
+    if ((equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_pvrtc"))
         && WebGLCompressedTexturePVRTC::supported(this)) {
         if (!m_webglCompressedTexturePVRTC)
             m_webglCompressedTexturePVRTC = std::make_unique<WebGLCompressedTexturePVRTC>(this);
         return m_webglCompressedTexturePVRTC.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_compressed_texture_s3tc")
+    if (equalIgnoringASCIICase(name, "WEBGL_compressed_texture_s3tc")
         && WebGLCompressedTextureS3TC::supported(this)) {
         if (!m_webglCompressedTextureS3TC)
             m_webglCompressedTextureS3TC = std::make_unique<WebGLCompressedTextureS3TC>(this);
         return m_webglCompressedTextureS3TC.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_depth_texture")
+    if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")
         && WebGLDepthTexture::supported(graphicsContext3D())) {
         if (!m_webglDepthTexture) {
             m_context->getExtensions()->ensureEnabled("GL_CHROMIUM_depth_texture");
@@ -1021,12 +1021,12 @@ WebGLExtension* WebGL2RenderingContext::getExtension(const String& name)
         }
         return m_webglDepthTexture.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_debug_renderer_info")) {
+    if (equalIgnoringASCIICase(name, "WEBGL_debug_renderer_info")) {
         if (!m_webglDebugRendererInfo)
             m_webglDebugRendererInfo = std::make_unique<WebGLDebugRendererInfo>(this);
         return m_webglDebugRendererInfo.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_debug_shaders")
+    if (equalIgnoringASCIICase(name, "WEBGL_debug_shaders")
         && m_context->getExtensions()->supports("GL_ANGLE_translated_shader_source")) {
         if (!m_webglDebugShaders)
             m_webglDebugShaders = std::make_unique<WebGLDebugShaders>(this);
index ec1152a..11e13e1 100644 (file)
@@ -89,7 +89,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
     if (isContextLostOrPending())
         return nullptr;
     
-    if (equalIgnoringCase(name, "EXT_blend_minmax")
+    if (equalIgnoringASCIICase(name, "EXT_blend_minmax")
         && m_context->getExtensions()->supports("GL_EXT_blend_minmax")) {
         if (!m_extBlendMinMax) {
             m_context->getExtensions()->ensureEnabled("GL_EXT_blend_minmax");
@@ -97,7 +97,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_extBlendMinMax.get();
     }
-    if (equalIgnoringCase(name, "EXT_sRGB")
+    if (equalIgnoringASCIICase(name, "EXT_sRGB")
         && m_context->getExtensions()->supports("GL_EXT_sRGB")) {
         if (!m_extsRGB) {
             m_context->getExtensions()->ensureEnabled("GL_EXT_sRGB");
@@ -105,7 +105,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_extsRGB.get();
     }
-    if (equalIgnoringCase(name, "EXT_frag_depth")
+    if (equalIgnoringASCIICase(name, "EXT_frag_depth")
         && m_context->getExtensions()->supports("GL_EXT_frag_depth")) {
         if (!m_extFragDepth) {
             m_context->getExtensions()->ensureEnabled("GL_EXT_frag_depth");
@@ -113,7 +113,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_extFragDepth.get();
     }
-    if (equalIgnoringCase(name, "EXT_shader_texture_lod")
+    if (equalIgnoringASCIICase(name, "EXT_shader_texture_lod")
         && (m_context->getExtensions()->supports("GL_EXT_shader_texture_lod") || m_context->getExtensions()->supports("GL_ARB_shader_texture_lod"))) {
         if (!m_extShaderTextureLOD) {
             m_context->getExtensions()->ensureEnabled("GL_EXT_shader_texture_lod");
@@ -121,7 +121,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_extShaderTextureLOD.get();
     }
-    if ((equalIgnoringCase(name, "EXT_texture_filter_anisotropic") || equalIgnoringCase(name, "WEBKIT_EXT_texture_filter_anisotropic"))
+    if ((equalIgnoringASCIICase(name, "EXT_texture_filter_anisotropic") || equalIgnoringASCIICase(name, "WEBKIT_EXT_texture_filter_anisotropic"))
         && m_context->getExtensions()->supports("GL_EXT_texture_filter_anisotropic")) {
         if (!m_extTextureFilterAnisotropic) {
             m_context->getExtensions()->ensureEnabled("GL_EXT_texture_filter_anisotropic");
@@ -129,7 +129,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_extTextureFilterAnisotropic.get();
     }
-    if (equalIgnoringCase(name, "OES_standard_derivatives")
+    if (equalIgnoringASCIICase(name, "OES_standard_derivatives")
         && m_context->getExtensions()->supports("GL_OES_standard_derivatives")) {
         if (!m_oesStandardDerivatives) {
             m_context->getExtensions()->ensureEnabled("GL_OES_standard_derivatives");
@@ -137,7 +137,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_oesStandardDerivatives.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_float")
+    if (equalIgnoringASCIICase(name, "OES_texture_float")
         && m_context->getExtensions()->supports("GL_OES_texture_float")) {
         if (!m_oesTextureFloat) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_float");
@@ -145,7 +145,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_oesTextureFloat.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_float_linear")
+    if (equalIgnoringASCIICase(name, "OES_texture_float_linear")
         && m_context->getExtensions()->supports("GL_OES_texture_float_linear")) {
         if (!m_oesTextureFloatLinear) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_float_linear");
@@ -153,7 +153,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_oesTextureFloatLinear.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_half_float")
+    if (equalIgnoringASCIICase(name, "OES_texture_half_float")
         && m_context->getExtensions()->supports("GL_OES_texture_half_float")) {
         if (!m_oesTextureHalfFloat) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_half_float");
@@ -161,7 +161,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_oesTextureHalfFloat.get();
     }
-    if (equalIgnoringCase(name, "OES_texture_half_float_linear")
+    if (equalIgnoringASCIICase(name, "OES_texture_half_float_linear")
         && m_context->getExtensions()->supports("GL_OES_texture_half_float_linear")) {
         if (!m_oesTextureHalfFloatLinear) {
             m_context->getExtensions()->ensureEnabled("GL_OES_texture_half_float_linear");
@@ -169,7 +169,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_oesTextureHalfFloatLinear.get();
     }
-    if (equalIgnoringCase(name, "OES_vertex_array_object")
+    if (equalIgnoringASCIICase(name, "OES_vertex_array_object")
         && m_context->getExtensions()->supports("GL_OES_vertex_array_object")) {
         if (!m_oesVertexArrayObject) {
             m_context->getExtensions()->ensureEnabled("GL_OES_vertex_array_object");
@@ -177,7 +177,7 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_oesVertexArrayObject.get();
     }
-    if (equalIgnoringCase(name, "OES_element_index_uint")
+    if (equalIgnoringASCIICase(name, "OES_element_index_uint")
         && m_context->getExtensions()->supports("GL_OES_element_index_uint")) {
         if (!m_oesElementIndexUint) {
             m_context->getExtensions()->ensureEnabled("GL_OES_element_index_uint");
@@ -185,30 +185,30 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_oesElementIndexUint.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_lose_context")) {
+    if (equalIgnoringASCIICase(name, "WEBGL_lose_context")) {
         if (!m_webglLoseContext)
             m_webglLoseContext = std::make_unique<WebGLLoseContext>(this);
         return m_webglLoseContext.get();
     }
-    if ((equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_texture_atc"))
+    if ((equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_atc"))
         && WebGLCompressedTextureATC::supported(this)) {
         if (!m_webglCompressedTextureATC)
             m_webglCompressedTextureATC = std::make_unique<WebGLCompressedTextureATC>(this);
         return m_webglCompressedTextureATC.get();
     }
-    if ((equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_texture_pvrtc"))
+    if ((equalIgnoringASCIICase(name, "WEBKIT_WEBGL_compressed_texture_pvrtc"))
         && WebGLCompressedTexturePVRTC::supported(this)) {
         if (!m_webglCompressedTexturePVRTC)
             m_webglCompressedTexturePVRTC = std::make_unique<WebGLCompressedTexturePVRTC>(this);
         return m_webglCompressedTexturePVRTC.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_compressed_texture_s3tc")
+    if (equalIgnoringASCIICase(name, "WEBGL_compressed_texture_s3tc")
         && WebGLCompressedTextureS3TC::supported(this)) {
         if (!m_webglCompressedTextureS3TC)
             m_webglCompressedTextureS3TC = std::make_unique<WebGLCompressedTextureS3TC>(this);
         return m_webglCompressedTextureS3TC.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_depth_texture")
+    if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")
         && WebGLDepthTexture::supported(graphicsContext3D())) {
         if (!m_webglDepthTexture) {
             m_context->getExtensions()->ensureEnabled("GL_CHROMIUM_depth_texture");
@@ -216,26 +216,26 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
         }
         return m_webglDepthTexture.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_draw_buffers") && supportsDrawBuffers()) {
+    if (equalIgnoringASCIICase(name, "WEBGL_draw_buffers") && supportsDrawBuffers()) {
         if (!m_webglDrawBuffers) {
             m_context->getExtensions()->ensureEnabled("GL_EXT_draw_buffers");
             m_webglDrawBuffers = std::make_unique<WebGLDrawBuffers>(this);
         }
         return m_webglDrawBuffers.get();
     }
-    if (equalIgnoringCase(name, "ANGLE_instanced_arrays") && ANGLEInstancedArrays::supported(this)) {
+    if (equalIgnoringASCIICase(name, "ANGLE_instanced_arrays") && ANGLEInstancedArrays::supported(this)) {
         if (!m_angleInstancedArrays) {
             m_context->getExtensions()->ensureEnabled("GL_ANGLE_instanced_arrays");
             m_angleInstancedArrays = std::make_unique<ANGLEInstancedArrays>(this);
         }
         return m_angleInstancedArrays.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_debug_renderer_info")) {
+    if (equalIgnoringASCIICase(name, "WEBGL_debug_renderer_info")) {
         if (!m_webglDebugRendererInfo)
             m_webglDebugRendererInfo = std::make_unique<WebGLDebugRendererInfo>(this);
         return m_webglDebugRendererInfo.get();
     }
-    if (equalIgnoringCase(name, "WEBGL_debug_shaders")
+    if (equalIgnoringASCIICase(name, "WEBGL_debug_shaders")
         && m_context->getExtensions()->supports("GL_ANGLE_translated_shader_source")) {
         if (!m_webglDebugShaders)
             m_webglDebugShaders = std::make_unique<WebGLDebugShaders>(this);
index 75a7a93..9a64c51 100644 (file)
@@ -195,25 +195,18 @@ static String parseCSSStringOrURL(const UChar* characters, size_t length)
     return String(characters + offset, reducedLength);
 }
 
-template<unsigned referenceLength>
-static inline bool ruleEqualIgnoringCase(const Vector<UChar>& rule, const char (&reference)[referenceLength])
-{
-    unsigned referenceCharactersLength = referenceLength - 1;
-    return rule.size() == referenceCharactersLength && equalIgnoringCase(reference, rule.data(), referenceCharactersLength);
-}
-
 void CSSPreloadScanner::emitRule()
 {
-    if (ruleEqualIgnoringCase(m_rule, "import")) {
+    StringView rule(m_rule.data(), m_rule.size());
+    if (equalLettersIgnoringASCIICase(rule, "import")) {
         String url = parseCSSStringOrURL(m_ruleValue.data(), m_ruleValue.size());
         if (!url.isEmpty()) {
-            URL baseElementURL; // FIXME: This should be passed in from the HTMLPreloadScaner via scan()!
-
+            URL baseElementURL; // FIXME: This should be passed in from the HTMLPreloadScanner via scan(): without it we will get relative URLs wrong.
             // FIXME: Should this be including the charset in the preload request?
             m_requests->append(std::make_unique<PreloadRequest>("css", url, baseElementURL, CachedResource::CSSStyleSheet, String()));
         }
         m_state = Initial;
-    } else if (ruleEqualIgnoringCase(m_rule, "charset"))
+    } else if (equalLettersIgnoringASCIICase(rule, "charset"))
         m_state = Initial;
     else
         m_state = DoneParsingImportRules;
index 1edbbfc..d37e855 100644 (file)
@@ -113,7 +113,7 @@ bool InspectorNodeFinder::matchesElement(const Element& element)
 {
     String nodeName = element.nodeName();
     if ((!m_startTagFound && !m_endTagFound && (nodeName.findIgnoringCase(m_tagNameQuery) != notFound))
-        || (m_startTagFound && m_endTagFound && equalIgnoringCase(nodeName, m_tagNameQuery))
+        || (m_startTagFound && m_endTagFound && equalIgnoringASCIICase(nodeName, m_tagNameQuery))
         || (m_startTagFound && !m_endTagFound && nodeName.startsWith(m_tagNameQuery, false))
         || (!m_startTagFound && m_endTagFound && nodeName.endsWith(m_tagNameQuery, false)))
         return true;
index 3a6ea71..53ee120 100644 (file)
@@ -606,7 +606,7 @@ bool HistoryController::currentItemShouldBeReplaced() const
     //  "If the browsing context's session history contains only one Document,
     //   and that was the about:blank Document created when the browsing context
     //   was created, then the navigation must be done with replacement enabled."
-    return m_currentItem && !m_previousItem && equalIgnoringCase(m_currentItem->urlString(), blankURL());
+    return m_currentItem && !m_previousItem && equalIgnoringASCIICase(m_currentItem->urlString(), blankURL());
 }
 
 void HistoryController::clearPreviousItem()
index 0de434c..5a09cfd 100644 (file)
@@ -173,7 +173,7 @@ static String findPluginMIMETypeFromURL(Page* page, const String& url)
     pluginData.getWebVisibleMimesAndPluginIndices(mimes, mimePluginIndices);
     for (auto& mime : mimes) {
         for (auto& mimeExtension : mime.extensions) {
-            if (equalIgnoringCase(extension, mimeExtension))
+            if (equalIgnoringASCIICase(extension, mimeExtension))
                 return mime.type;
         }
     }
index 88e7ee2..847b071 100644 (file)
@@ -378,7 +378,7 @@ bool ApplicationCacheHost::shouldLoadResourceFromApplicationCache(const Resource
 
     // If the resource is not to be fetched using the HTTP GET mechanism or equivalent, or if its URL has a different
     // <scheme> component than the application cache's manifest, then fetch the resource normally.
-    if (!ApplicationCache::requestIsHTTPOrHTTPSGet(request) || !equalIgnoringCase(request.url().protocol(), cache->manifestResource()->url().protocol()))
+    if (!ApplicationCache::requestIsHTTPOrHTTPSGet(request) || !equalIgnoringASCIICase(request.url().protocol(), cache->manifestResource()->url().protocol()))
         return false;
 
     // If the resource's URL is an master entry, the manifest, an explicit entry, or a fallback entry
index 2c6144f..601141d 100644 (file)
@@ -122,7 +122,7 @@ bool parseManifest(const URL& manifestURL, const char* data, int length, Manifes
             if (url.hasFragmentIdentifier())
                 url.removeFragmentIdentifier();
             
-            if (!equalIgnoringCase(url.protocol(), manifestURL.protocol()))
+            if (!equalIgnoringASCIICase(url.protocol(), manifestURL.protocol()))
                 continue;
             
             if (mode == Explicit && manifestURL.protocolIs("https") && !protocolHostAndPortAreEqual(manifestURL, url))
index 183600b..06614e1 100644 (file)
@@ -61,7 +61,7 @@ private:
 
 inline bool operator==(const OriginAccessEntry& a, const OriginAccessEntry& b)
 {
-    return equalIgnoringCase(a.protocol(), b.protocol()) && equalIgnoringCase(a.host(), b.host()) && a.subdomainSettings() == b.subdomainSettings();
+    return equalIgnoringASCIICase(a.protocol(), b.protocol()) && equalIgnoringASCIICase(a.host(), b.host()) && a.subdomainSettings() == b.subdomainSettings();
 }
 
 inline bool operator!=(const OriginAccessEntry& a, const OriginAccessEntry& b)
index a3e2cf6..ed39a1d 100644 (file)
@@ -140,21 +140,22 @@ PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByName(const Strin
     RefPtr<PerformanceEntryList> entries = PerformanceEntryList::create();
 
 #if ENABLE(RESOURCE_TIMING)
-    if (entryType.isNull() || equalIgnoringCase(entryType, "resource"))
+    if (entryType.isNull() || equalLettersIgnoringASCIICase(entryType, "resource")) {
         for (auto& resource : m_resourceTimingBuffer) {
             if (resource->name() == name)
                 entries->append(resource);
         }
-#endif // ENABLE(RESOURCE_TIMING)
+    }
+#endif
 
 #if ENABLE(USER_TIMING)
     if (m_userTiming) {
-        if (entryType.isNull() || equalIgnoringCase(entryType, "mark"))
+        if (entryType.isNull() || equalLettersIgnoringASCIICase(entryType, "mark"))
             entries->appendAll(m_userTiming->getMarks(name));
-        if (entryType.isNull() || equalIgnoringCase(entryType, "measure"))
+        if (entryType.isNull() || equalLettersIgnoringASCIICase(entryType, "measure"))
             entries->appendAll(m_userTiming->getMeasures(name));
     }
-#endif // ENABLE(USER_TIMING)
+#endif
 
     entries->sort();
     return entries;
index 9dba91c..953ce0f 100644 (file)
@@ -114,7 +114,7 @@ bool UserContentURLPattern::matches(const URL& test) const
     if (m_invalid)
         return false;
 
-    if (!equalIgnoringCase(test.protocol(), m_scheme))
+    if (!equalIgnoringASCIICase(test.protocol(), m_scheme))
         return false;
 
     if (!equalLettersIgnoringASCIICase(m_scheme, "file") && !matchesHost(test))
@@ -126,7 +126,7 @@ bool UserContentURLPattern::matches(const URL& test) const
 bool UserContentURLPattern::matchesHost(const URL& test) const
 {
     const String& host = test.host();
-    if (equalIgnoringCase(host, m_host))
+    if (equalIgnoringASCIICase(host, m_host))
         return true;
 
     if (!m_matchSubdomains)
index b3c61bf..9f112f0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2011 Google, Inc. All rights reserved.
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -125,26 +125,39 @@ static const char pluginTypes[] = "plugin-types";
 static const char reflectedXSS[] = "reflected-xss";
 #endif
 
-bool isDirectiveName(const String& name)
-{
-    return (equalIgnoringCase(name, connectSrc)
-        || equalIgnoringCase(name, defaultSrc)
-        || equalIgnoringCase(name, fontSrc)
-        || equalIgnoringCase(name, frameSrc)
-        || equalIgnoringCase(name, imgSrc)
-        || equalIgnoringCase(name, mediaSrc)
-        || equalIgnoringCase(name, objectSrc)
-        || equalIgnoringCase(name, reportURI)
-        || equalIgnoringCase(name, sandbox)
-        || equalIgnoringCase(name, scriptSrc)
-        || equalIgnoringCase(name, styleSrc)
 #if ENABLE(CSP_NEXT)
-        || equalIgnoringCase(name, baseURI)
-        || equalIgnoringCase(name, formAction)
-        || equalIgnoringCase(name, pluginTypes)
-        || equalIgnoringCase(name, reflectedXSS)
+
+static inline bool isExperimentalDirectiveName(const String& name)
+{
+    return equalLettersIgnoringASCIICase(name, baseURI)
+        || equalLettersIgnoringASCIICase(name, formAction)
+        || equalLettersIgnoringASCIICase(name, pluginTypes)
+        || equalLettersIgnoringASCIICase(name, reflectedXSS);
+}
+
+#else
+
+static inline bool isExperimentalDirectiveName(const String&)
+{
+    return false;
+}
+
 #endif
-    );
+
+bool isDirectiveName(const String& name)
+{
+    return equalLettersIgnoringASCIICase(name, connectSrc)
+        || equalLettersIgnoringASCIICase(name, defaultSrc)
+        || equalLettersIgnoringASCIICase(name, fontSrc)
+        || equalLettersIgnoringASCIICase(name, frameSrc)
+        || equalLettersIgnoringASCIICase(name, imgSrc)
+        || equalLettersIgnoringASCIICase(name, mediaSrc)
+        || equalLettersIgnoringASCIICase(name, objectSrc)
+        || equalLettersIgnoringASCIICase(name, reportURI)
+        || equalLettersIgnoringASCIICase(name, sandbox)
+        || equalLettersIgnoringASCIICase(name, scriptSrc)
+        || equalLettersIgnoringASCIICase(name, styleSrc)
+        || isExperimentalDirectiveName(name);
 }
 
 } // namespace
@@ -190,7 +203,7 @@ static bool isSourceListNone(const String& value)
 
     const UChar* position = begin;
     skipWhile<isSourceCharacter>(position, end);
-    if (!equalIgnoringCase("'none'", begin, position - begin))
+    if (!equalLettersIgnoringASCIICase(begin, position - begin, "'none'"))
         return false;
 
     skipWhile<isASCIISpace>(position, end);
@@ -228,18 +241,18 @@ private:
         if (m_scheme.isEmpty()) {
             String protectedResourceScheme(m_policy->securityOrigin()->protocol());
 #if ENABLE(CSP_NEXT)
-            if (equalIgnoringCase("http", protectedResourceScheme))
+            if (equalLettersIgnoringASCIICase(protectedResourceScheme, "http"))
                 return url.protocolIsInHTTPFamily();
 #endif
-            return equalIgnoringCase(url.protocol(), protectedResourceScheme);
+            return equalIgnoringASCIICase(url.protocol(), protectedResourceScheme);
         }
-        return equalIgnoringCase(url.protocol(), m_scheme);
+        return equalIgnoringASCIICase(url.protocol(), m_scheme);
     }
 
     bool hostMatches(const URL& url) const
     {
         const String& host = url.host();
-        if (equalIgnoringCase(host, m_host))
+        if (equalIgnoringASCIICase(host, m_host))
             return true;
         return m_hostHasWildcard && host.endsWith("." + m_host, false);
 
@@ -393,14 +406,12 @@ void CSPSourceList::parse(const UChar* begin, const UChar* end)
 //                   / ( [ scheme "://" ] host [ port ] [ path ] )
 //                   / "'self'"
 //
-bool CSPSourceList::parseSource(const UChar* begin, const UChar* end,
-                                String& scheme, String& host, int& port, String& path,
-                                bool& hostHasWildcard, bool& portHasWildcard)
+bool CSPSourceList::parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, int& port, String& path, bool& hostHasWildcard, bool& portHasWildcard)
 {
     if (begin == end)
         return false;
 
-    if (equalIgnoringCase("'none'", begin, end - begin))
+    if (equalLettersIgnoringASCIICase(begin, end - begin, "'none'"))
         return false;
 
     if (end - begin == 1 && *begin == '*') {
@@ -408,17 +419,17 @@ bool CSPSourceList::parseSource(const UChar* begin, const UChar* end,
         return true;
     }
 
-    if (equalIgnoringCase("'self'", begin, end - begin)) {
+    if (equalLettersIgnoringASCIICase(begin, end - begin, "'self'")) {
         addSourceSelf();
         return true;
     }
 
-    if (equalIgnoringCase("'unsafe-inline'", begin, end - begin)) {
+    if (equalLettersIgnoringASCIICase(begin, end - begin, "'unsafe-inline'")) {
         addSourceUnsafeInline();
         return true;
     }
 
-    if (equalIgnoringCase("'unsafe-eval'", begin, end - begin)) {
+    if (equalLettersIgnoringASCIICase(begin, end - begin, "'unsafe-eval'")) {
         addSourceUnsafeEval();
         return true;
     }
@@ -963,7 +974,7 @@ bool CSPDirectiveList::checkSourceAndReportViolation(SourceListDirective* direct
     if (checkSource(directive, url))
         return true;
 
-    String prefix;
+    const char* prefix;
     if (baseURI == effectiveDirective)
         prefix = "Refused to set the document's base URI to '";
     else if (connectSrc == effectiveDirective)
@@ -984,12 +995,14 @@ bool CSPDirectiveList::checkSourceAndReportViolation(SourceListDirective* direct
         prefix = "Refused to load the script '";
     else if (styleSrc == effectiveDirective)
         prefix = "Refused to load the stylesheet '";
+    else
+        prefix = "";
 
-    String suffix = String();
+    String suffix;
     if (directive == m_defaultSrc.get())
         suffix = " Note that '" + effectiveDirective + "' was not explicitly set, so 'default-src' is used as a fallback.";
 
-    reportViolation(directive->text(), effectiveDirective, prefix + url.stringCenterEllipsizedToLength() + "' because it violates the following Content Security Policy directive: \"" + directive->text() + "\"." + suffix + "\n", url);
+    reportViolation(directive->text(), effectiveDirective, makeString(prefix, url.stringCenterEllipsizedToLength(), "' because it violates the following Content Security Policy directive: \"", directive->text(), "\".", suffix, '\n'), url);
     return denyIfEnforcingPolicy();
 }
 
@@ -1275,11 +1288,11 @@ void CSPDirectiveList::parseReflectedXSS(const String& name, const String& value
 
     // value1
     //       ^
-    if (equalIgnoringCase("allow", begin, position - begin))
+    if (equalLettersIgnoringASCIICase(begin, position - begin, "allow"))
         m_reflectedXSSDisposition = ContentSecurityPolicy::AllowReflectedXSS;
-    else if (equalIgnoringCase("filter", begin, position - begin))
+    else if (equalLettersIgnoringASCIICase(begin, position - begin, "filter"))
         m_reflectedXSSDisposition = ContentSecurityPolicy::FilterReflectedXSS;
-    else if (equalIgnoringCase("block", begin, position - begin))
+    else if (equalLettersIgnoringASCIICase(begin, position - begin, "block"))
         m_reflectedXSSDisposition = ContentSecurityPolicy::BlockReflectedXSS;
     else {
         m_reflectedXSSDisposition = ContentSecurityPolicy::ReflectedXSSInvalid;
@@ -1301,37 +1314,37 @@ void CSPDirectiveList::addDirective(const String& name, const String& value)
 {
     ASSERT(!name.isEmpty());
 
-    if (equalIgnoringCase(name, defaultSrc))
+    if (equalLettersIgnoringASCIICase(name, defaultSrc))
         setCSPDirective<SourceListDirective>(name, value, m_defaultSrc);
-    else if (equalIgnoringCase(name, scriptSrc))
+    else if (equalLettersIgnoringASCIICase(name, scriptSrc))
         setCSPDirective<SourceListDirective>(name, value, m_scriptSrc);
-    else if (equalIgnoringCase(name, objectSrc))
+    else if (equalLettersIgnoringASCIICase(name, objectSrc))
         setCSPDirective<SourceListDirective>(name, value, m_objectSrc);
-    else if (equalIgnoringCase(name, frameSrc))
+    else if (equalLettersIgnoringASCIICase(name, frameSrc))
         setCSPDirective<SourceListDirective>(name, value, m_frameSrc);
-    else if (equalIgnoringCase(name, imgSrc))
+    else if (equalLettersIgnoringASCIICase(name, imgSrc))
         setCSPDirective<SourceListDirective>(name, value, m_imgSrc);
-    else if (equalIgnoringCase(name, styleSrc))
+    else if (equalLettersIgnoringASCIICase(name, styleSrc))
         setCSPDirective<SourceListDirective>(name, value, m_styleSrc);
-    else if (equalIgnoringCase(name, fontSrc))
+    else if (equalLettersIgnoringASCIICase(name, fontSrc))
         setCSPDirective<SourceListDirective>(name, value, m_fontSrc);
-    else if (equalIgnoringCase(name, mediaSrc))
+    else if (equalLettersIgnoringASCIICase(name, mediaSrc))
         setCSPDirective<SourceListDirective>(name, value, m_mediaSrc);
-    else if (equalIgnoringCase(name, connectSrc))
+    else if (equalLettersIgnoringASCIICase(name, connectSrc))
         setCSPDirective<SourceListDirective>(name, value, m_connectSrc);
-    else if (equalIgnoringCase(name, sandbox))
+    else if (equalLettersIgnoringASCIICase(name, sandbox))
         applySandboxPolicy(name, value);
-    else if (equalIgnoringCase(name, reportURI))
+    else if (equalLettersIgnoringASCIICase(name, reportURI))
         parseReportURI(name, value);
 #if ENABLE(CSP_NEXT)
     else if (m_policy->experimentalFeaturesEnabled()) {
-        if (equalIgnoringCase(name, baseURI))
+        if (equalLettersIgnoringASCIICase(name, baseURI))
             setCSPDirective<SourceListDirective>(name, value, m_baseURI);
-        else if (equalIgnoringCase(name, formAction))
+        else if (equalLettersIgnoringASCIICase(name, formAction))
             setCSPDirective<SourceListDirective>(name, value, m_formAction);
-        else if (equalIgnoringCase(name, pluginTypes))
+        else if (equalLettersIgnoringASCIICase(name, pluginTypes))
             setCSPDirective<MediaListDirective>(name, value, m_pluginTypes);
-        else if (equalIgnoringCase(name, reflectedXSS))
+        else if (equalLettersIgnoringASCIICase(name, reflectedXSS))
             parseReflectedXSS(name, value);
         else
             m_policy->reportUnsupportedDirective(name);
@@ -1677,36 +1690,27 @@ void ContentSecurityPolicy::reportViolation(const String& directiveText, const S
 
 void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const
 {
-    static NeverDestroyed<String> allow(ASCIILiteral("allow"));
-    static NeverDestroyed<String> options(ASCIILiteral("options"));
-    static NeverDestroyed<String> policyURI(ASCIILiteral("policy-uri"));
-    static NeverDestroyed<String> allowMessage(ASCIILiteral("The 'allow' directive has been replaced with 'default-src'. Please use that directive instead, as 'allow' has no effect."));
-    static NeverDestroyed<String> optionsMessage(ASCIILiteral("The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect."));
-    static NeverDestroyed<String> policyURIMessage(ASCIILiteral("The 'policy-uri' directive has been removed from the specification. Please specify a complete policy via the Content-Security-Policy header."));
-
     String message;
-    if (equalIgnoringCase(name, allow))
-        message = allowMessage;
-    else if (equalIgnoringCase(name, options))
-        message = optionsMessage;
-    else if (equalIgnoringCase(name, policyURI))
-        message = policyURIMessage;
+    if (equalLettersIgnoringASCIICase(name, "allow"))
+        message = ASCIILiteral("The 'allow' directive has been replaced with 'default-src'. Please use that directive instead, as 'allow' has no effect.");
+    else if (equalLettersIgnoringASCIICase(name, "options"))
+        message = ASCIILiteral("The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect.");
+    else if (equalLettersIgnoringASCIICase(name, "policy-uri"))
+        message = ASCIILiteral("The 'policy-uri' directive has been removed from the specification. Please specify a complete policy via the Content-Security-Policy header.");
     else
-        message = makeString("Unrecognized Content-Security-Policy directive '", name, "'.\n");
+        message = makeString("Unrecognized Content-Security-Policy directive '", name, "'.\n"); // FIXME: Why does this include a newline?
 
     logToConsole(message);
 }
 
 void ContentSecurityPolicy::reportDirectiveAsSourceExpression(const String& directiveName, const String& sourceExpression) const
 {
-    String message = "The Content Security Policy directive '" + directiveName + "' contains '" + sourceExpression + "' as a source expression. Did you mean '" + directiveName + " ...; " + sourceExpression + "...' (note the semicolon)?";
-    logToConsole(message);
+    logToConsole("The Content Security Policy directive '" + directiveName + "' contains '" + sourceExpression + "' as a source expression. Did you mean '" + directiveName + " ...; " + sourceExpression + "...' (note the semicolon)?");
 }
 
 void ContentSecurityPolicy::reportDuplicateDirective(const String& name) const
 {
-    String message = makeString("Ignoring duplicate Content-Security-Policy directive '", name, "'.\n");
-    logToConsole(message);
+    logToConsole(makeString("Ignoring duplicate Content-Security-Policy directive '", name, "'.\n"));
 }
 
 void ContentSecurityPolicy::reportInvalidPluginTypes(const String& pluginType) const
@@ -1752,7 +1756,7 @@ void ContentSecurityPolicy::reportInvalidPathCharacter(const String& directiveNa
 void ContentSecurityPolicy::reportInvalidSourceExpression(const String& directiveName, const String& source) const
 {
     String message = makeString("The source list for Content Security Policy directive '", directiveName, "' contains an invalid source: '", source, "'. It will be ignored.");
-    if (equalIgnoringCase(source, "'none'"))
+    if (equalLettersIgnoringASCIICase(source, "'none'"))
         message = makeString(message, " Note that 'none' has no effect unless it is the only expression in the source list.");
     logToConsole(message);
 }
index 788e8fd..f2f3569 100644 (file)
@@ -518,7 +518,7 @@ void URL::init(const URL& base, const String& relative, const TextEncoding& enco
             ++p;
         }
         if (*p == ':') {
-            if (p[1] != '/' && equalIgnoringCase(base.protocol(), String(str, p - str)) && base.isHierarchical())
+            if (p[1] != '/' && equalIgnoringASCIICase(base.protocol(), StringView(reinterpret_cast<LChar*>(str), p - str)) && base.isHierarchical())
                 str = p + 1;
             else
                 absolute = true;
index b7acbab..1114bd6 100644 (file)
@@ -133,7 +133,7 @@ bool ContentFilterUnblockHandler::canHandleRequest(const ResourceRequest& reques
 #endif
     }
 
-    bool isUnblockRequest = request.url().protocolIs(ContentFilter::urlScheme()) && equalIgnoringCase(request.url().host(), m_unblockURLHost);
+    bool isUnblockRequest = request.url().protocolIs(ContentFilter::urlScheme()) && equalIgnoringASCIICase(request.url().host(), m_unblockURLHost);
 #if !LOG_DISABLED
     if (isUnblockRequest)
         LOG(ContentFiltering, "ContentFilterUnblockHandler will handle <%s> as an unblock request.\n", request.url().string().ascii().data());
index 015a392..82d11a6 100644 (file)
@@ -74,9 +74,7 @@ String PlatformSpeechSynthesisProviderEfl::voiceName(PassRefPtr<PlatformSpeechSy
         const Vector<RefPtr<PlatformSpeechSynthesisVoice>>& voiceList = m_platformSpeechSynthesizer->voiceList();
         for (const auto& voice : voiceList) {
             // Espeak adds an empty character at the beginning of the language
-            unsigned length = voice->lang().length();
-            String lang = voice->lang().substring(1, length);
-            if (equalIgnoringCase(language, lang))
+            if (equalIgnoringASCIICase(StringView(voice->lang()).substring(1), language))
                 return voice->name();
         }
     }
index f58debd..4af0916 100644 (file)
@@ -113,7 +113,13 @@ public:
 
     bool operator==(const FontPlatformDataCacheKey& other) const
     {
-        return equalIgnoringCase(m_family, other.m_family) && m_fontDescriptionKey == other.m_fontDescriptionKey;
+        if (m_fontDescriptionKey != other.m_fontDescriptionKey)
+            return false;
+        if (m_family.impl() == other.m_family.impl())
+            return true;
+        if (m_family.isNull() || other.m_family.isNull())
+            return false;
+        return CaseFoldingHash::equal(m_family, other.m_family);
     }
 
     FontDescriptionKey m_fontDescriptionKey;
@@ -142,72 +148,60 @@ static FontPlatformDataCache& fontPlatformDataCache()
     return cache;
 }
 
-static bool familyNameEqualIgnoringCase(const AtomicString& familyName, const char* reference, unsigned length)
+static AtomicString alternateFamilyName(const AtomicString& familyName)
 {
-    ASSERT(length > 0);
-    ASSERT(familyName.length() == length);
-    ASSERT(strlen(reference) == length);
-    const AtomicStringImpl* familyNameImpl = familyName.impl();
-    if (familyNameImpl->is8Bit())
-        return equalIgnoringCase(familyNameImpl->characters8(), reinterpret_cast<const LChar*>(reference), length);
-    return equalIgnoringCase(familyNameImpl->characters16(), reinterpret_cast<const LChar*>(reference), length);
-}
-
-template<size_t length>
-static inline bool familyNameEqualIgnoringCase(const AtomicString& familyName, const char (&reference)[length])
-{
-    return familyNameEqualIgnoringCase(familyName, reference, length - 1);
-}
-
-static const AtomicString alternateFamilyName(const AtomicString& familyName)
-{
-    // Alias Courier and Courier New.
-    // Alias Times and Times New Roman.
-    // Alias Arial and Helvetica.
     switch (familyName.length()) {
     case 5:
-        if (familyNameEqualIgnoringCase(familyName, "Arial"))
+        if (equalLettersIgnoringASCIICase(familyName, "arial"))
             return AtomicString("Helvetica", AtomicString::ConstructFromLiteral);
-        if (familyNameEqualIgnoringCase(familyName, "Times"))
+        if (equalLettersIgnoringASCIICase(familyName, "times"))
             return AtomicString("Times New Roman", AtomicString::ConstructFromLiteral);
         break;
     case 7:
-        if (familyNameEqualIgnoringCase(familyName, "Courier"))
+        if (equalLettersIgnoringASCIICase(familyName, "courier"))
             return AtomicString("Courier New", AtomicString::ConstructFromLiteral);
         break;
+#if OS(WINDOWS)
+    // On Windows, we don't support bitmap fonts, but legacy content expects support.
+    // Thus we allow Times New Roman as an alternative for the bitmap font MS Serif,
+    // even if the webpage does not specify fallback.
+    // FIXME: Seems unlikely this is still needed. If it was really needed, I think we
+    // would need it on other platforms too.
+    case 8:
+        if (equalLettersIgnoringASCIICase(familyName, "ms serif"))
+            return AtomicString("Times New Roman", AtomicString::ConstructFromLiteral);
+        break;
+#endif
     case 9:
-        if (familyNameEqualIgnoringCase(familyName, "Helvetica"))
+        if (equalLettersIgnoringASCIICase(familyName, "helvetica"))
             return AtomicString("Arial", AtomicString::ConstructFromLiteral);
         break;
 #if !OS(WINDOWS)
-    // On Windows, Courier New (truetype font) is always present and
-    // Courier is a bitmap font. So, we don't want to map Courier New to
-    // Courier.
+    // On Windows, Courier New is a TrueType font that is always present and
+    // Courier is a bitmap font that we do not support. So, we don't want to map
+    // Courier New to Courier.
+    // FIXME: Not sure why this is harmful on Windows, since the alternative will
+    // only be tried if Courier New is not found.
     case 11:
-        if (familyNameEqualIgnoringCase(familyName, "Courier New"))
+        if (equalLettersIgnoringASCIICase(familyName, "courier new"))
             return AtomicString("Courier", AtomicString::ConstructFromLiteral);
         break;
-#endif // !OS(WINDOWS)
-    case 15:
-        if (familyNameEqualIgnoringCase(familyName, "Times New Roman"))
-            return AtomicString("Times", AtomicString::ConstructFromLiteral);
-        break;
+#endif
 #if OS(WINDOWS)
-    // On Windows, bitmap fonts are blocked altogether so that we have to 
-    // alias MS Sans Serif (bitmap font) -> Microsoft Sans Serif (truetype font)
+    // On Windows, we don't support bitmap fonts, but legacy content expects support.
+    // Thus we allow Microsoft Sans Serif as an alternative for the bitmap font MS Sans Serif,
+    // even if the webpage does not specify fallback.
+    // FIXME: Seems unlikely this is still needed. If it was really needed, I think we
+    // would need it on other platforms too.
     case 13:
-        if (familyNameEqualIgnoringCase(familyName, "MS Sans Serif"))
+        if (equalLettersIgnoringASCIICase(familyName, "ms sans serif"))
             return AtomicString("Microsoft Sans Serif", AtomicString::ConstructFromLiteral);
         break;
-
-    // Alias MS Serif (bitmap) -> Times New Roman (truetype font). There's no 
-    // 'Microsoft Sans Serif-equivalent' for Serif.
-    case 8:
-        if (familyNameEqualIgnoringCase(familyName, "MS Serif"))
-            return AtomicString("Times New Roman", AtomicString::ConstructFromLiteral);
+#endif
+    case 15:
+        if (equalLettersIgnoringASCIICase(familyName, "times new roman"))
+            return AtomicString("Times", AtomicString::ConstructFromLiteral);
         break;
-#endif // OS(WINDOWS)
-
     }
 
     return nullAtom;
index c7102e9..16dfd67 100644 (file)
@@ -201,7 +201,11 @@ static bool operator==(const FontCascadeCacheKey& a, const FontCascadeCacheKey&
     if (a.families.size() != b.families.size())
         return false;
     for (unsigned i = 0; i < a.families.size(); ++i) {
-        if (!equalIgnoringCase(a.families[i].impl(), b.families[i].impl()))
+        auto* aImpl = a.families[i].impl();
+        auto* bImpl = b.families[i].impl();
+        if (aImpl == bImpl)
+            continue;
+        if (!aImpl || !bImpl || !CaseFoldingHash::equal(aImpl, bImpl))
             return false;
     }
     return true;
index 5586ddb..1660c43 100644 (file)
@@ -142,6 +142,7 @@ FontWeight FontCascadeDescription::bolderWeight(void) const
 }
 
 #if ENABLE(IOS_TEXT_AUTOSIZING)
+
 bool FontCascadeDescription::familiesEqualForTextAutoSizing(const FontCascadeDescription& other) const
 {
     unsigned thisFamilyCount = familyCount();
@@ -151,12 +152,13 @@ bool FontCascadeDescription::familiesEqualForTextAutoSizing(const FontCascadeDes
         return false;
 
     for (unsigned i = 0; i < thisFamilyCount; ++i) {
-        if (!equalIgnoringCase(familyAt(i), other.familyAt(i)))
+        if (!equalIgnoringASCIICase(familyAt(i), other.familyAt(i)))
             return false;
     }
 
     return true;
 }
+
 #endif // ENABLE(IOS_TEXT_AUTOSIZING)
 
 } // namespace WebCore
index 5ef29f5..579f459 100644 (file)
@@ -854,7 +854,7 @@ MediaPlayer::SupportsType MediaPlayer::supportsType(const MediaEngineSupportPara
     // slow connections. <https://bugs.webkit.org/show_bug.cgi?id=86409>
     if (client && client->mediaPlayerNeedsSiteSpecificHacks()) {
         String host = client->mediaPlayerDocumentHost();
-        if ((host.endsWith(".youtube.com", false) || equalIgnoringCase("youtube.com", host))
+        if ((host.endsWith(".youtube.com", false) || equalLettersIgnoringASCIICase(host, "youtube.com"))
             && (parameters.type.startsWith("video/webm", false) || parameters.type.startsWith("video/x-flv", false)))
             return IsNotSupported;
     }
index 8a35654..c106baf 100644 (file)
@@ -873,12 +873,13 @@ void MediaPlayerPrivateAVFoundationCF::paint(GraphicsContext& context, const Flo
 }
 
 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) && ENABLE(ENCRYPTED_MEDIA_V2)
+
 static bool keySystemIsSupported(const String& keySystem)
 {
-    if (equalIgnoringCase(keySystem, "com.apple.fps") || equalIgnoringCase(keySystem, "com.apple.fps.1_0"))
-        return true;
-    return false;
+    return equalLettersIgnoringASCIICase(keySystem, "com.apple.fps")
+        || equalLettersIgnoringASCIICase(keySystem, "com.apple.fps.1_0");
 }
+
 #endif
 
 static const HashSet<String>& avfMIMETypes()
index 50f0f9b..a290202 100644 (file)
@@ -316,6 +316,16 @@ static bool areStronglyAliased(const String& familyA, const String& familyB)
     return false;
 }
 
+static inline bool isCommonlyUsedGenericFamily(const String& familyNameString)
+{
+    return equalLettersIgnoringASCIICase(familyNameString, "sans")
+        || equalLettersIgnoringASCIICase(familyNameString, "sans-serif")
+        || equalLettersIgnoringASCIICase(familyNameString, "serif")
+        || equalLettersIgnoringASCIICase(familyNameString, "monospace")
+        || equalLettersIgnoringASCIICase(familyNameString, "fantasy")
+        || equalLettersIgnoringASCIICase(familyNameString, "cursive");
+}
+
 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
 {
     // The CSS font matching algorithm (http://www.w3.org/TR/css3-fonts/#font-matching-algorithm)
@@ -368,11 +378,7 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe
     // and allow WebCore to give us the next font on the CSS fallback list. The exceptions are if
     // this family name is a commonly-used generic family, or if the families are strongly-aliased.
     // Checking for a strong alias comes last, since it is slow.
-    if (!equalIgnoringCase(familyNameAfterConfiguration, familyNameAfterMatching)
-        && !(equalIgnoringCase(familyNameString, "sans") || equalIgnoringCase(familyNameString, "sans-serif")
-          || equalIgnoringCase(familyNameString, "serif") || equalIgnoringCase(familyNameString, "monospace")
-          || equalIgnoringCase(familyNameString, "fantasy") || equalIgnoringCase(familyNameString, "cursive"))
-        && !areStronglyAliased(familyNameAfterConfiguration, familyNameAfterMatching))
+    if (!equalIgnoringASCIICase(familyNameAfterConfiguration, familyNameAfterMatching) && !isCommonlyUsedGenericFamily(familyNameString) && !areStronglyAliased(familyNameAfterConfiguration, familyNameAfterMatching))
         return nullptr;
 
     // Verify that this font has an encoding compatible with Fontconfig. Fontconfig currently
index 46d9471..a1a189a 100644 (file)
@@ -89,7 +89,9 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe
 
 bool FontCustomPlatformData::supportsFormat(const String& format)
 {
-    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
+    return equalLettersIgnoringASCIICase(format, "truetype")
+        || equalLettersIgnoringASCIICase(format, "opentype")
+        || equalLettersIgnoringASCIICase(format, "woff");
 }
 
 }
index 8810d31..c94f37e 100644 (file)
@@ -403,8 +403,7 @@ static inline bool isGDIFontWeightBold(LONG gdiFontWeight)
 
 static LONG adjustedGDIFontWeight(LONG gdiFontWeight, const String& family)
 {
-    static AtomicString lucidaStr("Lucida Grande");
-    if (equalIgnoringCase(family, lucidaStr)) {
+    if (equalLettersIgnoringASCIICase(family, "lucida grande")) {
         if (gdiFontWeight == FW_NORMAL)
             return FW_MEDIUM;
         if (gdiFontWeight == FW_BOLD)
@@ -563,10 +562,7 @@ Vector<FontTraitsMask> FontCache::getTraitsInFamily(const AtomicString& familyNa
 
 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
 {
-    bool isLucidaGrande = false;
-    static AtomicString lucidaStr("Lucida Grande");
-    if (equalIgnoringCase(family, lucidaStr))
-        isLucidaGrande = true;
+    bool isLucidaGrande = equalLettersIgnoringASCIICase(family, "lucida grande");
 
     bool useGDI = fontDescription.renderingMode() == FontRenderingMode::Alternate && !isLucidaGrande;
 
index 9732073..7692daf 100644 (file)
@@ -96,7 +96,9 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe
 
 bool FontCustomPlatformData::supportsFormat(const String& format)
 {
-    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
+    return equalLettersIgnoringASCIICase(format, "truetype")
+        || equalLettersIgnoringASCIICase(format, "opentype")
+        || equalLettersIgnoringASCIICase(format, "woff");
 }
 
 }
index 809700d..4413428 100644 (file)
@@ -97,7 +97,9 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe
 
 bool FontCustomPlatformData::supportsFormat(const String& format)
 {
-    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
+    return equalLettersIgnoringASCIICase(format, "truetype")
+        || equalLettersIgnoringASCIICase(format, "opentype")
+        || equalLettersIgnoringASCIICase(format, "woff");
 }
 
 }
index 868a8e2..e2ebd1b 100644 (file)
     // Find if we should use a specific voice based on the voiceURI in utterance.
     // Otherwise, find the voice that matches the language. The Mac doesn't have a default voice per language, so the first
     // one will have to do.
-    Vector<RefPtr<WebCore::PlatformSpeechSynthesisVoice>> voiceList = m_synthesizerObject->voiceList();
-    size_t voiceListSize = voiceList.size();
     
     WebCore::PlatformSpeechSynthesisVoice* utteranceVoice = utterance->voice();
     // If no voice was specified, try to match by language.
     if (!utteranceVoice && !utterance->lang().isEmpty()) {
-        for (size_t k = 0; k < voiceListSize; k++) {
-            if (equalIgnoringCase(utterance->lang(), voiceList[k]->lang())) {
-                utteranceVoice = voiceList[k].get();
-                if (voiceList[k]->isDefault())
+        for (auto& voice : m_synthesizerObject->voiceList()) {
+            if (equalIgnoringASCIICase(utterance->lang(), voice->lang())) {
+                utteranceVoice = voice.get();
+                if (voice->isDefault())
                     break;
             }
         }
index 8126166..f99c6b1 100644 (file)
@@ -62,8 +62,8 @@ const char* const headerPrefixesToIgnoreAfterRevalidation[] = {
 
 static inline bool shouldUpdateHeaderAfterRevalidation(const String& header)
 {
-    for (size_t i = 0; i < WTF_ARRAY_LENGTH(headersToIgnoreAfterRevalidation); i++) {
-        if (equalIgnoringCase(header, headersToIgnoreAfterRevalidation[i]))
+    for (auto& headerToIgnore : headersToIgnoreAfterRevalidation) {
+        if (equalIgnoringASCIICase(header, headerToIgnore))
             return false;
     }
     for (size_t i = 0; i < WTF_ARRAY_LENGTH(headerPrefixesToIgnoreAfterRevalidation); i++) {
index 77426fa..4df0ea6 100644 (file)
@@ -368,17 +368,17 @@ static bool isAppendableHeader(const String &key)
         "vary",
         "via",
         "warning",
-        "www-authenticate",
-        0
+        "www-authenticate"
     };
 
     // Custom headers start with 'X-', and need no further checking.
     if (key.startsWith("x-", /* caseSensitive */ false))
         return true;
 
-    for (unsigned i = 0; appendableHeaders[i]; ++i)
-        if (equalIgnoringCase(key, appendableHeaders[i]))
+    for (auto& header : appendableHeaders) {
+        if (equalIgnoringASCIICase(key, header))
             return true;
+    }
 
     return false;
 }
index 79524a5..e5f3e64 100644 (file)
@@ -436,7 +436,7 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
 
     if (redirectResponse.httpStatusCode() == 307) {
         String lastHTTPMethod = d->m_lastHTTPMethod;
-        if (!equalIgnoringCase(lastHTTPMethod, request.httpMethod())) {
+        if (!equalIgnoringASCIICase(lastHTTPMethod, request.httpMethod())) {
             request.setHTTPMethod(lastHTTPMethod);
     
             FormData* body = d->m_firstRequest.httpBody();
index 4c9161c..f716630 100644 (file)
@@ -60,7 +60,7 @@ static RetainPtr<NSLocale> determineLocale(const String& locale)
     RetainPtr<NSLocale> currentLocale = [NSLocale currentLocale];
     String currentLocaleLanguage = languageFromLocale(String([currentLocale.get() localeIdentifier]));
     String localeLanguage = languageFromLocale(locale);
-    if (equalIgnoringCase(currentLocaleLanguage, localeLanguage))
+    if (equalIgnoringASCIICase(currentLocaleLanguage, localeLanguage))
         return currentLocale;
     // It seems initWithLocaleIdentifier accepts dash-separated locale identifier.
      return adoptNS([[NSLocale alloc] initWithLocaleIdentifier:locale]);
index 140a8e9..eb170b7 100644 (file)
@@ -119,8 +119,7 @@ static LCID WINAPI convertLocaleNameToLCID(LPCWSTR name, DWORD)
 
 static LCID LCIDFromLocaleInternal(LCID userDefaultLCID, const String& userDefaultLanguageCode, LocaleNameToLCIDPtr localeNameToLCID, String& locale)
 {
-    String localeLanguageCode = extractLanguageCode(locale);
-    if (equalIgnoringCase(localeLanguageCode, userDefaultLanguageCode))
+    if (equalLettersIgnoringASCIICase(extractLanguageCode(locale), userDefaultLanguageCode))
         return userDefaultLCID;
     return localeNameToLCID(locale.charactersWithNullTermination().data(), 0);
 }
index 2a27755..964f7b1 100644 (file)
@@ -818,7 +818,7 @@ void SVGToOTFFontConverter::appendArabicReplacementSubtable(size_t subtableRecor
     for (auto& pair : m_codepointsToIndicesMap) {
         for (auto glyphIndex : pair.value) {
             auto& glyph = m_glyphs[glyphIndex];
-            if (glyph.glyphElement && equalIgnoringCase(glyph.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), arabicForm))
+            if (glyph.glyphElement && equalIgnoringASCIICase(glyph.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), arabicForm))
                 arabicFinalReplacements.append(std::make_pair(pair.value[0], glyphIndex));
         }
     }
index 570bbdc..f034007 100644 (file)
@@ -405,7 +405,7 @@ String XMLHttpRequest::uppercaseKnownHTTPMethod(const String& method)
 {
     const char* const methods[] = { "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT" };
     for (auto* value : methods) {
-        if (equalIgnoringCase(method, value)) {
+        if (equalIgnoringASCIICase(method, value)) {
             // Don't bother allocating a new string if it's already all uppercase.
             if (method == value)
                 break;
index d6821de..a66c471 100644 (file)
@@ -596,7 +596,7 @@ Value FunLang::evaluate() const
 
     String langValue = languageAttribute->value();
     while (true) {
-        if (equalIgnoringCase(langValue, lang))
+        if (equalIgnoringASCIICase(langValue, lang))
             return true;
 
         // Remove suffixes one by one.
index 88958d2..0ae3403 100644 (file)
@@ -204,7 +204,7 @@ inline bool nodeMatchesBasicTest(Node& node, Step::Axis axis, const Step::NodeTe
             if (is<HTMLDocument>(node.document())) {
                 if (is<HTMLElement>(node)) {
                     // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively.
-                    return equalIgnoringCase(downcast<HTMLElement>(node).localName(), name) && (namespaceURI.isNull() || namespaceURI == node.namespaceURI());
+                    return equalIgnoringASCIICase(downcast<HTMLElement>(node).localName(), name) && (namespaceURI.isNull() || namespaceURI == node.namespaceURI());
                 }
                 // An expression without any prefix shouldn't match no-namespace nodes (because HTML5 says so).
                 return downcast<Element>(node).hasLocalName(name) && namespaceURI == node.namespaceURI() && !namespaceURI.isNull();
index 4c52ba4..3ee1d0b 100644 (file)
@@ -1,3 +1,14 @@
+2016-01-28  Darin Adler  <darin@apple.com>
+
+        Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
+        https://bugs.webkit.org/show_bug.cgi?id=153411
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (parameterValue): Use equalIgnoringASCIICase. No behavior change because the
+        only name we ever search for with this is "pluginspage".
+
 2016-01-27  Enrica Casucci  <enrica@apple.com>
 
         Cache results of data detection in the UI process when load completes.
index 19bc54b..b9174db 100644 (file)
@@ -1726,12 +1726,12 @@ static NSMutableArray* kit(const Vector<String>& vector)
     return array;
 }
 
-static String parameterValue(const Vector<String>& paramNames, const Vector<String>& paramValues, const String& name)
+static String parameterValue(const Vector<String>& paramNames, const Vector<String>& paramValues, const char* name)
 {
     size_t size = paramNames.size();
     ASSERT(size == paramValues.size());
     for (size_t i = 0; i < size; ++i) {
-        if (equalIgnoringCase(paramNames[i], name))
+        if (equalIgnoringASCIICase(paramNames[i], name))
             return paramValues[i];
     }
     return String();
index 025bdf2..48f8ff2 100644 (file)
@@ -1,3 +1,27 @@
+2016-01-28  Darin Adler  <darin@apple.com>
+
+        Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
+        https://bugs.webkit.org/show_bug.cgi?id=153411
+
+        Reviewed by Ryosuke Niwa.
+
+        * Plugins/PluginDatabase.cpp:
+        (WebCore::PluginDatabase::MIMETypeForExtension): Use equalIgnoringASCIICase to compare
+        file extensions.
+        * Plugins/PluginDatabaseWin.cpp:
+        (WebCore::PluginDatabase::getPluginPathsInDirectories): Use equalLettersIgnoringASCIICase
+        to compare filenames.
+        * Plugins/PluginPackageWin.cpp:
+        (WebCore::PluginPackage::isPluginBlacklisted): Use equalLettersIgnoringASCIICase to
+        compare DLL filenames.
+        * Plugins/PluginStream.cpp:
+        (WebCore::PluginStream::destroyStream): Use equalLettersIgnoringASCIICase to check HTTP method.
+        * Plugins/PluginView.cpp:
+        (WebCore::PluginView::setParameters): Use equalLettersIgnoringASCIICase to check
+        plug-in parameter name.
+        * WebView.cpp:
+        (WebView::canHandleRequest): Use URL::protocolIs instead of equalIgnoringCase.
+
 2016-01-22  Ryosuke Niwa  <rniwa@webkit.org>
 
         document.createElement should be able to create a custom element
index 0ee013d..1a0c7e8 100644 (file)
@@ -248,7 +248,7 @@ String PluginDatabase::MIMETypeForExtension(const String& extension) const
             const Vector<String>& extensions = mime_it->value;
             bool foundMapping = false;
             for (unsigned i = 0; i < extensions.size(); i++) {
-                if (equalIgnoringCase(extensions[i], extension)) {
+                if (equalIgnoringASCIICase(extensions[i], extension)) {
                     PluginPackage* plugin = (*it).get();
 
                     if (preferredPlugin && PluginPackage::equal(*plugin, *preferredPlugin))
index cdc6cf3..62516bb 100644 (file)
@@ -94,7 +94,7 @@ void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const
 
             String filename = String(findFileData.cFileName, wcslen(findFileData.cFileName));
             if ((!filename.startsWith("np", false) || !filename.endsWith("dll", false)) &&
-                (!equalIgnoringCase(filename, "Plugin.dll") || !it->endsWith("Shockwave 10", false)))
+                (!equalLettersIgnoringASCIICase(filename, "plugin.dll") || !it->endsWith("Shockwave 10", false)))
                 continue;
 
             String fullPath = *it + "\\" + filename;
@@ -103,9 +103,9 @@ void PluginDatabase::getPluginPathsInDirectories(HashSet<String>& paths) const
 
             paths.add(fullPath);
 
-            if (equalIgnoringCase(filename, "npdsplay.dll"))
+            if (equalLettersIgnoringASCIICase(filename, "npdsplay.dll"))
                 oldWMPPluginPath = fullPath;
-            else if (equalIgnoringCase(filename, "np-mswmp.dll"))
+            else if (equalLettersIgnoringASCIICase(filename, "np-mswmp.dll"))
                 newWMPPluginPath = fullPath;
 
         } while (FindNextFileW(hFind, &findFileData) != 0);
index a85257d..c2bbcc4 100644 (file)
@@ -71,10 +71,10 @@ bool PluginPackage::isPluginBlacklisted()
 
         if (compareFileVersion(slPluginMinRequired) < 0)
             return true;
-    } else if (equalIgnoringCase(fileName(), "npmozax.dll")) {
+    } else if (equalLettersIgnoringASCIICase(fileName(), "npmozax.dll")) {
         // Bug 15217: Mozilla ActiveX control complains about missing xpcom_core.dll
         return true;
-    } else if (equalIgnoringCase(fileName(), "npwpf.dll")) {
+    } else if (equalLettersIgnoringASCIICase(fileName(), "npwpf.dll")) {
         // Bug 57119: Microsoft Windows Presentation Foundation (WPF) plug-in complains about missing xpcom.dll
         return true;
     } else if (name() == "Yahoo Application State Plugin") {
index e979598..d2b5c91 100644 (file)
@@ -294,7 +294,7 @@ void PluginStream::destroyStream()
         if (m_loader)
             m_loader->setDefersLoading(true);
         if (!newStreamCalled && m_quirks.contains(PluginQuirkFlashURLNotifyBug) &&
-            equalIgnoringCase(m_resourceRequest.httpMethod(), "POST")) {
+            equalLettersIgnoringASCIICase(m_resourceRequest.httpMethod(), "post")) {
             m_transferMode = NP_NORMAL;
             m_stream.url = "";
             m_stream.notifyData = m_notifyData;
index 98542eb..b3344aa 100644 (file)
@@ -715,7 +715,7 @@ void PluginView::setParameters(const Vector<String>& paramNames, const Vector<St
     m_paramValues = reinterpret_cast<char**>(fastMalloc(sizeof(char*) * size));
 
     for (unsigned i = 0; i < size; i++) {
-        if (m_plugin->quirks().contains(PluginQuirkRemoveWindowlessVideoParam) && equalIgnoringCase(paramNames[i], "windowlessvideo"))
+        if (m_plugin->quirks().contains(PluginQuirkRemoveWindowlessVideoParam) && equalLettersIgnoringASCIICase(paramNames[i], "windowlessvideo"))
             continue;
 
         if (paramNames[i] == "pluginspage")
index 03b4413..425d0a4 100644 (file)
@@ -1365,16 +1365,12 @@ void WebView::closeWindow()
 
 bool WebView::canHandleRequest(const WebCore::ResourceRequest& request)
 {
-    // On the mac there's an about url protocol implementation but CFNetwork doesn't have that.
-    if (equalIgnoringCase(String(request.url().protocol()), "about"))
-        return true;
-
 #if USE(CFNETWORK)
-    if (CFURLProtocolCanHandleRequest(request.cfURLRequest(UpdateHTTPBody)))
+    // On the Mac there's an about URL protocol implementation but Windows CFNetwork doesn't have that.
+    if (request.url().protocolIs("about"))
         return true;
 
-    // FIXME: Mac WebKit calls _representationExistsForURLScheme here
-    return false;
+    return CFURLProtocolCanHandleRequest(request.cfURLRequest(UpdateHTTPBody));
 #else
     return true;
 #endif
index 572dac9..0edea49 100644 (file)
@@ -1,3 +1,23 @@
+2016-01-28  Darin Adler  <darin@apple.com>
+
+        Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
+        https://bugs.webkit.org/show_bug.cgi?id=153411
+
+        Reviewed by Ryosuke Niwa.
+
+        * Shared/API/c/WKString.cpp:
+        (WKStringIsEqualToUTF8CStringIgnoringCase): Use equalIgnoringASCIICase.
+        This is a change in behavior for callers who passed non-ASCII letters to
+        this function and expected case insensitive comparison.
+
+        * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
+        (WebKit::PDFPlugin::streamDidReceiveResponse): Use equalIgnoringASCIICase.
+        No change in behavior because this is just checking a fixed ASCII MIME type.
+        (WebKit::PDFPlugin::manualStreamDidReceiveResponse): Ditto.
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::streamDidReceiveResponse): Ditto.
+        (WebKit::PDFPlugin::manualStreamDidReceiveResponse): Ditto.
+
 2016-01-27  Alex Christensen  <achristensen@webkit.org>
 
         Fix CMake build after r195722.
index 49adbf9..305dd01 100644 (file)
@@ -102,13 +102,16 @@ bool WKStringIsEqual(WKStringRef aRef, WKStringRef bRef)
 
 bool WKStringIsEqualToUTF8CString(WKStringRef aRef, const char* b)
 {
+    // FIXME: Should we add a fast path that avoids memory allocation when the string is all ASCII?
+    // FIXME: We can do even the general case more efficiently if we write a function in StringView that understands UTF-8 C strings.
     return toImpl(aRef)->stringView() == WTF::String::fromUTF8(b);
 }
 
 bool WKStringIsEqualToUTF8CStringIgnoringCase(WKStringRef aRef, const char* b)
 {
-    // FIXME: Instead of copying the string here, we should add a version of equalIgnoringCase that takes StringViews.
-    return equalIgnoringCase(toImpl(aRef)->string(), WTF::String::fromUTF8(b));
+    // FIXME: Should we add a fast path that avoids memory allocation when the string is all ASCII?
+    // FIXME: We can do even the general case more efficiently if we write a function in StringView that understands UTF-8 C strings.
+    return equalIgnoringASCIICase(toImpl(aRef)->stringView(), WTF::String::fromUTF8(b));
 }
 
 WKStringRef WKStringCreateWithJSString(JSStringRef jsStringRef)
index 551ef19..4bebbe4 100644 (file)
@@ -944,7 +944,7 @@ void PDFPlugin::streamDidReceiveResponse(uint64_t streamID, const URL&, uint32_t
 
     m_suggestedFilename = suggestedFilename;
 
-    if (equalIgnoringCase(mimeType, postScriptMIMEType))
+    if (equalIgnoringASCIICase(mimeType, postScriptMIMEType))
         m_isPostScript = true;
 }
 
@@ -977,7 +977,7 @@ void PDFPlugin::manualStreamDidReceiveResponse(const URL& responseURL, uint32_t
 {
     m_suggestedFilename = suggestedFilename;
 
-    if (equalIgnoringCase(mimeType, postScriptMIMEType))
+    if (equalIgnoringASCIICase(mimeType, postScriptMIMEType))
         m_isPostScript = true;
 }
 
index bb6d5ed..af19f31 100644 (file)
@@ -695,7 +695,7 @@ void PDFPlugin::streamDidReceiveResponse(uint64_t streamID, const URL&, uint32_t
 
     m_suggestedFilename = suggestedFilename;
 
-    if (equalIgnoringCase(mimeType, postScriptMIMEType))
+    if (equalIgnoringASCIICase(mimeType, postScriptMIMEType))
         m_isPostScript = true;
 }
 
@@ -728,7 +728,7 @@ void PDFPlugin::manualStreamDidReceiveResponse(const URL& responseURL, uint32_t
 {
     m_suggestedFilename = suggestedFilename;
 
-    if (equalIgnoringCase(mimeType, postScriptMIMEType))
+    if (equalIgnoringASCIICase(mimeType, postScriptMIMEType))
         m_isPostScript = true;
 }
 
index d6b35fe..c8b39f0 100644 (file)
@@ -1,3 +1,23 @@
+2016-01-28  Darin Adler  <darin@apple.com>
+
+        Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
+        https://bugs.webkit.org/show_bug.cgi?id=153411
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/do-webcore-rename: Removed rename of equalIgnoringCase since we
+        have removed the function instead.
+
+        * TestWebKitAPI/Tests/WTF/StringImpl.cpp:
+        (TestWebKitAPI::TEST): Updated test since nullptr is now ambiguous since we
+        added overloads for const char*.
+
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::isPressActionSupported): Use equalLettersIgnoringASCIICase.
+        (WTR::AccessibilityUIElement::hasPopup): Ditto.
+        * WebKitTestRunner/cocoa/CrashReporterInfo.mm:
+        (WTR::testPathFromURL): Ditto.
+
 2016-01-28  Konstantin Tokarev  <annulen@yandex.ru>
 
         [webkitdirs] Clarify logic behind is{PortName} functions.
index c830e22..f0ccb21 100755 (executable)
@@ -128,8 +128,6 @@ my %renamesContemplatedForTheFuture = (
     "runtime_object" => "BridgedObject",
     "objc_runtime" => "ObjCBridge",
 
-    "equalIgnoringCase" => "equalFoldingCase",
-
     "WTF_UNICODE_H" => "Unicode_h",
     "WTF_UNICODE_ICU_H" => "UnicodeICU_h",
     "UnicodeIcu" => "UnicodeICU",
index 75fadf8..01f36f7 100644 (file)
@@ -140,9 +140,10 @@ TEST(WTF, StringImplEqualIgnoringASCIICaseBasic)
 TEST(WTF, StringImplEqualIgnoringASCIICaseWithNull)
 {
     RefPtr<StringImpl> reference = StringImpl::createFromLiteral("aBcDeFG");
-    ASSERT_FALSE(equalIgnoringASCIICase(nullptr, reference.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(reference.get(), nullptr));
-    ASSERT_TRUE(equalIgnoringASCIICase(nullptr, nullptr));
+    StringImpl* nullStringImpl = nullptr;
+    ASSERT_FALSE(equalIgnoringASCIICase(nullStringImpl, reference.get()));
+    ASSERT_FALSE(equalIgnoringASCIICase(reference.get(), nullStringImpl));
+    ASSERT_TRUE(equalIgnoringASCIICase(nullStringImpl, nullStringImpl));
 }
 
 TEST(WTF, StringImplEqualIgnoringASCIICaseWithEmpty)
index e7db2c9..1c873c9 100644 (file)
@@ -317,17 +317,17 @@ const gchar* roleToString(AtkObject* object)
 #if ATK_CHECK_VERSION(2, 11, 3)
     if (role == ATK_ROLE_LANDMARK) {
         String xmlRolesValue = getAttributeSetValueForId(object, ObjectAttributeType, "xml-roles");
-        if (equalIgnoringCase(xmlRolesValue, "banner"))
+        if (equalLettersIgnoringASCIICase(xmlRolesValue, "banner"))
             return landmarkStringBanner;
-        if (equalIgnoringCase(xmlRolesValue, "complementary"))
+        if (equalLettersIgnoringASCIICase(xmlRolesValue, "complementary"))
             return landmarkStringComplementary;
-        if (equalIgnoringCase(xmlRolesValue, "contentinfo"))
+        if (equalLettersIgnoringASCIICase(xmlRolesValue, "contentinfo"))
             return landmarkStringContentinfo;
-        if (equalIgnoringCase(xmlRolesValue, "main"))
+        if (equalLettersIgnoringASCIICase(xmlRolesValue, "main"))
             return landmarkStringMain;
-        if (equalIgnoringCase(xmlRolesValue, "navigation"))
+        if (equalLettersIgnoringASCIICase(xmlRolesValue, "navigation"))
             return landmarkStringNavigation;
-        if (equalIgnoringCase(xmlRolesValue, "search"))
+        if (equalLettersIgnoringASCIICase(xmlRolesValue, "search"))
             return landmarkStringSearch;
     }
 #endif
@@ -1350,7 +1350,7 @@ bool AccessibilityUIElement::isPressActionSupported()
         return false;
 
     const gchar* actionName = atk_action_get_name(ATK_ACTION(m_element.get()), 0);
-    return equalIgnoringCase(actionName, String("press")) || equalIgnoringCase(actionName, String("jump"));
+    return equalLettersIgnoringASCIICase(actionName, "press") || equalLettersIgnoringASCIICase(actionName, "jump");
 }
 
 bool AccessibilityUIElement::isIncrementActionSupported()
@@ -1788,7 +1788,7 @@ bool AccessibilityUIElement::hasPopup() const
         return false;
 
     String hasPopupValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "haspopup");
-    return equalIgnoringCase(hasPopupValue, "true");
+    return equalLettersIgnoringASCIICase(hasPopupValue, "true");
 }
 
 void AccessibilityUIElement::takeFocus()
index 1dc4e2b..358ccd2 100644 (file)
@@ -45,7 +45,7 @@ static String testPathFromURL(WKURLRef url)
     String schemeString(schemeCFString.get());
     String pathString(pathCFString.get());
     
-    if (equalIgnoringCase(schemeString, "file")) {
+    if (equalLettersIgnoringASCIICase(schemeString, "file")) {
         String layoutTests("/LayoutTests/");
         size_t layoutTestsOffset = pathString.find(layoutTests);
         if (layoutTestsOffset == notFound)
@@ -54,7 +54,7 @@ static String testPathFromURL(WKURLRef url)
         return pathString.substring(layoutTestsOffset + layoutTests.length());
     }
 
-    if (!equalIgnoringCase(schemeString, "http") && !equalIgnoringCase(schemeString, "https"))
+    if (!equalLettersIgnoringASCIICase(schemeString, "http") && !equalLettersIgnoringASCIICase(schemeString, "https"))
         return String();
 
     RetainPtr<CFStringRef> hostCFString = adoptCF(CFURLCopyHostName(cfURL.get()));