Implement color-filter for text stroke
https://bugs.webkit.org/show_bug.cgi?id=185098

Reviewed by Alan Bujtas.
Source/WebCore:

Transform the text stroke color through color-filter.

Test: css3/color-filters/color-filter-text-stroke.html

* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):

LayoutTests:

* css3/color-filters/color-filter-text-stroke-expected.html: Added.
* css3/color-filters/color-filter-text-stroke.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@231124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c44cf86..0d64487 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,15 @@
 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
 
+        Implement color-filter for text stroke
+        https://bugs.webkit.org/show_bug.cgi?id=185098
+
+        Reviewed by Alan Bujtas.
+
+        * css3/color-filters/color-filter-text-stroke-expected.html: Added.
+        * css3/color-filters/color-filter-text-stroke.html: Added.
+
+2018-04-27  Simon Fraser  <simon.fraser@apple.com>
+
         Implement animation for color-filter
         https://bugs.webkit.org/show_bug.cgi?id=185092
         rdar://problem/39773810
diff --git a/LayoutTests/css3/color-filters/color-filter-text-stroke-expected.html b/LayoutTests/css3/color-filters/color-filter-text-stroke-expected.html
new file mode 100644
index 0000000..a1ceee6
--- /dev/null
+++ b/LayoutTests/css3/color-filters/color-filter-text-stroke-expected.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>CSS Test: color-filter reference</title>
+        <link rel="author" title="Apple" href="http://www.apple.com/">
+        <style type="text/css">
+            .test
+            {
+                margin: 50px 20px;
+                font: 120px Ahem;
+                color: green;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="test" style="stroke-color: blue; stroke-width: 20px;">O</div>
+        <div class="test" style="-webkit-text-stroke: 20px blue;">O</div>
+    </body>
+</html>
diff --git a/LayoutTests/css3/color-filters/color-filter-text-stroke.html b/LayoutTests/css3/color-filters/color-filter-text-stroke.html
new file mode 100644
index 0000000..5752afb
--- /dev/null
+++ b/LayoutTests/css3/color-filters/color-filter-text-stroke.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>CSS Test: color-filter affects text stroke</title>
+        <link rel="author" title="Apple" href="http://www.apple.com/">
+        <link rel="match" href="color-filter-text-stroke-expected.html">
+
+        <meta name="assert" content="color-filter affects text stroke">
+        <style type="text/css">
+            .test
+            {
+                margin: 50px 20px;
+                font: 120px Ahem;
+                color: rgb(255, 128, 255);
+                color-filter: invert();
+            }
+        </style>
+        <script>
+            if (window.internals)
+                internals.settings.setColorFilterEnabled(true);
+        </script>
+    </head>
+    <body>
+        <div class="test" style="stroke-color: yellow; stroke-width: 20px;">O</div>
+        <div class="test" style="-webkit-text-stroke: 20px yellow;">O</div>
+    </body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index e3dd00d..005ee1e 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,19 @@
 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
 
+        Implement color-filter for text stroke
+        https://bugs.webkit.org/show_bug.cgi?id=185098
+
+        Reviewed by Alan Bujtas.
+        
+        Transform the text stroke color through color-filter.
+
+        Test: css3/color-filters/color-filter-text-stroke.html
+
+        * rendering/TextPaintStyle.cpp:
+        (WebCore::computeTextPaintStyle):
+
+2018-04-27  Simon Fraser  <simon.fraser@apple.com>
+
         Implement animation for color-filter
         https://bugs.webkit.org/show_bug.cgi?id=185092
         rdar://problem/39773810
diff --git a/Source/WebCore/rendering/TextPaintStyle.cpp b/Source/WebCore/rendering/TextPaintStyle.cpp
index 28f83f8..d748f55 100644
--- a/Source/WebCore/rendering/TextPaintStyle.cpp
+++ b/Source/WebCore/rendering/TextPaintStyle.cpp
@@ -120,7 +120,7 @@
     if (forceBackgroundToWhite)
         paintStyle.fillColor = adjustColorForVisibilityOnBackground(paintStyle.fillColor, Color::white);
 
-    paintStyle.strokeColor = lineStyle.computedStrokeColor();
+    paintStyle.strokeColor = lineStyle.colorByApplyingColorFilter(lineStyle.computedStrokeColor());
 
     // Make the text stroke color legible against a white background
     if (forceBackgroundToWhite)