Skip to content

chore: cherry-pick 3 changes from chromium#50461

Merged
VerteDinde merged 4 commits into39-x-yfrom
cherry-pick/39-x-y/chromium/css-unparsed-value-fixes
Mar 25, 2026
Merged

chore: cherry-pick 3 changes from chromium#50461
VerteDinde merged 4 commits into39-x-yfrom
cherry-pick/39-x-y/chromium/css-unparsed-value-fixes

Conversation

@VerteDinde
Copy link
Copy Markdown
Member

cherry-pick 45c5a70d984d from chromium Describe a vector of segments as "segments", not "tokens"

The specification uses the term "tokens" to refer to a sequence
of V8CSSUnparsedSegment objects, and CSSUnparsedValue has adopted
this terminology. While it is usually a good idea for Blink
to mirror the language used in specifications, "tokens" is very
confusing here, since it always means CSSParserTokens in every other
place in the style code.

Bug: 487117772
Change-Id: I2dc132c4e618e398e1f8bdabc03a8d2ab6c118e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7606599
Commit-Queue: Anders Hartvoll Ruud andruud@chromium.org
Reviewed-by: Steinar H Gunderson sesse@chromium.org
Cr-Commit-Position: refs/heads/main@{#1590040}

cherry-pick 05e4b544803c from chromium Stringify CSSUnparsedValues via toString, as normal

CSSUnparsedValue exposes a special stringification function
ToUnparsedString() in addition to the regular toString().
The documentation says it returns "tokens without substituting
variables", but it's not clear what this means; we don't substitute
any variables in CSSStyleValue::toString() either.

This CL makes ToUnparsedString() private (and renames it).
Clients needing to serialize a CSSUnparsedValue can do so via
the normal toString() function. (If ToUnparsedString() existed
for performance reasons, that should have been documented.)

Also, the /**/-"fixup" pass over the value has been folded into
ToStringInternal(). This is to make it easy to find the canonical string
representation of this value within CSSUnparsedValue (without going
through a CSSValue).

The main point of this CL is to prepare for validating
the "argument grammar" of the value during the StyleValue-to-CSSValue
conversion in StylePropertyMap (which requires item (2) above).

We now jump through additional hoops to ultimately get a string
from the outside of CSSUnparsedValue, but there should otherwise
be no behavior change.

Bug: 484751092
Change-Id: I5db45ad85f780c67a2ea3ba8482c390ebab10068
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7600415
Commit-Queue: Anders Hartvoll Ruud andruud@chromium.org
Reviewed-by: Steinar H Gunderson sesse@chromium.org
Cr-Commit-Position: refs/heads/main@{#1590041}

cherry-pick 5efc7a0127a6 from chromium Validate CSSUnparsedValues upon assignment

CSS Typed OM has a concept of a value "matching a grammar" (or not)
upon assignment to a property [1]. For CSSUnparsedValues, we currently
don't perform any significant validation, and as a consequence
we allow "invalid" CSSUnparsedDeclarationValues to be created
(causing DCHECKs later in the pipeline).

This CL makes sure values can be parsed using CSSVariableParser::
ConsumeUnparsedDeclaration before assignment.

We're still not handling the value in the context of the destination
property, which we probably should. This is also a problem with
current state of things, however, so for now the goal is primarily
to avoid the DCHECKs in Issue 484751092.

Finally, I opened an issue against the specification [2], which
currently doesn't define any of this.

[1] https://drafts.css-houdini.org/css-typed-om-1/#create-an-internal-representation
[2] w3c/csswg-drafts#13547

Fixed: 484751092
Change-Id: Id7f888a6df8c02ade24910900f5d01909cb2dfad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7595347
Reviewed-by: Steinar H Gunderson sesse@chromium.org
Commit-Queue: Anders Hartvoll Ruud andruud@chromium.org
Cr-Commit-Position: refs/heads/main@{#1590110}

Notes: Backported fixes for 484751092, 487117772.

@VerteDinde VerteDinde requested a review from a team as a code owner March 24, 2026 16:33
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 24, 2026
@VerteDinde VerteDinde added security 🔒 semver/patch backwards-compatible bug fixes backport-check-skip Skip trop's backport validity checking 39-x-y labels Mar 24, 2026
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Mar 24, 2026
VerteDinde and others added 4 commits March 24, 2026 16:30
Describe a vector of segments as "segments", not "tokens"

Bug: 487117772
Change-Id: I2dc132c4e618e398e1f8bdabc03a8d2ab6c118e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7606599
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1590040}

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Stringify CSSUnparsedValues via toString, as normal

Bug: 484751092
Change-Id: I5db45ad85f780c67a2ea3ba8482c390ebab10068
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7600415
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1590041}

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Validate CSSUnparsedValues upon assignment

Fixed: 484751092
Change-Id: Id7f888a6df8c02ade24910900f5d01909cb2dfad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7595347
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1590110}

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@VerteDinde VerteDinde force-pushed the cherry-pick/39-x-y/chromium/css-unparsed-value-fixes branch from 2de88a0 to 5eef032 Compare March 24, 2026 23:52
@VerteDinde VerteDinde enabled auto-merge (squash) March 25, 2026 00:16
@VerteDinde VerteDinde merged commit 7007907 into 39-x-y Mar 25, 2026
57 of 58 checks passed
@VerteDinde VerteDinde deleted the cherry-pick/39-x-y/chromium/css-unparsed-value-fixes branch March 25, 2026 01:42
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Mar 25, 2026

Release Notes Persisted

Backported fixes for 484751092, 487117772.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

39-x-y backport-check-skip Skip trop's backport validity checking security 🔒 semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants