Re: [csswg-drafts] [css-color-4] CSS gamut mapping algorithm pseudocode can result in infinite looping for some inputs (#6999)

As this is a binary search, I'm surprised that the spec does not mention a restraint on the chroma value that is being altered to prevent the infinite loop. Once the low and high chroma is close enough to consider they've converged, the loop should terminate as bisecting it further may not reduce the delta between them at a certain point.

I'm not sure a restraint needs to be placed on lightness as when the loop kicks out because low and high chroma has essentially converged, if the color is not in gamut, it should be clipped as a final step which will essentially take care of the lightness. It seems that isn't really mentioned in the pseudocode though (maybe the intention had assumed that lightness would always be within an acceptable range?).

I'm not sure if in the future there may be cases where lightness could be greater than 1, but I can definitely see the logic that if lightness was clipped as things stand now, then if chroma bottoms out, you should always have an in gamut color.

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


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

Received on Monday, 31 January 2022 18:14:51 UTC