<?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>285382</bug_id>
          
          <creation_ts>2025-01-04 04:06:56 -0800</creation_ts>
          <short_desc>Incorrect &quot;extension&quot; of CSS gradient with &quot;longer hue&quot; interpolation into regions beyond the first/last color stop</short_desc>
          <delta_ts>2025-06-04 22:26:13 -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>Layout and Rendering</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <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 name="Jonathan Kew">jfkthame</reporter>
          <assigned_to name="Simon Fraser (smfr)">simon.fraser</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>karlcow</cc>
    
    <cc>ntim</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2084854</commentid>
    <comment_count>0</comment_count>
    <who name="Jonathan Kew">jfkthame</who>
    <bug_when>2025-01-04 04:06:56 -0800</bug_when>
    <thetext>See attached example and description.

The CSS spec[1] is clear that when coloring a gradient,

&gt; Before the first color stop, the gradient line is the color of the first color stop, and after the last color stop, the gradient line is the color of the last color stop.

Therefore, if the first color stop is not at (or before) zero, there will be a region of solid color from the beginning of the gradient line to the first color stop, using the color of that first stop. Similarly, if the last color stop falls before the end of the gradient line, there will be a region of solid color at the end.

However, when using &quot;longer hue&quot; interpolation, webkit renders such cases incorrectly, applying unwanted interpolation in these regions that should have solid first or last color.

(See also Gecko issue https://bugzilla.mozilla.org/show_bug.cgi?id=1939948 and Blink issue https://issues.chromium.org/issues/387475844.)

[1] https://drafts.csswg.org/css-images-4/#coloring-gradient-line</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2084855</commentid>
    <comment_count>1</comment_count>
      <attachid>473772</attachid>
    <who name="Jonathan Kew">jfkthame</who>
    <bug_when>2025-01-04 04:07:24 -0800</bug_when>
    <thetext>Created attachment 473772
testcase describing and illustrating the bug</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086575</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-01-11 04:07:12 -0800</bug_when>
    <thetext>&lt;rdar://problem/142738948&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2121579</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2025-06-03 20:19:01 -0700</bug_when>
    <thetext>This happens because we follow the &quot;longer hue&quot; logic at https://www.w3.org/TR/css-color-4/#hue-longer for the 0-25% range and the 75% to 100% ranges as well as the stops in between (code in `interpolateColorComponents()`).

I&apos;m a little surprised that going from red to red with `longer hue` hits all the colors, but that&apos;s what other browsers do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2121580</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2025-06-03 20:24:38 -0700</bug_when>
    <thetext>This is tested by css/css-images/gradient/gradient-single-stop-longer-hue-hsl-002.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2121584</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2025-06-03 21:08:59 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/46303</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2121870</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-06-04 22:26:11 -0700</bug_when>
    <thetext>Committed 295860@main (ae2fd930ce5b): &lt;https://commits.webkit.org/295860@main&gt;

Reviewed commits have been landed. Closing PR #46303 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>473772</attachid>
            <date>2025-01-04 04:07:24 -0800</date>
            <delta_ts>2025-01-04 04:07:24 -0800</delta_ts>
            <desc>testcase describing and illustrating the bug</desc>
            <filename>longer-hue-extension-bug.html</filename>
            <type>text/html</type>
            <size>3128</size>
            <attacher name="Jonathan Kew">jfkthame</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxtZXRhIGNoYXJzZXQ9dXRmLTg+Cgo8c3R5bGU+CmRpdi5zd2F0Y2gg
ewogIHdpZHRoOiA0MDBweDsKICBoZWlnaHQ6IDUwcHg7CiAgZm9udC1zaXplOiAwOwp9CmRpdi50
ZXN0IHsKICBiYWNrZ3JvdW5kOiBsaW5lYXItZ3JhZGllbnQoCiAgICB0byByaWdodCBpbiBoc2wg
bG9uZ2VyIGh1ZSwKICAgICAgZ3JlZW4gMjUlLAogICAgICByZWQgMjUlLAogICAgICByZWQgNzUl
LAogICAgICBwaW5rIDc1JQogICk7Cn0KLnJlZiBkaXYgewogIGRpc3BsYXk6IGlubGluZS1ibG9j
azsKICBoZWlnaHQ6IDEwMCU7Cn0KLnJlZiBkaXY6bnRoLWNoaWxkKDEpLCAucmVmIGRpdjpudGgt
Y2hpbGQoMykgewogIHdpZHRoOiAxMDBweDsKfQoucmVmIGRpdjpudGgtY2hpbGQoMikgewogIHdp
ZHRoOiAyMDBweDsKfQouZ3JlZW4gewogIGJhY2tncm91bmQ6IG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