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

Add rgb() parsing tests that include non-finite inputs #369

Closed
mysteryDate opened this issue Jun 28, 2023 · 8 comments
Closed

Add rgb() parsing tests that include non-finite inputs #369

mysteryDate opened this issue Jun 28, 2023 · 8 comments
Labels
focus area: Color Spaces and Functions test-change-proposal Proposal to add or remove tests for an interop area

Comments

@mysteryDate
Copy link

mysteryDate commented Jun 28, 2023

Test List

css/css-color/parsing/color-computed-rgb.html
css/css-color/parsing/color-valid-rgb.html

Rationale

See the discussion here: w3c/csswg-drafts#8629

Since the inputs to rgb() include <percentage> and <number> just like the new color functions, they should process non-finite values as well. Since the color channels are bounded to [0, 255], calc(-infinity) should become 0 at computed value time and calc(infinity) should become 255. calc(NaN) should become zero, like with all colors:
https://www.w3.org/TR/css-color-4/#rgb-functions

We should add tests to the two files above along the lines of:
test_valid_value("color", "rgb(calc(infinity), 0, 0)", "rgb(calc(infinity), 0, 0)"); to color-valid-rgb.html and
["rgb(calc(infinity), 0, 0)", "rgb(255, 0, 0)", "Red channel resolves positive infinity to 255"] to color-computed-rgb.html

@mysteryDate mysteryDate added the test-change-proposal Proposal to add or remove tests for an interop area label Jun 28, 2023
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jun 28, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jun 28, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jun 29, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 3, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 3, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 3, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 4, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 5, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
@nairnandu
Copy link
Contributor

@jgraham / @zcorpan please review for Gecko
@gsnedders / @nt1m please review for WebKit

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 5, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
@nt1m
Copy link
Member

nt1m commented Jul 6, 2023

I don't really see the benefit of adding this, since it's an unlikely use case, but why not.

@zcorpan
Copy link
Member

zcorpan commented Jul 6, 2023

@emilio

@emilio
Copy link

emilio commented Jul 6, 2023

So legacy rgb at least always clamps eagerly during parsing doesn't it? Why would calc(infinity) be different?

document.body.style.color = "rgb(500, 0, 0)"
document.body.style.color // "rgb(255, 0, 0)"

Not saying we shouldn't add these though, but feels rather inconsistent? Or are you suggesting:

document.body.style.color = "rgb(calc(infinity), 0, 0)"
document.body.style.color // "rgb(255, 0, 0)"

Which afaict Chrome and Firefox do now? Or are you suggesting to change the out-of-range handling too?

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 6, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 6, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598329
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1166616}
aarongable pushed a commit to chromium/chromium that referenced this issue Jul 6, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598329
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1166616}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jul 6, 2023
Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598329
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1166616}
@jgraham
Copy link
Contributor

jgraham commented Jul 7, 2023

Given that there seems to be substantial ongoing discussion about the desired behaviour in these cases, I'd suggest that perhaps the tests should be held back from Interop 2023. Although it does seem like a case we'll inevitably run into eventually, it doesn't seem like it's a core requirement for most uses of this feature, or evidence that it's a current web compat hazard, and so we don't need to fast track interop changes.

@mysteryDate
Copy link
Author

mysteryDate commented Jul 7, 2023

So legacy rgb at least always clamps eagerly during parsing doesn't it? Why would calc(infinity) be different?

document.body.style.color = "rgb(500, 0, 0)"
document.body.style.color // "rgb(255, 0, 0)"

Not saying we shouldn't add these though, but feels rather inconsistent? Or are you suggesting:

document.body.style.color = "rgb(calc(infinity), 0, 0)"
document.body.style.color // "rgb(255, 0, 0)"

Which afaict Chrome and Firefox do now? Or are you suggesting to change the out-of-range handling too?

This makes a lot of sense. This would mirror what's currently happening for lightness in lab()/oklab():
https://github.com/web-platform-tests/wpt/blob/master/css/css-color/parsing/color-valid-lab.html#L42

So then, the only actual change would be for calc(NaN), so

document.body.style.color = "rgb(calc(infinity), calc(-infiinity), calc(NaN)"
document.body.style.color // "rgb(255, 0, 0)"

Currently firefox does this, chrome and safari both return rgb(255, 0, 255). calc(NaN) becoming 255 is certainly unexpected and out-of-line with interop goals for color this year. If it's worth bringing the browsers into alignment for non-finite inputs for color for all other color functions, it makes sense to also to rgb, especially when the change is so small.

It's also currently impossible to make any modifications to "color-valid-rgb.html" without also adding them to interop, as the entire file is included. So apologies for adding failures with my recent chromium CL.

If any of you wanted to respond on w3c/csswg-drafts#8629, it would be good to get the discussion going there, where all the context currently is.

@gsnedders
Copy link
Member

Given that there seems to be substantial ongoing discussion about the desired behaviour in these cases, I'd suggest that perhaps the tests should be held back from Interop 2023. Although it does seem like a case we'll inevitably run into eventually, it doesn't seem like it's a core requirement for most uses of this feature, or evidence that it's a current web compat hazard, and so we don't need to fast track interop changes.

+1 on this.

With the CSS WG issue unresolved, and with no evidence of this causing ongoing problems, let's just exclude this from Interop 2023.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Jul 20, 2023
…a=testonly

Automatic update from web-platform-tests
Parse rgb() like other color functions

Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598329
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1166616}

--

wpt-commits: 207ddbd913b3f007271558329c116e8da16b7979
wpt-pr: 40426
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Jul 21, 2023
…a=testonly

Automatic update from web-platform-tests
Parse rgb() like other color functions

Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598329
Reviewed-by: Florin Malita <fmalitachromium.org>
Reviewed-by: Steinar H Gunderson <sessechromium.org>
Commit-Queue: Aaron Krajeski <aaronhkchromium.org>
Cr-Commit-Position: refs/heads/main{#1166616}

--

wpt-commits: 207ddbd913b3f007271558329c116e8da16b7979
wpt-pr: 40426

UltraBlame original commit: bb939cc04443aa870a6a6b6088231ab172cc8c7a
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Jul 21, 2023
…a=testonly

Automatic update from web-platform-tests
Parse rgb() like other color functions

Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598329
Reviewed-by: Florin Malita <fmalitachromium.org>
Reviewed-by: Steinar H Gunderson <sessechromium.org>
Commit-Queue: Aaron Krajeski <aaronhkchromium.org>
Cr-Commit-Position: refs/heads/main{#1166616}

--

wpt-commits: 207ddbd913b3f007271558329c116e8da16b7979
wpt-pr: 40426

UltraBlame original commit: bb939cc04443aa870a6a6b6088231ab172cc8c7a
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Jul 21, 2023
…a=testonly

Automatic update from web-platform-tests
Parse rgb() like other color functions

Previously, rgb() and rgba() parsers were compressing all four color
channels and alpha to 8-bit integers. This is no longer necessary, as
blink::Color stores the parameters as floats.

As we move towards implementing relative color, the more unified the
color parsing is, the easier the eventual implementation will be.

After some discussion for Interop 2023, it was decided that non-finite
color parameters should round-trip and be resolved sanely:
http://github.com/w3c/csswg-drafts/issues/8629
This new requirement obviously puts us well out of 8-bit integer
territory.

Unfortunately, there are clearly still some code paths that are
independently compressing alpha to be an 8-bit integer and unless
we explicitly do this in the parser, many tests fail. A TODO has been
added to address this issue.

Here is the test change proposal: web-platform-tests/interop#369

Gradient tests with png expectations are pretty brittle, as evidenced
by the per-platform expectations. This change requires a rebaseline
because color channels are not squashed to [0,255] integer range at
the endpoints. So inputs like:
  conic-gradient(rgb(0%, 75%, 25%), rgb(0%, 25%, 75%));
No longer become equivalent to:
  conic-gradient(rgb(0, 191, 63), rgb(0, 63, 191));
25% of 255 is 63.75. 75% of 255 is 191.25.

Bug: 1452185
Change-Id: I1e89ad21d0e3007c1f51aa075728732c2856acc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598329
Reviewed-by: Florin Malita <fmalitachromium.org>
Reviewed-by: Steinar H Gunderson <sessechromium.org>
Commit-Queue: Aaron Krajeski <aaronhkchromium.org>
Cr-Commit-Position: refs/heads/main{#1166616}

--

wpt-commits: 207ddbd913b3f007271558329c116e8da16b7979
wpt-pr: 40426

UltraBlame original commit: bb939cc04443aa870a6a6b6088231ab172cc8c7a
@jgraham
Copy link
Contributor

jgraham commented Aug 10, 2023

Since there seems to be no disagreement on withholding these tests from Interop 2023, I'm going to close this issue.

@jgraham jgraham closed this as completed Aug 10, 2023
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue 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".

Bug: 1478766
Change-Id: I85602f4bffa046e1fd7652b33f119e468287e258
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue 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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 5, 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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 6, 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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 6, 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 <aaronhk@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1193043}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 6, 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 <aaronhk@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1193043}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 13, 2023
…formats at parse time, a=testonly

Automatic update from web-platform-tests
Clamp non-finite inputs to legacy color formats at parse time

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 <aaronhk@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1193043}

--

wpt-commits: 5ef347155a01cffa9b9082c6cc5077e76c268b71
wpt-pr: 41803
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this issue Sep 14, 2023
…formats at parse time, a=testonly

Automatic update from web-platform-tests
Clamp non-finite inputs to legacy color formats at parse time

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 <aaronhk@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1193043}

--

wpt-commits: 5ef347155a01cffa9b9082c6cc5077e76c268b71
wpt-pr: 41803
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this issue Dec 11, 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 <aaronhk@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
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
Labels
focus area: Color Spaces and Functions test-change-proposal Proposal to add or remove tests for an interop area
Projects
None yet
Development

No branches or pull requests

7 participants