Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5fa97e52fb27007b0f22df30391f614b9f179e78
https://github.com/WebKit/WebKit/commit/5fa97e52fb27007b0f22df30391f614b9f179e78
Author: Joanne Pan <[email protected]>
Date: 2026-06-26 (Fri, 26 Jun 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-invalid-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-invalid.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-valid-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-valid.html
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/css/CSSValueKeywords.in
M Source/WebCore/css/parser/CSSParserContext.cpp
M Source/WebCore/css/parser/CSSParserContext.h
M Source/WebCore/css/parser/CSSSubstitutionParser.cpp
Log Message:
-----------
[css-values-5 random-item()] parse-time support for the argument grammar
https://bugs.webkit.org/show_bug.cgi?id=317675
rdar://180429446
Reviewed by Antti Koivisto.
random-item() is an arbitrary substitution function, like var() and attr().
Per CSS Values 5 it is substituted at computed-value time, so at parse time
only its argument grammar needs to be validated:
<random-item-args> = random-item( <declaration-value>, [
<declaration-value>? ]# )
Add parse-time support for that grammar behind a new feature flag,
CSSRandomItemFunctionEnabled (off by default). The substitution parser now
accepts a random-item() function whose first argument is a non-empty
<declaration-value>, followed by a comma-separated list of one or more
(possibly empty) item values. Items use {}-grouping for internal commas and
may not mix a brace block with other values, following the
component-function-commas rules, similar to isValidAttrReference.
The first argument is treated as an opaque <declaration-value> here, parsing
it as a <random-key> and selecting one of the items happen at computed-value
time and are handled in a follow-up. Forms such as random-item(foo, a, b)
are now accepted at parse time and only resolved (or made invalid) at
computed-value time.
Spec: https://drafts.csswg.org/css-values-5/#funcdef-random-item
Test: imported/w3c/web-platform-tests/css/css-values/random-item-parsing.html
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-parsing-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-parsing.html:
Added.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::add):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSSubstitutionParser.cpp:
(WebCore::classifyBlock):
(WebCore::isValidRandomItemReference):
Canonical link: https://commits.webkit.org/315908@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications