Fix using zoom on relative color calculation #53538
Merged
+17
−0
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.
Previously, the CL has been landed to use a proper length resolver for
relative color calculations. But it has been discovered that during
ToCalcValue() we multiply <number> type by current zoom value, as
those number type can be "user units" from SVG. That zooming affect
relative colors and shouldn't be performed on real <number> type.
A proper fix would involve a bigger scope project, so, since the bug
has hit some websites in production, temporary set zoom to 1 when
resolving relative color. This is better then reverting previous CL,
as otherwise we would have crash when using sibling-index() in relative
color, and using zoom 1 will be the previous behaviour anyway.
Note that zoom 1 means that e.g. font-relative units inside e.g. sign()
won't be affected by zoom in relative color, but that bug existed
before any of CLs mentioned.
Also this CL changes CSSLengthResolver to CSSToLengthConversionData
for color-related code to use Unzoomed() method, as there is no way
to cast CSSLengthResolver to CSSToLengthConversionData (and probably
shouldn't be).
Also note that this is a temporary fix.
Bug: 428657802
Change-Id: Id6eac8d2dc979fe2a88c68878561b30c5855aa28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6695593
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1481576}