<?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>198628</bug_id>
          
          <creation_ts>2019-06-06 16:04:32 -0700</creation_ts>
          <short_desc>SVG fill gradients don&apos;t support P3 color space</short_desc>
          <delta_ts>2020-05-24 18:05:09 -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>SVG</component>
          <version>Safari 12</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>macOS 10.14</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=212231</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>wk1</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dino</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>sam</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>thorton</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1542591</commentid>
    <comment_count>0</comment_count>
      <attachid>371534</attachid>
    <who name="">wk1</who>
    <bug_when>2019-06-06 16:04:32 -0700</bug_when>
    <thetext>Created attachment 371534
Test case

WebKit doesn&apos;t render gradients containing display-p3 colors correctly.

The attached SVG file shows a square filled with a blue linear gradient and a circle filled with a flat purple color. All colors are in display-p3 color space and are specified using CSS color() syntax. The circle renders as expected, but the fill of the square is white.

Environment:
Safari 12.1.1 (14607.2.6.1.1)
macOS 10.14.5 (18F132)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1542724</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-06-06 22:18:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/51511996&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1543459</commentid>
    <comment_count>2</comment_count>
    <who name="">wk1</who>
    <bug_when>2019-06-10 14:15:53 -0700</bug_when>
    <thetext>The bug is related to how WebCore incorporates the opacity of the stop into the color of the stop. For combining the stop&apos;s color and opacity, the color is converted to RGBA32, which doesn&apos;t work for extended (i.e. P3) colors.

There is a FIXME comment present that the current approach should be changed, but it notes that the corresponding member function of Color rounds the alpha component differently and is therefore not used.

https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/svg/SVGStopElement.cpp#L98

What is the suggested way to proceed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1655770</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2020-05-24 13:38:08 -0700</bug_when>
    <thetext>As of https://trac.webkit.org/changeset/262035/webkit, the gradient now shows up. I&apos;m not sure if it&apos;s using extended color correctly. yet.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1655779</commentid>
    <comment_count>4</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2020-05-24 18:03:17 -0700</bug_when>
    <thetext>Cool. We should probably add a test case for this then. Not sure what our best bet is. Ref-test vs. the same css gradient? Some pixel poking getImageData()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1655780</commentid>
    <comment_count>5</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2020-05-24 18:05:09 -0700</bug_when>
    <thetext>As for accuracy, I am also not sure. The general gradient code uses a color space called kCGColorSpaceExtendedSRGB when any stop contains an extended color. I haven&apos;t been able to find any good documentation on that colorspace and whether P3 is a subset of it. (Not mention, &quot;correct&quot; here is not really defined yet - https://github.com/w3c/csswg-drafts/issues/4647)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>371534</attachid>
            <date>2019-06-06 16:04:32 -0700</date>
            <delta_ts>2019-06-06 16:04:32 -0700</delta_ts>
            <desc>Test case</desc>
            <filename>p3-gradient-test.svg</filename>
            <type>image/svg+xml</type>
            <size>788</size>
            <attacher>wk1</attacher>
            
              <data encoding="base64">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjAwcHgi
IGhlaWdodD0iMjAwcHgiIHZpZXdCb3g9IjAgMCAyMDAgMjAwIiB2ZXJzaW9uPSIxLjEiIHhtbG5z
PSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMu
b3JnLzE5OTkveGxpbmsiPgogIDx0aXRsZT5QMzwvdGl0bGU+CiAgPGRlZnM+CiAgICAgICAgPGxp
bmVhckdyYWRpZW50IHgxPSI1MCUiIHkxPSIwJSIgeDI9IjUwJSIgeTI9IjEwMCUiIGlkPSJsaW5l
YXJHcmFkaWVudC0xIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iY29sb3IoZGlzcGxh
eS1wMyAwIDAuMyAxKSIgb2Zmc2V0PSIwJSI+PC9zdG9wPgogICAgICAgICAgICA8c3RvcCBzdG9w
LWNvbG9yPSJjb2xvcihkaXNwbGF5LXAzIDAgMC42IDEpIiBvZmZzZXQ9IjEwMCUiPjwvc3RvcD4K
ICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIg
c3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZl
bm9kZCI+CiAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZSIgZmlsbD0idXJsKCNsaW5lYXJHcmFk
aWVudC0xKSIgeD0iMCIgeT0iMCIgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiPjwvcmVjdD4KICAg
ICAgICA8Y2lyY2xlIGlkPSJPdmFsIiBmaWxsPSJjb2xvcihkaXNwbGF5LXAzIDEgMCAxKSIgY3g9
IjEwMCIgY3k9IjEwMCIgcj0iNzUiPjwvY2lyY2xlPgogICAgPC9nPgo8L3N2Zz4=
</data>

          </attachment>
      

    </bug>

</bugzilla>