<?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>296134</bug_id>
          
          <creation_ts>2025-07-17 10:39:56 -0700</creation_ts>
          <short_desc>REGRESSION(296337@main): currentcolor used in custom property no longer resolves correctly</short_desc>
          <delta_ts>2026-03-08 14:53:45 -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>New Bugs</component>
          <version>Safari 18</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/58355</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 name="Sam Weinig">sam</reporter>
          <assigned_to name="Sam Weinig">sam</assigned_to>
          <cc>benoit.rouleau</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2130878</commentid>
    <comment_count>0</comment_count>
      <attachid>476073</attachid>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-07-17 10:39:56 -0700</bug_when>
    <thetext>Created attachment 476073
Test Case

Benoît Rouleau (@benface) pointed out in https://github.com/w3c/csswg-drafts/issues/10371#issuecomment-3082053452 that we have a regression from 296337@main where `currentcolor` is no longer resolved correctly for rendering when used in a custom property:

https://codepen.io/benface/pen/KwddNvX

(Further simplified test case attached)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2130879</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-07-17 10:46:21 -0700</bug_when>
    <thetext>The issue is that during style building, rather than using the parsed content in the `Style::CustomProperty`, which has the correct &quot;currentcolor&quot; Style::Color in it, what we do is fall into a code path that calls, `Style::CustomProperty::tokens()`, and then re-parses the color.

`CustomProperty::tokens()` uses `CustomProperty::propertyValueSerialization()`, but with no RenderStyle available, we end up serializing to black by default.

Ideally we would just use the already parsed value in the CustomProperty, but I don&apos;t know enough about this code to understand why we don&apos;t.

So, barring that, I can see two solution:

1. Store the original tokens in the CustomProperty at creation so that we have exactly what is needed.
2. Add additional serialization logic needed for this case back.

I think 1 would less error prone.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2130880</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-07-17 10:47:02 -0700</bug_when>
    <thetext>I don&apos;t think this would be a trivial direct revert, as there has been a bit that has built on the serialization changes this provided.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2130888</commentid>
    <comment_count>3</comment_count>
    <who name="Benoît Rouleau">benoit.rouleau</who>
    <bug_when>2025-07-17 11:10:23 -0700</bug_when>
    <thetext>Thank you for filing this! 🙏 This bug is breaking this website in production: https://thegraph.com. Notice the icons in the header are now black instead of white.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2130890</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-07-17 11:14:06 -0700</bug_when>
    <thetext>&lt;rdar://problem/156076502&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2130899</commentid>
    <comment_count>5</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-07-17 11:40:22 -0700</bug_when>
    <thetext>Ok, given this is a real world regression, going to try to do a partial revert, and just do some name changing to make things work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2130925</commentid>
    <comment_count>6</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2025-07-17 12:38:36 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/48197</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2131184</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-07-18 10:08:21 -0700</bug_when>
    <thetext>Committed 297600@main (6496fbaca29d): &lt;https://commits.webkit.org/297600@main&gt;

Reviewed commits have been landed. Closing PR #48197 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2188234</commentid>
    <comment_count>8</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2026-03-08 14:53:45 -0700</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/58355</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>476073</attachid>
            <date>2025-07-17 10:39:56 -0700</date>
            <delta_ts>2025-07-17 10:39:56 -0700</delta_ts>
            <desc>Test Case</desc>
            <filename>test-custom-color-using-current-color.html</filename>
            <type>text/html</type>
            <size>292</size>
            <attacher name="Sam Weinig">sam</attacher>
            
              <data encoding="base64">PHN0eWxlPgogICAgQHByb3BlcnR5IC0tY29sb3IgewogICAgICBzeW50YXg6ICI8Y29sb3I+IjsK
ICAgICAgaW5oZXJpdHM6IGZhbHNlOwogICAgICBpbml0aWFsLXZhbHVlOiBjdXJyZW50Y29sb3I7
CiAgICB9CgogICAgZGl2IHsKICAgICAgY29sb3I6IHJlZDsKICAgIH0KCiAgICBzcGFuIHsKICAg
ICAgYmFja2dyb3VuZC1jb2xvcjogdmFyKC0tY29sb3IpOwogICAgfQo8L3N0eWxlPgo8cD5CbG9j
ayBiZWxvdyBzaG91bGQgYmUgYWxsIHJlZDwvcD4KPGRpdj4KICA8c3Bhbj5oZWxsbzwvc3Bhbj4K
PC9kaXY+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>