According to https://drafts.csswg.org/css-color/#resolving-color-values, currentColor should inherit as the keyword, not the resolved color.
Created attachment 358440 [details] Testcase
It looks like StyleColor was added for this, but it's not instantiated anywhere.
<rdar://problem/47287516>
This is a pretty frustrating bug in a number of common `currentColor` use-cases, not limited to: - Using `fill: currentColor` to get SVG fills in-sync with text colors - Changing link/button colors in different states, `currentColor` is a much more useful "reset" than something like `initial` - This is especially true with changing `text-decoration-color`
Created attachment 395368 [details] wip
Created attachment 395369 [details] wip
Created attachment 395385 [details] wip
Created attachment 395391 [details] wip
*** Bug 158782 has been marked as a duplicate of this bug. ***
Created attachment 395441 [details] patch
Comment on attachment 395441 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=395441&action=review > Source/WebCore/style/StyleBuilderState.cpp:-317 > - return m_style.color(); Setting setHasExplicitlyInheritedProperties shouldn't be needed here anymore, right? currentColor() doesn't depend on m_style.
Not that it matters that much though, better safe than sorry I guess...
Need to do some more checking to ensure there is nothing left that needs it. I'll try to remove it in a separate patch.
Comment on attachment 395441 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=395441&action=review > LayoutTests/fast/borders/border-color-inherit-expected.html:1 > +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> Maybe just <!DOCTYPE html> (and in the test too). > Source/WebCore/rendering/style/RenderStyle.h:1735 > + static Color currentColor() { return { }; } Maybe change initialTextEmphasisColor() to return curentColor(). > Source/WebCore/style/StyleBuilderState.cpp:324 > + // FIXME: 'currentcolor' should be resolved at use time to make it inherit correctly. You should file a bug on the FIXME and reference it here. That seems fairly important to fix. > Source/WebCore/svg/SVGStopElement.cpp:97 > + if (!stopColor.isValid()) > + stopColor = style.color(); A little helper function like RenderStyle::resolveCurrentColor or something would make this much more understandable.
Created attachment 395451 [details] patch
Created attachment 395453 [details] patch
Created attachment 395454 [details] patch
Committed r259532: <https://trac.webkit.org/changeset/259532> All reviewed patches have been landed. Closing bug and clearing flags on attachment 395454 [details].