[webkit-changes] [WebKit/WebKit] 59cb7c: Add CustomStateSet and :state() selector

Commit Queue noreply at github.com
Wed Dec 6 03:06:10 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 59cb7cb2d9244ba77870eabe9f6a8da9249a1312
      https://github.com/WebKit/WebKit/commit/59cb7cb2d9244ba77870eabe9f6a8da9249a1312
  Author: Keith Cirkel <webkit at keithcirkel.co.uk>
  Date:   2023-12-06 (Wed, 06 Dec 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/state-in-has-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/state-in-has.html
    M LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-state-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/ElementInternals-states-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/ElementInternals-states.html
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/state-pseudo-class-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/state-pseudo-class.html
    M LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/custom-state-set-strong-ref.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/idlharness.window-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/state-css-selector-shadow-dom.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/state-css-selector-shadow-dom.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/state-css-selector.tentative-expected.txt
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources-output.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/js/WebCoreBuiltinNames.h
    M Source/WebCore/css/CSSSelector.cpp
    M Source/WebCore/css/CSSSelector.h
    M Source/WebCore/css/SelectorChecker.cpp
    M Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/css/parser/CSSSelectorParser.cpp
    M Source/WebCore/css/parser/CSSSelectorParserContext.cpp
    M Source/WebCore/css/parser/CSSSelectorParserContext.h
    M Source/WebCore/cssjit/SelectorCompiler.cpp
    A Source/WebCore/dom/CustomStateSet.cpp
    A Source/WebCore/dom/CustomStateSet.h
    A Source/WebCore/dom/CustomStateSet.idl
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/ElementInternals.cpp
    M Source/WebCore/dom/ElementInternals.h
    M Source/WebCore/dom/ElementInternals.idl
    M Source/WebCore/dom/ElementRareData.cpp
    M Source/WebCore/dom/ElementRareData.h
    M Source/WebCore/dom/NodeRareData.h

  Log Message:
  -----------
  Add CustomStateSet and :state() selector
https://bugs.webkit.org/show_bug.cgi?id=215911

Reviewed by Tim Nguyen.

This adds the CustomStateSet idl definitions, and the `states` getter in
the ElementInternals IDL. The gatter laziliy initialises a
CustomStateSet object in ElementRareData which behaves like a
setlike<DOMString>.

This also adds the `:state()` pseudo selector, which can take an ident
and matches when the ident matches one of the given states in the
CustomStateSet for the element.

Any states set by CustomStateSet need to invalidate styles for the
element, so the `:state()` pseudo can match.

* LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/state-in-has-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/state-in-has.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/selectors/parsing/parse-state-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/ElementInternals-states-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/ElementInternals-states.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/state-pseudo-class-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/state/tentative/state-pseudo-class.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/custom-state-set-strong-ref.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/idlharness.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/state-css-selector-shadow-dom.tentative-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/state-css-selector-shadow-dom.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-state-pseudo-class/state-css-selector.tentative-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/WebCoreBuiltinNames.h:
* Source/WebCore/css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
* Source/WebCore/css/CSSSelector.h:
* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
* Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::add):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::isOnlyPseudoClassFunction):
(WebCore::CSSSelectorParser::consumePseudo):
* Source/WebCore/css/parser/CSSSelectorParserContext.cpp:
(WebCore::CSSSelectorParserContext::CSSSelectorParserContext):
(WebCore::add):
* Source/WebCore/css/parser/CSSSelectorParserContext.h:
* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
* Source/WebCore/dom/CustomStateSet.cpp: Added.
(WebCore::CustomStateSet::addToSetLike):
(WebCore::CustomStateSet::removeFromSetLike):
(WebCore::CustomStateSet::clearFromSetLike):
(WebCore::CustomStateSet::has):
* Source/WebCore/dom/CustomStateSet.h: Added.
* Source/WebCore/dom/CustomStateSet.idl: Added.
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::hasCustomState const):
(WebCore::Element::ensureCustomStateSet):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/ElementInternals.cpp:
(WebCore::ElementInternals::states):
* Source/WebCore/dom/ElementInternals.h:
* Source/WebCore/dom/ElementInternals.idl:
* Source/WebCore/dom/ElementRareData.cpp:
* Source/WebCore/dom/ElementRareData.h:
(WebCore::ElementRareData::customStateSet):
(WebCore::ElementRareData::setCustomStateSet):
(WebCore::ElementRareData::useTypes const):
* Source/WebCore/dom/NodeRareData.h:

Canonical link: https://commits.webkit.org/271600@main




More information about the webkit-changes mailing list