Skip to content

Fix using zoom on relative color calculation #53538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

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}

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}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@jcscottiii jcscottiii closed this Jul 2, 2025
@jcscottiii jcscottiii reopened this Jul 2, 2025
@chromium-wpt-export-bot chromium-wpt-export-bot merged commit f0d1cf4 into master Jul 2, 2025
31 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-c175e4ecb4 branch July 2, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants