commit ec210f5b5d9f8dec3a6121366c2f5f0fe427e115
parent fd63cab38b06ad44336cd25e6fba61c8149064d4
Author: moonira <moonira@google.com>
Date: Fri, 19 Dec 2025 09:19:44 +0000
Bug 2006839 [wpt PR 56850] - Support calc values in random() fixed, a=testonly
Automatic update from web-platform-tests
Support calc values in random() fixed
Fixed values in <random-value-sharing> parameter of random() function
should accept not only numeric literals but also calc expressions.
Now instead of having double fixed random sharing value, we store
CSSPrimitiveValue instead.
https://drafts.csswg.org/css-values-5/#typedef-random-value-sharing
Bug: 413385732
Change-Id: I2c2fd7b31a5db0cbf5f70352909f55ddaca91aa2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7241411
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Munira Tursunova <moonira@google.com>
Cr-Commit-Position: refs/heads/main@{#1560394}
--
wpt-commits: e51e1aa8b3e2fc23e330df7000ba783e49509fea
wpt-pr: 56850
Diffstat:
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/testing/web-platform/tests/css/css-values/random-computed.tentative.html b/testing/web-platform/tests/css/css-values/random-computed.tentative.html
@@ -19,6 +19,16 @@
inherits: true;
initial-value: 3;
}
+ @property --random-length-1 {
+ syntax: "<length>";
+ inherits: true;
+ initial-value: 3px;
+ }
+ @property --random-length-2 {
+ syntax: "<length>";
+ inherits: true;
+ initial-value: 3px;
+ }
.randomNoIdentifier {
width: random(0px, 100px);
height: random(0px, 100px);
@@ -27,6 +37,8 @@
margin: random(0px, 100000px) random(0px, 100000px);
--x: random(0, 100);
--y: random(0, 100);
+ --random-length-1: random(fixed random(0, 1), 10px, 100px);
+ --random-length-2: random(fixed random(0, 1), 10px, 100px);
}
.randomMatchElement {
width: random(element-shared, 0px, 100px);
@@ -374,7 +386,6 @@ test(() => {
}
}, `Maximum random - shorthand: random(a, b)`);
-
test(() => {
const holder = document.createElement('div');
document.body.appendChild(holder);
@@ -417,6 +428,25 @@ test(() => {
const el = document.createElement('div');
el.className = 'randomNoIdentifier';
holder.appendChild(el);
+ const elComputedLength1 = getComputedStyle(el).getPropertyValue('--random-length-1');
+ const elComputedLength2 = getComputedStyle(el).getPropertyValue('--random-length-2');
+ assert_false(elComputedLength1 == elComputedLength2,
+ "Different custom properties on the same element should not have equal values");
+ }
+ } finally {
+ document.body.removeChild(holder);
+ }
+}, `Nested random inside custom property: 'random(a, b)'`);
+
+test(() => {
+ const holder = document.createElement('div');
+ document.body.appendChild(holder);
+
+ try {
+ for (i = 0; i < iterations; ++i) {
+ const el = document.createElement('div');
+ el.className = 'randomNoIdentifier';
+ holder.appendChild(el);
const elComputedX = getComputedStyle(el).getPropertyValue('--x');
const elComputedY = getComputedStyle(el).getPropertyValue('--y');
assert_false(elComputedX == elComputedY,