<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>261603</bug_id>
          
          <creation_ts>2023-09-15 06:34:11 -0700</creation_ts>
          <short_desc>Colors with lightness of 0 or 100 with a chroma that pushes the color out of gamut are displayed as non-white / non-black</short_desc>
          <delta_ts>2023-09-22 06:35:14 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Safari 17</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=261019</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>romain</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>heycam</cc>
    
    <cc>ntim</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1977672</commentid>
    <comment_count>0</comment_count>
    <who name="">romain</who>
    <bug_when>2023-09-15 06:34:11 -0700</bug_when>
    <thetext>Example WPT tests :
- http://wpt.live/css/css-color/oklch-009.html
- https://github.com/web-platform-tests/wpt/blob/master/css/css-color/oklch-009.html

specification : https://drafts.csswg.org/css-color/#specifying-lab-lch

&gt; If the lightness of a Lab color (after clamping) is 0%, or 100% the color will be displayed as black, or white, respectively due to gamut mapping to the display.

WebKit doesn&apos;t current gamut map colors and instead clips.
This darkens colors that should actually be white/black.

https://codepen.io/romainmenke/pen/xxmLpRO</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1977683</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-09-15 08:21:26 -0700</bug_when>
    <thetext>Related to bug 261019 that was recently fixed, but still reproduces on ToT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1977692</commentid>
    <comment_count>2</comment_count>
    <who name="">romain</who>
    <bug_when>2023-09-15 08:39:28 -0700</bug_when>
    <thetext>I think this is a different issue.

The changes that were made for https://bugs.webkit.org/show_bug.cgi?id=261019 only apply to lightness values outside the relevant range.

This issue is about what happens with colors that have a lightness of 0 or &quot;max&quot; and that should be displayed as black or white.

When these colors also have some chroma/saturation they will be displayed as non-black/non-white.

This is most likely the result of converting to rgb or display-p3 and then clipping the channels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1977693</commentid>
    <comment_count>3</comment_count>
    <who name="">romain</who>
    <bug_when>2023-09-15 08:40:25 -0700</bug_when>
    <thetext>To clarify.

&gt; When these colors also have some chroma/saturation they will be displayed as non-black/non-white.

This is the current behavior and that behavior is incorrect.

They must be black/white.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1979333</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-09-22 06:35:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/115892202&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>