Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
CSS: fix the case-insensitive matching of the attribute selectors Beg…
…in, End and Hyphen https://bugs.webkit.org/show_bug.cgi?id=142715 Reviewed by Brent Fulgham. Source/WebCore: Fix attribute matching with: -Begin: [a^=b]. -End: [a$=b]. -Hyphen: [a|=b]. Tests: fast/selectors/attribute-endswith-value-matching-is-ascii-case-insensitive.html fast/selectors/attribute-hyphen-value-matching-is-ascii-case-insensitive.html fast/selectors/attribute-startswith-value-matching-is-ascii-case-insensitive.html * css/SelectorChecker.cpp: (WebCore::attributeValueMatches): I forgot to change CSSSelector::Exact in my last patch. The tests could not catch that since we use the CSS JIT almost everywhere. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::attributeValueBeginsWith): (WebCore::SelectorCompiler::attributeValueEndsWith): (WebCore::SelectorCompiler::attributeValueMatchHyphenRule): Source/WTF: Add the necessary infrastructure to test startsWith() and endsWith() with ASCII case-insentive comparisons. * wtf/text/AtomicString.h: (WTF::AtomicString::startsWith): (WTF::AtomicString::startsWithIgnoringASCIICase): (WTF::AtomicString::endsWith): (WTF::AtomicString::endsWithIgnoringASCIICase): * wtf/text/StringCommon.h: (WTF::loadUnaligned): (WTF::equal): I moved the low level equal() code from StringImpl to StringCommon since it is used by both StringImpl and StringView. (WTF::equalCommon): (WTF::equalIgnoringASCIICaseCommon): Ideally we should drop the "Common" part of the name but StringView wants this inline for some reason. I prefered keeping the current behavior since I don't know how StringView's matching performance was evaluated. (WTF::startsWith): (WTF::startsWithIgnoringASCIICase): (WTF::endsWith): (WTF::endsWithIgnoringASCIICase): Make all that code shared between StringView and Stringimpl. * wtf/text/StringImpl.cpp: (WTF::StringImpl::startsWith): (WTF::StringImpl::startsWithIgnoringASCIICase): (WTF::StringImpl::endsWith): (WTF::StringImpl::endsWithIgnoringASCIICase): (WTF::equal): (WTF::stringImplContentEqual): Deleted. * wtf/text/StringImpl.h: (WTF::loadUnaligned): Deleted. (WTF::equal): Deleted. * wtf/text/StringView.cpp: (WTF::StringView::startsWith): (WTF::StringView::startsWithIgnoringASCIICase): (WTF::StringView::endsWith): (WTF::StringView::endsWithIgnoringASCIICase): * wtf/text/StringView.h: Since those are new, we can safely make them out-of-line and evaluate the inlining impact as needed. * wtf/text/WTFString.h: (WTF::String::startsWithIgnoringASCIICase): (WTF::String::endsWith): (WTF::String::endsWithIgnoringASCIICase): Tools: * TestWebKitAPI/Tests/WTF/StringImpl.cpp: (TestWebKitAPI::TEST): LayoutTests: * fast/selectors/attribute-endswith-value-matching-is-ascii-case-insensitive-expected.txt: Added. * fast/selectors/attribute-endswith-value-matching-is-ascii-case-insensitive.html: Added. * fast/selectors/attribute-hyphen-value-matching-is-ascii-case-insensitive-expected.txt: Added. * fast/selectors/attribute-hyphen-value-matching-is-ascii-case-insensitive.html: Added. * fast/selectors/attribute-startswith-value-matching-is-ascii-case-insensitive-expected.txt: Added. * fast/selectors/attribute-startswith-value-matching-is-ascii-case-insensitive.html: Added. Canonical link: https://commits.webkit.org/160728@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information