Skip to content

[css-color-4] Computed value and serialization of Infinity and NaN in color functions #8629

@romainmenke

Description

@romainmenke

What are the expected values and serializations for these examples?

  • lab(calc(Infinity) 0 0)
  • lab(50% calc(Infinity) 0)
  • lab(calc(NaN) 0 0)
  • lab(50% calc(NaN) 0)
  • ...

manually setting these values seems illogical but they can be the result of calculations and variables. e.g. calc(var(--foo) / var(--bar)) where --bar is possibly zero.


Currently browsers do very different things in some area's.

Chrome and Safari seem to agree that lab(50% calc(Infinity) 0) serializes as lab(50% Infinity 0), but that no longer roundtrips because the required calc was removed. That seems like an obvious bug, but maybe I overlooked something.

Chrome renders lab(50% calc(Infinity) 0) as white.
Safari renders lab(50% calc(Infinity) 0) as black.

Chrome also sometimes renders a pink area in certain edge cases

WPT doesn't have any tests for these kinds of values.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Tuesday Breakout (1pm?)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions