Re: [csswg-drafts] [css-pseudo] defaulting ‘color’ in :root highlights (#6774)

> I'm not sure it can just be a flag, because currentColor can be interpolated with other colors, can't it? As in, what if I do color: color-mix(currentColor, ...) or other such things?

Blink doesn’t support any advanced color features yet, but I think in that case we would still set the flag, indicating that ‘color’ is _dependent_ on currentColor. Once we know what currentColor will be — for now, that means during paint — we call whichever function we normally call to resolve (and possibly mix) color values.

‘text-shadow’ might prove tricky because it’s a list of shadows, each with a color value, but I think either the current approach (flag for the whole property) or moving the flag into Color (for more granularity) could work. The former is probably faster for us right now, because [unlike WebKit](https://github.com/WebKit/WebKit/blob/59325cece209b5aeca74be983fefd8e342a46ad0/Source/WebCore/platform/graphics/Color.h#L51-L54), our Color is still just a [newtype for rgba32](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/color.h;l=149-152;drc=e0b5aa26864e3541d9cf6362c2f46fb360ed7530).

> That is a bit unfortunate in general since it's a whack-a-mole and now all of the decoration code needs to be aware of this flag everywhere, right? So it can't really share much code with the rest of the painting code-paths.

Not really, in Blink, as most of the paint code lets the caller pass intermediate structs for text colors (TextPaintStyle) and decoration details (TextDecorationInfo, AppliedTextDecoration). The text fragment painter or highlight overlay painter decides what colors to fill those structs with (using helpers like [HighlightPaintingStyle](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/paint/highlight_painting_utils.cc;l=371-420;drc=d1b317d085e3bd288ffbb65d699a9448d74ca5ba)), but from there the logic is the same.

-- 
GitHub Notification of comment by delan
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6774#issuecomment-1127573350 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 16 May 2022 11:50:50 UTC