Bug 296134

Summary: REGRESSION(296337@main): currentcolor used in custom property no longer resolves correctly
Product: WebKit Reporter: Sam Weinig <sam>
Component: New BugsAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: benoit.rouleau, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 18   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test Case none

Sam Weinig
Reported 2025-07-17 10:39:56 PDT
Created attachment 476073 [details] 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)
Attachments
Test Case (292 bytes, text/html)
2025-07-17 10:39 PDT, Sam Weinig
no flags
Sam Weinig
Comment 1 2025-07-17 10:46:21 PDT
The issue is that during style building, rather than using the parsed content in the `Style::CustomProperty`, which has the correct "currentcolor" 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't know enough about this code to understand why we don'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.
Sam Weinig
Comment 2 2025-07-17 10:47:02 PDT
I don't think this would be a trivial direct revert, as there has been a bit that has built on the serialization changes this provided.
Benoît Rouleau
Comment 3 2025-07-17 11:10:23 PDT
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.
Radar WebKit Bug Importer
Comment 4 2025-07-17 11:14:06 PDT
Sam Weinig
Comment 5 2025-07-17 11:40:22 PDT
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.
Sam Weinig
Comment 6 2025-07-17 12:38:36 PDT
EWS
Comment 7 2025-07-18 10:08:21 PDT
Committed 297600@main (6496fbaca29d): <https://commits.webkit.org/297600@main> Reviewed commits have been landed. Closing PR #48197 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.