Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b70772b13dd06af968f0de8aef4e81404bede915
https://github.com/WebKit/WebKit/commit/b70772b13dd06af968f0de8aef4e81404bede915
Author: Joanne Pan <[email protected]>
Date: 2026-08-19 (Wed, 19 Aug 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-computed-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-computed.html
M Source/WebCore/css/calc/CSSCalcRandomSharing.h
M Source/WebCore/css/calc/CSSCalcTree+Parser.cpp
M Source/WebCore/style/StyleSubstitutionResolver.cpp
Log Message:
-----------
[css-values-5 random-item()] auto random() and random-item() in the same
property value get the same random value
https://bugs.webkit.org/show_bug.cgi?id=319919
rdar://182846761
Reviewed by Antti Koivisto and Tim Nguyen.
Both functions number their own random draws from zero, so an auto random() and
an
auto random-item() in one value each claimed index 0. With the same property and
element they built the same RandomCachingKey and resolved to one base value, so
`width: calc(random(auto, 0px, 400px) + random-item(auto, 0px, 1000px))` rolled
one die instead of two. 319153@main made this reachable by giving
random-item()'s
`auto` the element scoping it was missing.
Record which function a derived property scope came from, so the two get
separate
buckets. Only derived scopes carry it, leaving an author's <dashed-ident> and a
bare element-scoped key shared across both functions as before.
Whether the spec wants one index sequence across both functions or one per
function is open as csswg-drafts#14330. This keys on the function rather than
merging the sequences, which fixes the collision under either answer, and does
not
depend on counting across the substitution and parse phases. <random-ua-ident>
serialization will need to account for the function once it is implemented
(bug 321552).
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-computed-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/random-item-computed.html:
* Source/WebCore/css/calc/CSSCalcRandomSharing.h:
* Source/WebCore/css/calc/CSSCalcTree+Parser.cpp:
(WebCore::CSSCalc::consumeRandom):
* Source/WebCore/style/StyleSubstitutionResolver.cpp:
(WebCore::Style::SubstitutionResolver::randomItemBaseValue):
Canonical link: https://commits.webkit.org/319463@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications