Change the exact attribute matching to be ASCII case-insensitive
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Mar 2015 19:43:18 +0000 (19:43 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Mar 2015 19:43:18 +0000 (19:43 +0000)
commit05c24303a2645046648a2e8dcf9ef8be1e59ac0b
tree7af53b04c2832df72c58cd5d0a665f553aa4f14b
parent2d571637df374d9b39ed828865d42b15d3dcb9a6
Change the exact attribute matching to be ASCII case-insensitive
https://bugs.webkit.org/show_bug.cgi?id=142609

Patch by Benjamin Poulain <bpoulain@apple.com> on 2015-03-15
Reviewed by Darin Adler.

Source/WebCore:

In CSS, testing attribute values should be ASCII case-insensitive,
previously we were using full unicode case conversion.

Test: fast/selectors/attribute-exact-value-match-is-ascii-case-insensitive.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseKeyframeSelector):
The CSS parser has its own fast version for ASCII case insensitive.
This code was using the general equalIgnoringASCIICase() which was causing name conflicts,
change that to the normal CSS parser version.

* css/SelectorCheckerTestFunctions.h:
(WebCore::equalIgnoringASCIICase): Deleted.
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching):

Source/WTF:

Add support for ASCII case insensitive comparisons to all the string
classes.

The new file StringCommon.h has the common algorithm to avoid repeating
the same code with different types.

* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* wtf/ASCIICType.h:
(WTF::toASCIILower):
* wtf/CMakeLists.txt:
* wtf/text/AtomicString.h:
(WTF::equalIgnoringASCIICase):
* wtf/text/StringCommon.h: Added.
(WTF::equalIgnoringASCIICase):
(WTF::equalIgnoringASCIICaseCommon):
* wtf/text/StringImpl.cpp:
(WTF::equalIgnoringASCIICase):
(WTF::equalIgnoringASCIICaseNonNull):
(WTF::StringImpl::utf8Impl):
(WTF::StringImpl::defaultWritingDirection): Deleted.
(WTF::StringImpl::adopt): Deleted.
(WTF::StringImpl::sizeInBytes): Deleted.
(WTF::putUTF8Triple): Deleted.
(WTF::StringImpl::utf8): Deleted.
* wtf/text/StringImpl.h:
(WTF::StringImpl::isSubString): Deleted.
(WTF::find): Deleted.

Tools:

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
* TestWebKitAPI/Tests/WTF/StringView.cpp:

LayoutTests:

* fast/selectors/attribute-exact-value-match-is-ascii-case-insensitive-expected.txt: Added.
* fast/selectors/attribute-exact-value-match-is-ascii-case-insensitive.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181512 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/selectors/attribute-exact-value-match-is-ascii-case-insensitive-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/attribute-exact-value-match-is-ascii-case-insensitive.html [new file with mode: 0644]
Source/WTF/ChangeLog
Source/WTF/WTF.vcxproj/WTF.vcxproj
Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/ASCIICType.h
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringCommon.h [new file with mode: 0644]
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/StringView.h
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/SelectorCheckerTestFunctions.h
Source/WebCore/cssjit/SelectorCompiler.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp
Tools/TestWebKitAPI/Tests/WTF/StringView.cpp