Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b817f195c95ec4f50962f01dfe31c808803f46b8
https://github.com/WebKit/WebKit/commit/b817f195c95ec4f50962f01dfe31c808803f46b8
Author: Joanne Pan <[email protected]>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-in-container-query.tentative-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-in-container-query.tentative.html
M Source/WebCore/style/StyleBuilder.cpp
M Source/WebCore/style/StyleBuilderState.h
M Source/WebCore/style/StyleSubstitutionResolver.cpp
Log Message:
-----------
[css-values-5 random-item()] random-item() should be disallowed in @container
style() queries
https://bugs.webkit.org/show_bug.cgi?id=319929
rdar://182854362
Reviewed by Antti Koivisto.
random() is rejected in @container style() query values, but random-item() was
not, so
it leaked into a context where random() is blocked. random-item() is an
arbitrary
substitution function resolved in StyleSubstitutionResolver rather than a math
function
rejected at parse time, so it bypassed the guard that stops random().
Reject random-item() while resolving a @container style() query value. Builder
sets a
BuilderState::isResolvingContainerQueries() flag around
resolveCustomPropertyForContainerQueries()
(a per-evaluation throwaway builder, so the flag cannot leak into normal style
resolution),
and substituteRandomItemFunction() bails when it is set.
Whether random functions should be allowed outside an element context is an
open question
(https://github.com/w3c/csswg-drafts/issues/10982); this matches random()'s
current
behavior pending a CSSWG resolution.
Test:
imported/w3c/web-platform-tests/css/css-values/random-item-in-container-query.tentative.html
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-in-container-query.tentative-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-in-container-query.tentative.html:
Added.
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::resolveCustomPropertyForContainerQueries):
* Source/WebCore/style/StyleBuilderState.h:
(WebCore::Style::BuilderState::setIsResolvingContainerQueries):
(WebCore::Style::BuilderState::isResolvingContainerQueries const):
* Source/WebCore/style/StyleSubstitutionResolver.cpp:
(WebCore::Style::SubstitutionResolver::substituteRandomItemFunction):
Canonical link: https://commits.webkit.org/318550@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications