Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ff2f768ad68a9b40d3497b3c17ee29d6ecce4560
https://github.com/WebKit/WebKit/commit/ff2f768ad68a9b40d3497b3c17ee29d6ecce4560
Author: Antti Koivisto <[email protected]>
Date: 2026-05-14 (Thu, 14 May 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/selectors/attribute-selectors/attribute-case/cssom-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/selectors/attribute-selectors/attribute-case/semantics-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/selectors/attribute-selectors/attribute-case/syntax-expected.txt
M Source/WebCore/css/CSSSelector.cpp
M Source/WebCore/css/CSSSelector.h
M Source/WebCore/css/SelectorChecker.cpp
M Source/WebCore/css/parser/CSSSelectorParser.cpp
M Source/WebCore/cssjit/SelectorCompiler.cpp
M Source/WebCore/dom/SelectorQuery.cpp
Log Message:
-----------
Implement case sensitive modifier (s) in attribute selector
https://bugs.webkit.org/show_bug.cgi?id=272573
rdar://126331481
Reviewed by Anne van Kesteren.
https://drafts.csswg.org/selectors/#attribute-case
An explicit 's' modifier forces case-sensitive matching regardless of
HTML's legacy case-insensitive attribute list, complementing the
existing 'i' modifier.
Extend CSSSelector::AttributeMatchType from two values to three:
Default (no flag, honors HTML quirk), CaseInsensitive (i), and
CaseSensitive (s). The value is stored in a single 2-bit field exposed
via a new attributeMatchType() accessor, replacing the earlier boolean
predicate pair. Matching call sites switch on the enum; explicit 's'
short-circuits the HTML legacy list.
*
LayoutTests/imported/w3c/web-platform-tests/css/selectors/attribute-selectors/attribute-case/cssom-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/selectors/attribute-selectors/attribute-case/semantics-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/selectors/attribute-selectors/attribute-case/syntax-expected.txt:
Rebaseline: 620 previously-failing 's' flag subtests now pass.
* Source/WebCore/css/CSSSelector.h:
(WebCore::CSSSelector::CSSSelector):
(WebCore::CSSSelector::attributeMatchType const):
(WebCore::CSSSelector::attributeValueMatchingIsCaseInsensitive const): Deleted.
Replace the two bit fields with one 2-bit m_attributeMatchType and
extend AttributeMatchType with Default / CaseSensitive.
* Source/WebCore/css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
Emit ' s]' for explicit case-sensitive so round-tripping preserves the flag.
(WebCore::CSSSelector::setAttribute):
(WebCore::CSSSelector::CSSSelector):
(WebCore::CSSSelector::simpleSelectorEqual const):
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumeAttribute):
(WebCore::CSSSelectorParser::consumeAttributeFlags):
Accept 's' and return CaseSensitive; use Default for the no-flag case.
* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::attributeSelectorMatches):
(WebCore::SelectorChecker::checkOne const):
Switch on attributeMatchType(); Default falls through to the existing
HTML legacy case-insensitive check.
* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::attributeSelectorCaseSensitivity):
Return CaseSensitive for explicit 's' before consulting the HTML legacy list.
(WebCore::SelectorCompiler::AttributeMatchingInfo::AttributeMatchingInfo):
* Source/WebCore/dom/SelectorQuery.cpp:
(WebCore::canBeUsedForIdFastPath):
(WebCore::canOptimizeSingleAttributeExactMatch):
Compare against CSSSelector::CaseInsensitive directly; explicit 's' and
Default continue to take the existing fast paths.
Canonical link: https://commits.webkit.org/313234@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications