Files
sousa-gecko/testing/web-platform/tests/css/css-grid/parsing
Javier Fernández García-Boente 9a459aea88 Bug 2052822 [wpt PR 61081] - [Typed OM] Wrap out-of-range values for more properties in calc(), a=testonly
Automatic update from web-platform-tests
[Typed OM] Wrap out-of-range values for more properties in calc()

Per CSS Typed OM set() step 9, a CSSUnitValue outside the limited
numeric range of a property's grammar must be preserved by wrapping it
in a CSSMathSum (serialized as calc()), so get() reifies it back as a
CSSMathSum rather than a bare CSSUnitValue.

Blink already implements this wrapping in
CSSUnitValue::ToCSSValueWithProperty(), but
IsValueOutOfRangeForProperty() only recognized non-negative <length>
properties (via LengthPropertyFunctions) plus a small hardcoded set.
Extend it to cover the remaining non-negative properties that were
failing WPT (numbers, times, non-length length-percentages, and logical
padding), correct the font-weight lower bound to 1, and treat
stroke-miterlimit as non-negative.

Flexible lengths ('fr') have no representation inside a calc(), so guard
against wrapping them and leave a <flex> unwrapped: a negative <flex> is
invalid per the grammar, and wrapping it would build an invalid calc
expression (a DCHECK failure in CSSMathExpressionNode).

Add CSSUnitValue unit tests for ToCSSValueWithProperty() covering the
in-range, out-of-range, font-weight range, and <flex>-guard cases (the
guard is otherwise only observable as a Debug-only DCHECK), and add a
bare negative <flex> to the grid-auto-columns/rows invalid-value parsing
tests.

Change-Id: I766440527ec2b09140419b4da8c0a6e25759f692
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8024972
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1657800}

--

wpt-commits: 117845549aec47118b6c405fd4e7a506ad33eaed
wpt-pr: 61081
2026-07-12 11:55:53 +00:00
..