Re: [csswg-drafts] [cssom-1][css-color-4] Move serialization of `<color>` and `<alpha-value>` (#9798)

This is about color channels, not the alpha channel, whose related code appears a few lines below, which is matching the specified algorithm, and which has been introduced the first time in this [commit](https://github.com/chromium/chromium/commit/13a86c2faeebcbc12dd4a7e8dea54318da635c19#diff-9ebe7b1ffff7ac58ac4e82be9f9d7482c19a5cda9ed893a4a47d7d798deaa847).

While digging, I stumbled upon this [commit](https://github.com/chromium/chromium/commit/c285855d6e9d4f24749874c49f9a39a261265d01) message:

  > 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.

I still do not understand the rounding with 3 decimal places, but maybe things could be simplified now.

-- 
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9798#issuecomment-1956229780 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 21 February 2024 09:29:11 UTC