tor-browser

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

commit 3f97b7252923fc1a8b0acd386f5ae06459e947e6
parent 91257e049e3d0cf3383b7d94ff3aaefc90cbb5a2
Author: moonira <moonira@google.com>
Date:   Tue, 16 Dec 2025 08:45:30 +0000

Bug 2005487 [wpt PR 56679] - Test actual out of range fixed value, a=testonly

Automatic update from web-platform-tests
Test actual out of range fixed value

Current test for out of range math functions for fixed value is using
serialized fixed value for testing. Since precision can be lost during
serialization, change the test to test that CSSOM unserialized double
fixed value is not exceeding the allowed range [0, 1).

https://drafts.csswg.org/css-values-5/#typedef-random-value-sharing

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

--

wpt-commits: f78a2ecb40f14e08da6de4ec69f11fc57005da86
wpt-pr: 56679

Diffstat:
Mtesting/web-platform/tests/css/css-values/random-computed.tentative.html | 19+++++++++++++++++--
1 file changed, 17 insertions(+), 2 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 @@ -55,7 +55,7 @@ const iterations = 5; // does not generate deterministic test failure output. Chrome relies on test // failure output to be deterministic and stable for failing test expectations. function test_random_equals(actual, expected, message = "Random values should be equal") { - assert_equals(actual, expected, message); + assert_true(actual == expected, message); } function test_random_computed_value(property, specified, computed, titleExtra, options = {}) { @@ -184,6 +184,21 @@ function test_random_computed_value_has_fixed(property, specified, minPercentage }, `Property ${property} value '${specified}'${titleExtra ? ' ' + titleExtra : ''}`); } +function test_random_base_is_not_1(property, specified) { + test(() => { + for (i = 0; i < iterations; ++i) { + const target = document.getElementById('target'); + assert_true(property in getComputedStyle(target), property + " doesn't seem to be supported in the computed style"); + assert_true(CSS.supports(property, specified), "'" + specified + "' is a supported value for " + property + "."); + target.style[property] = ''; + target.style[property] = specified; + const computed = target.computedStyleMap().get(property); + assert_true(computed instanceof CSSUnitValue); + assert_false(computed.value == 100.0, "Random base value should not be clamped to 1"); + } + }, `Property ${property} value '${specified}'`); +} + const property = 'scale'; test_random_computed_value_in_range(property, 'random(1, 11)', '1', '11'); @@ -280,7 +295,7 @@ test_random_computed_value('font-size', 'random(30%, 10%)', '4.8px'); test_random_computed_value('font-size', 'random(10px * 10% / 1%, 0%)', '100px'); // Test out of range math functions for fixed value -test_random_computed_value_has_fixed('translate', 'random(fixed random(1, 2), 10%, 100%)', '10%', '100%'); +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); // Test random value sharing