haikuwebkit/LayoutTests/fast/css/implicitly-case-insensitive...

15 lines
481 B
HTML
Raw Permalink Normal View History

CSS JIT: add support for case-insensitive attribute matching https://bugs.webkit.org/show_bug.cgi?id=141880 Reviewed by Andreas Kling. Source/WebCore: The value matching now has 3 cases: 1) Case-sensitive. 2) Case-insensitive. 3) Legacy HTML Case-insensitive. The information to determine the case is split over 2 source: -To know if explicit case-insensitive is needed, we need to ask the selector for attributeValueMatchingIsCaseInsensitive(). -To know if the legacy HTML behavior is needed, we need to test the attribute name filter with HTMLDocument::isCaseSensitiveAttribute(). I decided to perform all those checks at the fragment creation step. This makes the register requirements and code generation more explicit. From there, everything is easy: switch() on the type of matching needed, and generate the code. The new case-insensitive case is a simplified version of the legacy HTML behavior without runtime check for the element type. Tests: fast/css/implicitly-case-insensitive-attribute-with-svg.html fast/selectors/case-insensitive-attribute-register-requirement-1.html fast/selectors/case-insensitive-attribute-register-requirement-2.html fast/selectors/querySelector-explicit-case-insensitive-attribute-match-with-svg.html * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::attributeSelectorCaseSensitivity): (WebCore::SelectorCompiler::AttributeMatchingInfo::AttributeMatchingInfo): (WebCore::SelectorCompiler::AttributeMatchingInfo::attributeCaseSensitivity): (WebCore::SelectorCompiler::AttributeMatchingInfo::canDefaultToCaseSensitiveValueMatch): Deleted. (WebCore::SelectorCompiler::constructFragmentsInternal): Compute the type of value matching and store it on the AttributeMatchingInfo when creating the fragment. (WebCore::SelectorCompiler::minimumRegisterRequirements): (WebCore::SelectorCompiler::attributeValueTestingRequiresExtraRegister): (WebCore::SelectorCompiler::attributeValueTestingRequiresCaseFoldingRegister): Deleted. In general, AttributeCaseSensitivity::CaseInsensitive does not require an extra register. I have made an exception for generateElementAttributeValueExactMatching() for simplicity. I use that register to load the StringImpl of the attribute being tested, that way I can use WTF::equalIgnoringCaseNonNull() directly. (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueMatching): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching): Matching itself is just function calls. Unlike AttributeCaseSensitivity::HTMLLegacyCaseInsensitive, the behavior is consistent between XML and HTML. LayoutTests: * fast/css/case-insensitive-attribute-with-svg-expected.html: * fast/css/case-insensitive-attribute-with-svg.html: * fast/css/implicitly-case-insensitive-attribute-with-svg-expected.html: Copied from LayoutTests/fast/css/case-insensitive-attribute-with-svg-expected.html. * fast/css/implicitly-case-insensitive-attribute-with-svg.html: Copied from LayoutTests/fast/css/case-insensitive-attribute-with-svg.html. I renamed the HTML legacy case-insensitive behavior to separate it from the new selector. * fast/selectors/querySelector-explicit-case-insensitive-attribute-match-with-svg-expected.txt: Added. * fast/selectors/querySelector-explicit-case-insensitive-attribute-match-with-svg.html: Added. Mixing explicit case-insensitive with implicit. * fast/selectors/case-insensitive-attribute-register-requirement-1-expected.txt: Added. * fast/selectors/case-insensitive-attribute-register-requirement-1.html: Added. * fast/selectors/case-insensitive-attribute-register-requirement-2-expected.txt: Added. * fast/selectors/case-insensitive-attribute-register-requirement-2.html: Added. The usual register allocation stress tests. Canonical link: https://commits.webkit.org/159963@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-02-24 03:31:08 +00:00
<!DOCTYPE html>
<html>
<head>
<title>Case Insensitive and Case Sensitive Attribute matching</title>
</head>
<body>
<p>On success, there should be a large green surface visible and no red anywhere.</p>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100" style="margin-top:50px">
<rect x="50" y="0" width="50" height="50" style="fill:green" />
<rect x="0" y="0" width="50" height="50" style="fill:green" />
</svg>
</body>
</html>