Skip to content

Commit 1697b9e

Browse files
committed
[css-color-4] Avoid infinite loop in gamut reduction with whiter-then-white or blacker-than-black, fix #6999
1 parent 7181b49 commit 1697b9e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

css-color-4/Overview.bs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5253,6 +5253,10 @@ Gamut Mapping
52535253

52545254
<ol>
52555255
<li>let |origin_OKLCH| be |origin| converted to the OKLCH color space</li>
5256+
<li>if the Lightness of |origin_OKLCH| is greater than or equal to 100%,
5257+
return { 1 1 1 origin.alpha } in |destination|</li>
5258+
<li>if the Lightness of |origin_OKLCH| is less than than or equal to 0%,
5259+
return { 0 0 0 origin.alpha } in |destination|</li>
52565260
<li>let inGamut(|color|) be a function which returns true if, when passed a color,
52575261
that color is inside the gamut of |destination|
52585262
</li>
@@ -5275,7 +5279,7 @@ Gamut Mapping
52755279
<ol>
52765280
<li>set |clipped| to clip(|current|)</li>
52775281
<li>set |E| to delta(|clipped|, |current|)</li>
5278-
<li>if |E| < |JND| convert |clipped| to |destination| and return it as the gamut mapped color</li>
5282+
<li>if |E| < |JND| return |clipped| as the gamut mapped color</li>
52795283
<li>otherwise, set |max| to |chroma| and continue to repeat these steps</li>
52805284
</ol>
52815285
</li>

0 commit comments

Comments
 (0)