Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 004cb05ad8d1330e7086e4a1f6ae282f52eb2fc6
      
https://github.com/WebKit/WebKit/commit/004cb05ad8d1330e7086e4a1f6ae282f52eb2fc6
  Author: Antti Koivisto <[email protected]>
  Date:   2026-08-11 (Tue, 11 Aug 2026)

  Changed paths:
    A LayoutTests/fast/css/ident-function-length-limit-expected.txt
    A LayoutTests/fast/css/ident-function-length-limit.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-try-ident-function-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/container-queries/container-ident-function-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/registered-property-ident-function-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-computed-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-computed.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-parsing-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-parsing.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-substitution-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-substitution.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-computed.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/var-ident-function-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/var-ident-function.html
    M 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/timeline-names-ident-function-expected.txt
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/css/CSSValueKeywords.in
    M Source/WebCore/css/parser/CSSSubstitutionParser.cpp
    M Source/WebCore/style/StyleSubstitutionResolver.cpp
    M Source/WebCore/style/StyleSubstitutionResolver.h

  Log Message:
  -----------
  [css-values-5] Implement ident() arbitrary substitution function
https://bugs.webkit.org/show_bug.cgi?id=284895
rdar://142034342

Reviewed by Tim Nguyen.

Implement ident() as an arbitrary substitution function per

https://github.com/w3c/csswg-drafts/issues/14213#issuecomment-5205278180

This feature allows constructing identifiers from other sources of data like

color: var(ident(--item-color- attr(item-type)))

The spec has not been updated yet but the shape of the implemenation is pretty 
clear.
There is now an argument grammar

    <ident-args> = ident( <declaration-value> )

that is validated during parsing. The full grammar

    <ident()> = ident( <ident-arg>+ )
    <ident-arg> = <string> | <integer> | <ident>

is validated during substitution.

Test: 
imported/w3c/web-platform-tests/css/css-values/ident-function-substitution.html
* LayoutTests/fast/css/ident-function-length-limit-expected.txt: Added.
* LayoutTests/fast/css/ident-function-length-limit.html: Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-try-ident-function-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/container-queries/container-ident-function-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/registered-property-ident-function-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-computed-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-computed.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-parsing-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-parsing.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-substitution-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/ident-function-substitution.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-computed.tentative-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/var-ident-function-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/var-ident-function.html:
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/timeline-names-ident-function-expected.txt:

The one remaining failure there is Style::NameScope keeping names in a hash 
set, so the duplicates
that subtest lists collapse into one. Not about ident(): timeline-scope: --a, 
--a does the same.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:

CSSIdentFunctionEnabled moves to preview.

* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/parser/CSSSubstitutionParser.cpp:
(WebCore::classifyBlock):
(WebCore::isValidIdentReference):
* Source/WebCore/style/StyleSubstitutionResolver.cpp:
(WebCore::Style::SubstitutionResolver::substituteIdentFunction):

<integer> production supports math functions so resolve those too.

(WebCore::Style::SubstitutionResolver::substituteTokenRange):
* Source/WebCore/style/StyleSubstitutionResolver.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to