Skip to content
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

Clamp non-finite inputs to legacy color formats at parse time #41803

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Sep 4, 2023

web-platform-tests/interop#369

All legacy colors parse to rgb( , , ) or rgba( , , , ) with integers
in the range [0, 255] for the color channels and [0, 1] for alpha. Since
the channels are bounded, non finite inputs should resolve to the upper
bound for "infinity" and the lower bound for "-infinity" and "NaN".

The parser was also previously allowing unbounded alpha at parse time.
Alpha is also a bounded channel and non-finite inputs should be clamped
to [0, 1]. This behavior was previously untested, but is tested here
in new tests added to color-valid-rgb.html.

Bug: 1478766
Change-Id: I85602f4bffa046e1fd7652b33f119e468287e258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4839697
Commit-Queue: Aaron Krajeski <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1193043}

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.

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-4839697 branch 3 times, most recently from a4a8509 to 5b1616a Compare September 6, 2023 12:15
web-platform-tests/interop#369

All legacy colors parse to `rgb( , , )` or `rgba( , , , )` with integers
in the range [0, 255] for the color channels and [0, 1] for alpha. Since
the channels are bounded, non finite inputs should resolve to the upper
bound for "infinity" and the lower bound for "-infinity" and "NaN".

The parser was also previously allowing unbounded alpha at parse time.
Alpha is also a bounded channel and non-finite inputs should be clamped
to [0, 1]. This behavior was previously untested, but is tested here
in new tests added to color-valid-rgb.html.

Bug: 1478766
Change-Id: I85602f4bffa046e1fd7652b33f119e468287e258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4839697
Commit-Queue: Aaron Krajeski <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1193043}
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