tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d92d562fcb0dc2b68e6898a70ea49fdba4bd912c
parent 823923c44a6928efad1b75e1dbf490ae39434c4e
Author: moonira <moonira@google.com>
Date:   Mon,  5 Jan 2026 10:23:22 +0000

Bug 2008342 [wpt PR 56958] - Support property dependent random() function inside CSSFunctionValue, a=testonly

Automatic update from web-platform-tests
Support property dependent random() function inside CSSFunctionValue

If no random identifier is specified, we need to use the property name
and value index as the name in the cache key. Add support for this
in CSSFunctionValue, so that we will use the correct name for random()
inside a function.

https://drafts.csswg.org/css-values-5/#random-caching-key

Bug: 413385732
Change-Id: I2d350752ce8c96fb4cbb3a70f1841979b5e3f33b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7280946
Commit-Queue: Munira Tursunova <moonira@google.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1563823}

--

wpt-commits: 1df75803200fe75dad35ae2ac644cdc3d56f173b
wpt-pr: 56958

Diffstat:
Mtesting/web-platform/tests/css/css-values/random-computed.tentative.html | 28++++++++++++++++++++++++++++
Mtesting/web-platform/tests/css/css-values/random-serialize.tentative.html | 1+
2 files changed, 29 insertions(+), 0 deletions(-)

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 @@ -48,6 +48,7 @@ margin: random(element-shared 0px, 100000px) random(element-shared 0px, 100000px); translate: random(10%, 30%); scale: random(element-shared, 1, 3) random(element-shared, 3, 9); + math-depth: add(random(element-shared, 1, 100)); } .randomIdentifier { width: random(--identifier, 0px, 100px); @@ -323,6 +324,9 @@ test_random_computed_value('font-size', 'random(10px * 10% / 1%, 0%)', '100px'); test_random_base_is_not_1('width', 'random(fixed random(1, 2), 10px, 100px)'); test_random_computed_value_has_fixed('translate', 'random(fixed random(-2, -1), 10%, 100%)', '10%', '100%', 0); +// Random inside function +test_random_computed_value('math-depth', 'add(random(30, 10))', '30'); + // Test random value sharing test(() => { const holder = document.createElement('div'); @@ -560,6 +564,30 @@ test(() => { t2.className = 'randomMatchElement'; holder.appendChild(t2); + let t1ComputedMathDepth = getComputedStyle(t1)['math-depth']; + let t2ComputedMathDepth = getComputedStyle(t2)['math-depth']; + + test_random_equals(t1ComputedMathDepth, t2ComputedMathDepth, + "math-depth values on different elements should be equal"); + } + } finally { + document.body.removeChild(holder); + } +}, `Shared between elements within a property, random inside function: random(element-shared, a, b)`); + +test(() => { + const holder = document.createElement('div'); + document.body.appendChild(holder); + + try { + for (i = 0; i < iterations; ++i) { + const t1 = document.createElement('div'); + t1.className = 'randomMatchElement'; + holder.appendChild(t1); + const t2 = document.createElement('div'); + t2.className = 'randomMatchElement'; + holder.appendChild(t2); + let t1ComputedWidth = getComputedStyle(t1)['translate']; let t2ComputedWidth = getComputedStyle(t2)['translate']; diff --git a/testing/web-platform/tests/css/css-values/random-serialize.tentative.html b/testing/web-platform/tests/css/css-values/random-serialize.tentative.html @@ -43,6 +43,7 @@ test_valid_value('width', 'random(fixed calc(2 / 4), 0px, 100px)', 'random(fixed // Test nested in expressions test_valid_value('width', 'calc(2 * random(0px, 100px))'); +test_valid_value('math-depth', 'add(random(0, 3))'); // Test other types test_valid_value('max-lines', 'random(25, 50)');