Title: [259532] trunk
Revision
259532
Author
[email protected]
Date
2020-04-04 11:16:25 -0700 (Sat, 04 Apr 2020)

Log Message

Implement the css-color-4 behavior for inheritance of currentColor
https://bugs.webkit.org/show_bug.cgi?id=193171
<rdar://problem/47287516>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-text-decor/parsing/text-decoration-color-computed-expected.txt:
* web-platform-tests/css/css-transitions/currentcolor-animation-001-expected.txt:
* web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt:

Source/WebCore:

In CSS3/4 'currentcolor' inherits as 'currentcolor' instead of as a resolved color value.

Value 'currentcolor' is represented in RenderStyle as invalid Color object. This has been true
even before the explicit property value for it was added. Fallback to 'color' has always been
the default behavior of most color properties.

As a result the correct behavior falls pretty easily from WebKit code. It essentially amounts to allowing
color properties to inherit normally even when they are invalid/currentcolor.

In future we might want to wrap RenderStyle color values into a type that makes 'currentcolor' more explicit.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSGradientValue.cpp:
(WebCore::CSSGradientValue::gradientWithStylesResolved):
* css/CSSProperties.json:

- Remove 'no-default-color' which triggered to old inheritance behavior.
- Rename initial value invalidColor to currentColor for clarity.

* css/makeprop.pl:

Code for 'no-default-color' generation is not needed anymore.

(generateInheritValueSetter):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::colorIncludingFallback const):

Resolve 'background-color' like the rest so setting it to 'currentcolor' works correctly.

* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::currentColor):
(WebCore::RenderStyle::invalidColor): Deleted.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyTextOrBoxShadowValue):
* style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::createFilterOperations):
(WebCore::Style::BuilderState::colorFromPrimitiveValue const):

Don't resolve 'currentcolor', instead return it as a value.

(WebCore::Style::BuilderState::colorFromPrimitiveValueWithResolvedCurrentColor const):

Helper for a few cases where we still resolve current color during style building time. It is
used for filters and generated images.

* style/StyleBuilderState.h:
* svg/SVGStopElement.cpp:
(WebCore::SVGStopElement::stopColorIncludingOpacity const):

Resolve 'currentcolor' during use time for svg color stops.

LayoutTests:

* TestExpectations:
* fast/borders/border-color-inherit-expected.html: Copied from LayoutTests/fast/borders/border-color-inherit.html.
* fast/borders/border-color-inherit.html:

Fix for the new behavior and make it a reftest.

* fast/css/webkit-text-fill-color-inherit.html:
* platform/gtk/fast/borders/border-color-inherit-expected.png: Removed.
* platform/gtk/fast/borders/border-color-inherit-expected.txt: Removed.
* platform/ios/fast/borders/border-color-inherit-expected.txt: Removed.
* platform/mac/fast/borders/border-color-inherit-expected.png: Removed.
* platform/mac/fast/borders/border-color-inherit-expected.txt: Removed.
* platform/win/fast/borders/border-color-inherit-expected.txt: Removed.
* platform/wincairo/fast/borders/border-color-inherit-expected.txt: Removed.
* platform/wpe/fast/borders/border-color-inherit-expected.txt: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (259531 => 259532)


--- trunk/LayoutTests/ChangeLog	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/ChangeLog	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,3 +1,27 @@
+2020-04-04  Antti Koivisto  <[email protected]>
+
+        Implement the css-color-4 behavior for inheritance of currentColor
+        https://bugs.webkit.org/show_bug.cgi?id=193171
+        <rdar://problem/47287516>
+
+        Reviewed by Simon Fraser.
+
+        * TestExpectations:
+        * fast/borders/border-color-inherit-expected.html: Copied from LayoutTests/fast/borders/border-color-inherit.html.
+        * fast/borders/border-color-inherit.html:
+
+        Fix for the new behavior and make it a reftest.
+
+        * fast/css/webkit-text-fill-color-inherit.html:
+        * platform/gtk/fast/borders/border-color-inherit-expected.png: Removed.
+        * platform/gtk/fast/borders/border-color-inherit-expected.txt: Removed.
+        * platform/ios/fast/borders/border-color-inherit-expected.txt: Removed.
+        * platform/mac/fast/borders/border-color-inherit-expected.png: Removed.
+        * platform/mac/fast/borders/border-color-inherit-expected.txt: Removed.
+        * platform/win/fast/borders/border-color-inherit-expected.txt: Removed.
+        * platform/wincairo/fast/borders/border-color-inherit-expected.txt: Removed.
+        * platform/wpe/fast/borders/border-color-inherit-expected.txt: Removed.
+
 2020-04-04  Peng Liu  <[email protected]>
 
         REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS

Modified: trunk/LayoutTests/TestExpectations (259531 => 259532)


--- trunk/LayoutTests/TestExpectations	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/TestExpectations	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1815,9 +1815,6 @@
 
 webkit.org/b/148650 fast/repaint/add-table-overpaint.html [ Pass Failure ]
 
-imported/w3c/web-platform-tests/css/css-cascade/all-prop-inherit-color.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-color.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-cascade/all-prop-unset-color.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-cascade/important-prop.html [ ImageOnlyFailure ]
 webkit.org/b/187093 [ Debug ] imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.html [ Skip ]
 
@@ -1843,9 +1840,7 @@
 imported/w3c/web-platform-tests/css/css-color/lch-007.html [ Skip ]
 
 # Initial failures on the import of css-color
-imported/w3c/web-platform-tests/css/css-color/currentcolor-002.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-color/t31-color-text-a.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-color/t44-currentcolor-inherited-c.xht [ ImageOnlyFailure ]
 
 # Need to re-import canvas tests
 webkit.org/b/193042 imported/w3c/canvas/2d.fillStyle.parse.invalid.rgb-1.html [ Failure ]
@@ -1896,7 +1891,6 @@
 imported/w3c/web-platform-tests/css/css-multicol/multicol-nested-margin-004.xht [ ImageOnlyFailure ] 
 imported/w3c/web-platform-tests/css/css-multicol/multicol-nested-margin-005.xht [ ImageOnlyFailure ] 
 webkit.org/b/148816 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-004.xht [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-color-inherit-002.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-nested-balancing-001.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-nested-balancing-002.html
 imported/w3c/web-platform-tests/css/css-multicol/multicol-rule-nested-balancing-003.html

Copied: trunk/LayoutTests/fast/borders/border-color-inherit-expected.html (from rev 259531, trunk/LayoutTests/fast/borders/border-color-inherit.html) (0 => 259532)


--- trunk/LayoutTests/fast/borders/border-color-inherit-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/border-color-inherit-expected.html	2020-04-04 18:16:25 UTC (rev 259532)
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+ <head>
+  <title>CSS inheritance: border-color</title>
+  <style type="text/css">
+   .test { display: block; color: green; border: none;}
+   .test .inner { border-color: inherit; border-style: solid; }
+   .test2 {margin: 1em 0 0;}
+   .test2 .inner {border-right-color: inherit; border-bottom-color: inherit; border-top-color: inherit;}
+   .test3 {margin: 1em 0 0; border: 3px solid; }
+   .test3 .inner {border-top: inherit; border-right: inherit; border-left: inherit; border-bottom: inherit; border-top-width: 3px; border-top-style: solid; border-right-width: 3px; border-right-style: solid; border-left-width: 3px; border-left-style: solid; border-bottom-width: 3px; border-bottom-style: solid;}
+  </style>
+ </head>
+ <body>
+  <div class="test">
+   <div class="inner">
+    <div class="text">
+     This should have a green border.
+    </div>
+   </div>
+  </div>
+  <div class="test test2">
+   <div class="inner">
+    <div class="text">
+     This too.
+    </div>
+   </div>
+  </div>
+  <div class="test test3">
+   <div class="inner">
+    <div class="text">
+     This too.
+    </div>
+   </div>
+  </div>
+ </body>
+</html>

Modified: trunk/LayoutTests/fast/borders/border-color-inherit.html (259531 => 259532)


--- trunk/LayoutTests/fast/borders/border-color-inherit.html	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/fast/borders/border-color-inherit.html	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,14 +1,14 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<!doctype html>
 <html>
  <head>
   <title>CSS inheritance: border-color</title>
   <style type="text/css">
-   .test { display: block; color: green; border: none;}
-   .test .inner { border-color: inherit; border-style: solid; color: red; }
+   .test { display: block; color: red; border: none;}
+   .test .inner { border-color: inherit; border-style: solid; color: green; }
    .test .inner .text { color: green;}
    .test2 {margin: 1em 0 0;}
    .test2 .inner {border-right-color: inherit; border-bottom-color: inherit; border-top-color: inherit;}
-   .test3 {margin: 1em 0 0; border: 3px solid;}
+   .test3 {margin: 1em 0 0; border: 3px solid; color: green }
    .test3 .inner {border-top: inherit; border-right: inherit; border-left: inherit; border-bottom: inherit; border-top-width: 3px; border-top-style: solid; border-right-width: 3px; border-right-style: solid; border-left-width: 3px; border-left-style: solid; border-bottom-width: 3px; border-bottom-style: solid;}
   </style>
  </head>
@@ -16,9 +16,7 @@
   <div class="test">
    <div class="inner">
     <div class="text">
-     This should have a green border, because the computed value of
-     'border-color' set to its initial value is the computed value
-     of 'color', which is then inherited as a color.
+     This should have a green border.
     </div>
    </div>
   </div>

Modified: trunk/LayoutTests/fast/css/webkit-text-fill-color-inherit.html (259531 => 259532)


--- trunk/LayoutTests/fast/css/webkit-text-fill-color-inherit.html	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/fast/css/webkit-text-fill-color-inherit.html	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,8 +1,8 @@
 <!DOCTYPE html>
 <html>
 <body>
-    <div style="color: green">
-        <div id="undefined-parent" style="color: red; -webkit-text-fill-color: inherit">Green</div>
+    <div style="color: red">
+        <div id="undefined-parent" style="color: green; -webkit-text-fill-color: inherit">Green</div>
     </div>
     <div style="color: purple; -webkit-text-fill-color: green">
         <div id="defined-parent" style="color: red; -webkit-text-fill-color: inherit">Green</div>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (259531 => 259532)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,3 +1,15 @@
+2020-04-04  Antti Koivisto  <[email protected]>
+
+        Implement the css-color-4 behavior for inheritance of currentColor
+        https://bugs.webkit.org/show_bug.cgi?id=193171
+        <rdar://problem/47287516>
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-text-decor/parsing/text-decoration-color-computed-expected.txt:
+        * web-platform-tests/css/css-transitions/currentcolor-animation-001-expected.txt:
+        * web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt:
+
 2020-03-30  Devin Rousso  <[email protected]>
 
         [CSS Selectors 4] Add support for `:is()` with the same logic for the existing `:matches()`

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text-decor/parsing/text-decoration-color-computed-expected.txt (259531 => 259532)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text-decor/parsing/text-decoration-color-computed-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text-decor/parsing/text-decoration-color-computed-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,5 +1,5 @@
 
 PASS Property text-decoration-color value 'rgb(0, 0, 255)' computes to 'rgb(0, 0, 255)' 
 PASS Property text-decoration-color value 'currentcolor' computes to 'rgb(0, 255, 0)' 
-FAIL Property text-decoration-color value 'inherit' computes to 'rgb(0, 255, 0)' assert_equals: expected "rgb(0, 255, 0)" but got "rgb(255, 0, 0)"
+PASS Property text-decoration-color value 'inherit' computes to 'rgb(0, 255, 0)' 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/currentcolor-animation-001-expected.txt (259531 => 259532)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/currentcolor-animation-001-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/currentcolor-animation-001-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,3 +1,3 @@
 
-FAIL Transition does not occur when the value is currentcolor and color changes assert_true: expected true got false
+PASS Transition does not occur when the value is currentcolor and color changes 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt (259531 => 259532)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/pservers/scripted/stop-color-inheritance-currentcolor-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,3 +1,3 @@
 
-FAIL "currentcolor" is inherited as a keyword assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
+PASS "currentcolor" is inherited as a keyword 
 

Deleted: trunk/LayoutTests/platform/gtk/fast/borders/border-color-inherit-expected.png


(Binary files differ)

Deleted: trunk/LayoutTests/platform/gtk/fast/borders/border-color-inherit-expected.txt (259531 => 259532)


--- trunk/LayoutTests/platform/gtk/fast/borders/border-color-inherit-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/platform/gtk/fast/borders/border-color-inherit-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,22 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x144
-  RenderBlock {HTML} at (0,0) size 800x144
-    RenderBody {BODY} at (8,8) size 784x128
-      RenderBlock {DIV} at (0,0) size 784x42 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x42 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x36 [color=#008000]
-            RenderText {#text} at (0,0) size 766x35
-              text run at (0,0) width 409: "This should have a green border, because the computed value of "
-              text run at (408,0) width 358: "'border-color' set to its initial value is the computed value"
-              text run at (0,18) width 274: "of 'color', which is then inherited as a color."
-      RenderBlock {DIV} at (0,58) size 784x24 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x18 [color=#008000]
-            RenderText {#text} at (0,0) size 56x17
-              text run at (0,0) width 56: "This too."
-      RenderBlock {DIV} at (0,98) size 784x30 [color=#008000] [border: (3px solid #008000)]
-        RenderBlock {DIV} at (3,3) size 778x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 772x18 [color=#008000]
-            RenderText {#text} at (0,0) size 56x17
-              text run at (0,0) width 56: "This too."

Deleted: trunk/LayoutTests/platform/ios/fast/borders/border-color-inherit-expected.txt (259531 => 259532)


--- trunk/LayoutTests/platform/ios/fast/borders/border-color-inherit-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/platform/ios/fast/borders/border-color-inherit-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,23 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x152
-  RenderBlock {HTML} at (0,0) size 800x152
-    RenderBody {BODY} at (8,8) size 784x136
-      RenderBlock {DIV} at (0,0) size 784x46 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x46 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x40 [color=#008000]
-            RenderText {#text} at (0,0) size 743x39
-              text run at (0,0) width 415: "This should have a green border, because the computed value of "
-              text run at (414,0) width 329: "'border-color' set to its initial value is the computed"
-              text run at (0,20) width 39: "value "
-              text run at (38,20) width 280: "of 'color', which is then inherited as a color."
-      RenderBlock {DIV} at (0,62) size 784x26 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x26 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x20 [color=#008000]
-            RenderText {#text} at (0,0) size 57x19
-              text run at (0,0) width 57: "This too."
-      RenderBlock {DIV} at (0,104) size 784x32 [color=#008000] [border: (3px solid #008000)]
-        RenderBlock {DIV} at (3,3) size 778x26 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 772x20 [color=#008000]
-            RenderText {#text} at (0,0) size 57x19
-              text run at (0,0) width 57: "This too."

Deleted: trunk/LayoutTests/platform/mac/fast/borders/border-color-inherit-expected.png


(Binary files differ)

Deleted: trunk/LayoutTests/platform/mac/fast/borders/border-color-inherit-expected.txt (259531 => 259532)


--- trunk/LayoutTests/platform/mac/fast/borders/border-color-inherit-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/platform/mac/fast/borders/border-color-inherit-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,23 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x144
-  RenderBlock {HTML} at (0,0) size 800x144
-    RenderBody {BODY} at (8,8) size 784x128
-      RenderBlock {DIV} at (0,0) size 784x42 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x42 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x36 [color=#008000]
-            RenderText {#text} at (0,0) size 743x36
-              text run at (0,0) width 415: "This should have a green border, because the computed value of "
-              text run at (414,0) width 329: "'border-color' set to its initial value is the computed"
-              text run at (0,18) width 39: "value "
-              text run at (38,18) width 280: "of 'color', which is then inherited as a color."
-      RenderBlock {DIV} at (0,58) size 784x24 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x18 [color=#008000]
-            RenderText {#text} at (0,0) size 57x18
-              text run at (0,0) width 57: "This too."
-      RenderBlock {DIV} at (0,98) size 784x30 [color=#008000] [border: (3px solid #008000)]
-        RenderBlock {DIV} at (3,3) size 778x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 772x18 [color=#008000]
-            RenderText {#text} at (0,0) size 57x18
-              text run at (0,0) width 57: "This too."

Deleted: trunk/LayoutTests/platform/win/fast/borders/border-color-inherit-expected.txt (259531 => 259532)


--- trunk/LayoutTests/platform/win/fast/borders/border-color-inherit-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/platform/win/fast/borders/border-color-inherit-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,22 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x144
-  RenderBlock {HTML} at (0,0) size 800x144
-    RenderBody {BODY} at (8,8) size 784x128
-      RenderBlock {DIV} at (0,0) size 784x42 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x42 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x36 [color=#008000]
-            RenderText {#text} at (0,0) size 766x36
-              text run at (0,0) width 409: "This should have a green border, because the computed value of "
-              text run at (409,0) width 357: "'border-color' set to its initial value is the computed value"
-              text run at (0,18) width 274: "of 'color', which is then inherited as a color."
-      RenderBlock {DIV} at (0,58) size 784x24 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x18 [color=#008000]
-            RenderText {#text} at (0,0) size 56x18
-              text run at (0,0) width 56: "This too."
-      RenderBlock {DIV} at (0,98) size 784x30 [color=#008000] [border: (3px solid #008000)]
-        RenderBlock {DIV} at (3,3) size 778x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 772x18 [color=#008000]
-            RenderText {#text} at (0,0) size 56x18
-              text run at (0,0) width 56: "This too."

Deleted: trunk/LayoutTests/platform/wincairo/fast/borders/border-color-inherit-expected.txt (259531 => 259532)


--- trunk/LayoutTests/platform/wincairo/fast/borders/border-color-inherit-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/platform/wincairo/fast/borders/border-color-inherit-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,23 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x152
-  RenderBlock {HTML} at (0,0) size 800x152
-    RenderBody {BODY} at (8,8) size 784x136
-      RenderBlock {DIV} at (0,0) size 784x46 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x46 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x40 [color=#008000]
-            RenderText {#text} at (0,0) size 748x39
-              text run at (0,0) width 391: "This should have a green border, because the computed value of "
-              text run at (391,0) width 345: "'border-color' set to its initial value is the computed value "
-              text run at (736,0) width 12: "of"
-              text run at (0,20) width 244: "'color', which is then inherited as a color."
-      RenderBlock {DIV} at (0,62) size 784x26 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x26 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x20 [color=#008000]
-            RenderText {#text} at (0,0) size 53x19
-              text run at (0,0) width 53: "This too."
-      RenderBlock {DIV} at (0,104) size 784x32 [color=#008000] [border: (3px solid #008000)]
-        RenderBlock {DIV} at (3,3) size 778x26 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 772x20 [color=#008000]
-            RenderText {#text} at (0,0) size 53x19
-              text run at (0,0) width 53: "This too."

Deleted: trunk/LayoutTests/platform/wpe/fast/borders/border-color-inherit-expected.txt (259531 => 259532)


--- trunk/LayoutTests/platform/wpe/fast/borders/border-color-inherit-expected.txt	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/LayoutTests/platform/wpe/fast/borders/border-color-inherit-expected.txt	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,22 +0,0 @@
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x144
-  RenderBlock {HTML} at (0,0) size 800x144
-    RenderBody {BODY} at (8,8) size 784x128
-      RenderBlock {DIV} at (0,0) size 784x42 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x42 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x36 [color=#008000]
-            RenderText {#text} at (0,0) size 766x35
-              text run at (0,0) width 409: "This should have a green border, because the computed value of "
-              text run at (409,0) width 357: "'border-color' set to its initial value is the computed value"
-              text run at (0,18) width 274: "of 'color', which is then inherited as a color."
-      RenderBlock {DIV} at (0,58) size 784x24 [color=#008000]
-        RenderBlock {DIV} at (0,0) size 784x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 778x18 [color=#008000]
-            RenderText {#text} at (0,0) size 56x17
-              text run at (0,0) width 56: "This too."
-      RenderBlock {DIV} at (0,98) size 784x30 [color=#008000] [border: (3px solid #008000)]
-        RenderBlock {DIV} at (3,3) size 778x24 [color=#FF0000] [border: (3px solid #008000)]
-          RenderBlock {DIV} at (3,3) size 772x18 [color=#008000]
-            RenderText {#text} at (0,0) size 56x17
-              text run at (0,0) width 56: "This too."

Modified: trunk/Source/WebCore/ChangeLog (259531 => 259532)


--- trunk/Source/WebCore/ChangeLog	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/ChangeLog	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1,3 +1,65 @@
+2020-04-04  Antti Koivisto  <[email protected]>
+
+        Implement the css-color-4 behavior for inheritance of currentColor
+        https://bugs.webkit.org/show_bug.cgi?id=193171
+        <rdar://problem/47287516>
+
+        Reviewed by Simon Fraser.
+
+        In CSS3/4 'currentcolor' inherits as 'currentcolor' instead of as a resolved color value.
+
+        Value 'currentcolor' is represented in RenderStyle as invalid Color object. This has been true
+        even before the explicit property value for it was added. Fallback to 'color' has always been
+        the default behavior of most color properties.
+
+        As a result the correct behavior falls pretty easily from WebKit code. It essentially amounts to allowing
+        color properties to inherit normally even when they are invalid/currentcolor.
+
+        In future we might want to wrap RenderStyle color values into a type that makes 'currentcolor' more explicit.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSGradientValue::gradientWithStylesResolved):
+        * css/CSSProperties.json:
+
+        - Remove 'no-default-color' which triggered to old inheritance behavior.
+        - Rename initial value invalidColor to currentColor for clarity.
+
+        * css/makeprop.pl:
+
+        Code for 'no-default-color' generation is not needed anymore.
+
+        (generateInheritValueSetter):
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::colorIncludingFallback const):
+
+        Resolve 'background-color' like the rest so setting it to 'currentcolor' works correctly.
+
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::currentColor):
+        (WebCore::RenderStyle::invalidColor): Deleted.
+        * style/StyleBuilderCustom.h:
+        (WebCore::Style::BuilderCustom::applyTextOrBoxShadowValue):
+        * style/StyleBuilderState.cpp:
+        (WebCore::Style::BuilderState::createFilterOperations):
+        (WebCore::Style::BuilderState::colorFromPrimitiveValue const):
+
+        Don't resolve 'currentcolor', instead return it as a value.
+
+        (WebCore::Style::BuilderState::colorFromPrimitiveValueWithResolvedCurrentColor const):
+
+        Helper for a few cases where we still resolve current color during style building time. It is
+        used for filters and generated images.
+
+        * style/StyleBuilderState.h:
+        * svg/SVGStopElement.cpp:
+        (WebCore::SVGStopElement::stopColorIncludingOpacity const):
+
+        Resolve 'currentcolor' during use time for svg color stops.
+
 2020-04-04  Peng Liu  <[email protected]>
 
         REGRESSION (r259095): ASSERTION FAILED: m_videoFullscreenMode != VideoFullscreenModeNone seen with TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (259531 => 259532)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2020-04-04 18:16:25 UTC (rev 259532)
@@ -2456,7 +2456,7 @@
             break;
 
         case CSSPropertyBackgroundColor:
-            return cssValuePool.createColorValue(m_allowVisitedStyle? style.visitedDependentColor(CSSPropertyBackgroundColor) : style.backgroundColor());
+            return m_allowVisitedStyle ? cssValuePool.createColorValue(style.visitedDependentColor(CSSPropertyBackgroundColor)) : currentColorOrValidColor(&style, style.backgroundColor());
         case CSSPropertyBackgroundImage:
         case CSSPropertyWebkitMaskImage: {
             auto& layers = propertyID == CSSPropertyWebkitMaskImage ? style.maskLayers() : style.backgroundLayers();

Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (259531 => 259532)


--- trunk/Source/WebCore/css/CSSGradientValue.cpp	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp	2020-04-04 18:16:25 UTC (rev 259532)
@@ -111,7 +111,7 @@
 {
     auto result = hasColorDerivedFromElement() ? clone(*this) : makeRef(*this);
     resolveStopColors(result->m_stops, [&](const CSSPrimitiveValue& colorValue) {
-        return builderState.colorFromPrimitiveValue(colorValue);
+        return builderState.colorFromPrimitiveValueWithResolvedCurrentColor(colorValue);
     });
     return result;
 }

Modified: trunk/Source/WebCore/css/CSSProperties.json (259531 => 259532)


--- trunk/Source/WebCore/css/CSSProperties.json	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/css/CSSProperties.json	2020-04-04 18:16:25 UTC (rev 259532)
@@ -88,11 +88,6 @@
         "The regular setter on RenderStyle will only be called if",
         "StyleResolver::applyPropertyToRegularStyle() returns true.",
         "",
-        "* no-default-color:",
-        "Should only be used with \"VisitedLinkColorSupport\". It indicates that when",
-        "setting the inherited value, it will not fallback to using the parent's",
-        "\"color\" property if the inherited color is invalid.",
-        "",
         "* font-property:",
         "Indicates that this CSS property is font-related. It must have corresponding",
         "methods on the FontDescription class.",
@@ -184,7 +179,7 @@
         "caret-color" : {
             "inherited": true,
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "specification": {
@@ -196,7 +191,6 @@
             "inherited": true,
             "codegen-properties": {
                 "visited-link-color-support": true,
-                "no-default-color": true,
                 "high-priority": true
             },
             "status": {
@@ -1059,8 +1053,7 @@
         },
         "background-color": {
             "codegen-properties": {
-                "visited-link-color-support": true,
-                "no-default-color": true
+                "visited-link-color-support": true
             },
             "specification": {
                 "category": "css-backgrounds",
@@ -1420,7 +1413,7 @@
         },
         "border-bottom-color": {
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "specification": {
@@ -1773,7 +1766,7 @@
         },
         "border-left-color": {
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "specification": {
@@ -1841,7 +1834,7 @@
         },
         "border-right-color": {
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "specification": {
@@ -1922,7 +1915,7 @@
         },
         "border-top-color": {
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "specification": {
@@ -3196,7 +3189,7 @@
         },
         "outline-color": {
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "specification": {
@@ -3743,7 +3736,7 @@
             "inherited": true,
             "codegen-properties": {
                 "custom": "Value",
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "status": "supported",
@@ -4841,7 +4834,7 @@
                 "aliases": [
                     "-webkit-column-rule-color"
                 ],
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "specification":  {
@@ -6175,7 +6168,7 @@
         },
         "text-decoration-color": {
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true,
                 "aliases": [
                     "-webkit-text-decoration-color"
@@ -6288,7 +6281,7 @@
                     "-epub-text-emphasis-color",
                     "text-emphasis-color"
                 ],
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "status": {
@@ -6335,7 +6328,7 @@
         "-webkit-text-fill-color": {
             "inherited": true,
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "status": {
@@ -6366,7 +6359,7 @@
         "-webkit-text-stroke-color": {
             "inherited": true,
             "codegen-properties": {
-                "initial": "invalidColor",
+                "initial": "currentColor",
                 "visited-link-color-support": true
             },
             "status": {

Modified: trunk/Source/WebCore/css/makeprop.pl (259531 => 259532)


--- trunk/Source/WebCore/css/makeprop.pl	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/css/makeprop.pl	2020-04-04 18:16:25 UTC (rev 259532)
@@ -77,7 +77,6 @@
     "initial" => 1,
     "longhands" => 1,
     "name-for-methods" => 1,
-    "no-default-color" => 1,
     "svg" => 1,
     "skip-builder" => 1,
     "setter" => 1,
@@ -980,10 +979,6 @@
     $setterContent .= $indent . "    }\n";
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"visited-link-color-support"}) {
     $setterContent .= $indent . "    Color color = " . $parentStyle . "." . $getter . "();\n";
-    if (!exists($propertiesWithStyleBuilderOptions{$name}{"no-default-color"})) {
-      $setterContent .= $indent . "    if (!color.isValid())\n";
-      $setterContent .= $indent . "        color = " . $parentStyle . ".color();\n";
-    }
     $setterContent .= generateColorValueSetter($name, "color", $indent . "    ");
     $didCallSetValue = 1;
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"animatable"}) {

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (259531 => 259532)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1587,7 +1587,7 @@
 
         new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor),
 
-        new PropertyWrapperVisitedAffectedColor(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor),
+        new PropertyWrapperVisitedAffectedColor(CSSPropertyBackgroundColor, MaybeInvalidColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor),
 
         new FillLayersPropertyWrapper(CSSPropertyBackgroundImage, &RenderStyle::backgroundLayers, &RenderStyle::ensureBackgroundLayers),
         new StyleImagePropertyWrapper(CSSPropertyListStyleImage, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage),

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (259531 => 259532)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1953,7 +1953,8 @@
     BorderStyle borderStyle = BorderStyle::None;
     switch (colorProperty) {
     case CSSPropertyBackgroundColor:
-        return visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); // Background color doesn't fall back.
+        result = visitedLink ? visitedLinkBackgroundColor() : backgroundColor();
+        break;
     case CSSPropertyBorderLeftColor:
         result = visitedLink ? visitedLinkBorderLeftColor() : borderLeftColor();
         borderStyle = borderLeftStyle();
@@ -2011,6 +2012,14 @@
     return result;
 }
 
+Color RenderStyle::colorResolvingCurrentColor(const Color& color) const
+{
+    if (color == currentColor())
+        return this->color();
+
+    return color;
+}
+
 Color RenderStyle::visitedDependentColor(CSSPropertyID colorProperty) const
 {
     Color unvisitedColor = colorIncludingFallback(colorProperty, false);

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (259531 => 259532)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2020-04-04 18:16:25 UTC (rev 259532)
@@ -1440,6 +1440,7 @@
     bool lastChildState() const { return m_nonInheritedFlags.lastChildState; }
     void setLastChildState() { setUnique(); m_nonInheritedFlags.lastChildState = true; }
 
+    Color colorResolvingCurrentColor(const Color&) const;
     WEBCORE_EXPORT Color visitedDependentColor(CSSPropertyID) const;
     WEBCORE_EXPORT Color visitedDependentColorWithColorFilter(CSSPropertyID) const;
 
@@ -1584,7 +1585,7 @@
     static Length initialPerspectiveOriginX() { return Length(50.0f, Percent); }
     static Length initialPerspectiveOriginY() { return Length(50.0f, Percent); }
     static Color initialBackgroundColor() { return Color::transparent; }
-    static Color initialTextEmphasisColor() { return Color(); }
+    static Color initialTextEmphasisColor() { return currentColor(); }
     static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFill::Filled; }
     static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMark::None; }
     static const AtomString& initialTextEmphasisCustomMark() { return nullAtom(); }
@@ -1731,7 +1732,8 @@
     void getShadowInlineDirectionExtent(const ShadowData*, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const;
     void getShadowBlockDirectionExtent(const ShadowData*, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const;
 
-    static Color invalidColor() { return Color(); }
+    // In RenderStyle invalid color value is used to signify 'currentcolor' which resolves to color().
+    static Color currentColor() { return { }; }
     const Color& borderLeftColor() const { return m_surroundData->border.left().color(); }
     const Color& borderRightColor() const { return m_surroundData->border.right().color(); }
     const Color& borderTopColor() const { return m_surroundData->border.top().color(); }

Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (259531 => 259532)


--- trunk/Source/WebCore/style/StyleBuilderCustom.h	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h	2020-04-04 18:16:25 UTC (rev 259532)
@@ -819,9 +819,10 @@
         ShadowStyle shadowStyle = shadowValue.style && shadowValue.style->valueID() == CSSValueInset ? ShadowStyle::Inset : ShadowStyle::Normal;
         Color color;
         if (shadowValue.color)
-            color = builderState.colorFromPrimitiveValue(*shadowValue.color);
+            color = builderState.colorFromPrimitiveValueWithResolvedCurrentColor(*shadowValue.color);
         else
             color = builderState.style().color();
+
         auto shadowData = makeUnique<ShadowData>(LayoutPoint(x, y), blur, spread, shadowStyle, property == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
         if (property == CSSPropertyTextShadow)
             builderState.style().setTextShadow(WTFMove(shadowData), !isFirstEntry); // add to the list if this is not the first entry

Modified: trunk/Source/WebCore/style/StyleBuilderState.cpp (259531 => 259532)


--- trunk/Source/WebCore/style/StyleBuilderState.cpp	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/style/StyleBuilderState.cpp	2020-04-04 18:16:25 UTC (rev 259532)
@@ -267,7 +267,7 @@
             int blur = item.blur ? item.blur->computeLength<int>(cssToLengthConversionData()) : 0;
             Color color;
             if (item.color)
-                color = colorFromPrimitiveValue(*item.color);
+                color = colorFromPrimitiveValueWithResolvedCurrentColor(*item.color);
 
             operations.operations().append(DropShadowFilterOperation::create(location, blur, color.isValid() ? color : Color::transparent));
             break;
@@ -312,14 +312,25 @@
         return RenderTheme::singleton().focusRingColor(document().styleColorOptions(&m_style));
     case CSSValueCurrentcolor:
         // Color is an inherited property so depending on it effectively makes the property inherited.
-        // FIXME: Setting the flag as a side effect of calling this function is a bit oblique. Can we do better?
         m_style.setHasExplicitlyInheritedProperties();
-        return m_style.color();
+        return RenderStyle::currentColor();
     default:
         return StyleColor::colorFromKeyword(identifier, document().styleColorOptions(&m_style));
     }
 }
 
+Color BuilderState::colorFromPrimitiveValueWithResolvedCurrentColor(const CSSPrimitiveValue& value) const
+{
+    // FIXME: 'currentcolor' should be resolved at use time to make it inherit correctly. https://bugs.webkit.org/show_bug.cgi?id=210005
+    if (value.valueID() == CSSValueCurrentcolor) {
+        // Color is an inherited property so depending on it effectively makes the property inherited.
+        m_style.setHasExplicitlyInheritedProperties();
+        return m_style.color();
+    }
+
+    return colorFromPrimitiveValue(value);
+}
+
 void BuilderState::registerContentAttribute(const AtomString& attributeLocalName)
 {
     if (style().styleType() == PseudoId::Before || style().styleType() == PseudoId::After)

Modified: trunk/Source/WebCore/style/StyleBuilderState.h (259531 => 259532)


--- trunk/Source/WebCore/style/StyleBuilderState.h	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/style/StyleBuilderState.h	2020-04-04 18:16:25 UTC (rev 259532)
@@ -88,6 +88,8 @@
 
     static bool isColorFromPrimitiveValueDerivedFromElement(const CSSPrimitiveValue&);
     Color colorFromPrimitiveValue(const CSSPrimitiveValue&, bool forVisitedLink = false) const;
+    // FIXME: Remove. 'currentcolor' should be resolved at use time. All call sites are broken with inheritance.
+    Color colorFromPrimitiveValueWithResolvedCurrentColor(const CSSPrimitiveValue&) const;
 
     const Vector<AtomString>& registeredContentAttributes() const { return m_registeredContentAttributes; }
     void registerContentAttribute(const AtomString& attributeLocalName);

Modified: trunk/Source/WebCore/svg/SVGStopElement.cpp (259531 => 259532)


--- trunk/Source/WebCore/svg/SVGStopElement.cpp	2020-04-04 17:06:23 UTC (rev 259531)
+++ trunk/Source/WebCore/svg/SVGStopElement.cpp	2020-04-04 18:16:25 UTC (rev 259532)
@@ -87,15 +87,16 @@
 
 Color SVGStopElement::stopColorIncludingOpacity() const
 {
-    auto* style = renderer() ? &renderer()->style() : nullptr;
-    // FIXME: This check for null style exists to address Bug WK 90814, a rare crash condition in which the renderer or style is null.
-    if (!style)
+    if (!renderer())
         return Color(Color::transparent, true);
 
-    const SVGRenderStyle& svgStyle = style->svgStyle();
-    float colorAlpha = svgStyle.stopColor().alpha() / 255.0;
+    auto& style = renderer()->style();
+    auto& svgStyle = style.svgStyle();
+    auto stopColor = style.colorResolvingCurrentColor(svgStyle.stopColor());
+
+    float colorAlpha = stopColor.alpha() / 255.0;
     // FIXME: This should use colorWithAlphaMultipliedBy() but that has different rounding of the alpha component.
-    return colorWithOverrideAlpha(svgStyle.stopColor().rgb(), colorAlpha * svgStyle.stopOpacity());
+    return colorWithOverrideAlpha(stopColor.rgb(), colorAlpha * svgStyle.stopOpacity());
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to