Ensure roundtrip for parsing & serialization of custom properties and var() #27794
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When tokenizing a style sheet, currently all comment tokens are
discarded. This patch adds a flag is_after_comment_ to CSSParserToken
to indicate removed comment tokens, so that we can add them back
in serialization, so that parsing & serialization of custom properties
can round-trip for cases like '--foo: 1/**/px'.
Using this mechanism, when resolving consecutive var() functions, we can
also insert a comment between them, so that the resolved token
sequence can be serialized with an empty comment in between. In this way,
parsing & serialization of consecutive var() functions can round-trip
for cases like '--a: 1; --b: px; --foo: var(a)var(b)'.
Bug: 1180294
Change-Id: I96e5958f1479b052eba12aff31fc18a6265b08b4
Reviewed-on: https://chromium-review.googlesource.com/2708609
WPT-Export-Revision: 51af0c053b56b6cbd86045e2eef6d2a31cd4efab