Title: [290898] trunk
Revision
290898
Author
[email protected]
Date
2022-03-07 11:13:52 -0800 (Mon, 07 Mar 2022)

Log Message

[web-animations] animating "fill" and "stroke" to or from "currentColor" should work
https://bugs.webkit.org/show_bug.cgi?id=237531

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

* web-platform-tests/web-animations/responsive/to-color-change-expected.txt:

Source/WebCore:

Invalid colors should use the value for the "color" property on the provided RenderStyle.

* animation/CSSPropertyAnimation.cpp:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290897 => 290898)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-07 18:18:39 UTC (rev 290897)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-07 19:13:52 UTC (rev 290898)
@@ -1,5 +1,14 @@
 2022-03-07  Antoine Quint  <[email protected]>
 
+        [web-animations] animating "fill" and "stroke" to or from "currentColor" should work
+        https://bugs.webkit.org/show_bug.cgi?id=237531
+
+        Reviewed by Antti Koivisto.
+
+        * web-platform-tests/web-animations/responsive/to-color-change-expected.txt:
+
+2022-03-07  Antoine Quint  <[email protected]>
+
         Transition on text-decoration-color from currentColor jumps
         https://bugs.webkit.org/show_bug.cgi?id=236992
         <rdar://problem/89382835>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/to-color-change-expected.txt (290897 => 290898)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/to-color-change-expected.txt	2022-03-07 18:18:39 UTC (rev 290897)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/to-color-change-expected.txt	2022-03-07 19:13:52 UTC (rev 290898)
@@ -1,11 +1,11 @@
 
 PASS Background color responsive to currentColor changes
-FAIL Fill color responsive to currentColor changes assert_equals: expected "rgb(0, 34, 102)" but got "rgb(0, 0, 0)"
+PASS Fill color responsive to currentColor changes
 PASS Color interpolation uses pre-multiplied colors
 PASS Border color responsive to currentColor changes
 PASS Border color responsive to currentColor changes again
 PASS Outline color responsive to currentColor changes
-FAIL Stroke color responsive to currentColor changes assert_equals: expected "rgb(0, 34, 102)" but got "none"
+PASS Stroke color responsive to currentColor changes
 PASS Text decoration color responsive to currentColor changes
 FAIL Color responsive to parent currentColor changes assert_equals: expected "rgb(34, 51, 34)" but got "rgb(0, 51, 51)"
 FAIL Color responsive to repeated parent currentColor changes assert_equals: expected "rgb(102, 17, 51)" but got "rgb(0, 17, 153)"

Modified: trunk/Source/WebCore/ChangeLog (290897 => 290898)


--- trunk/Source/WebCore/ChangeLog	2022-03-07 18:18:39 UTC (rev 290897)
+++ trunk/Source/WebCore/ChangeLog	2022-03-07 19:13:52 UTC (rev 290898)
@@ -1,5 +1,16 @@
 2022-03-07  Antoine Quint  <[email protected]>
 
+        [web-animations] animating "fill" and "stroke" to or from "currentColor" should work
+        https://bugs.webkit.org/show_bug.cgi?id=237531
+
+        Reviewed by Antti Koivisto.
+
+        Invalid colors should use the value for the "color" property on the provided RenderStyle. 
+
+        * animation/CSSPropertyAnimation.cpp:
+
+2022-03-07  Antoine Quint  <[email protected]>
+
         Transition on text-decoration-color from currentColor jumps
         https://bugs.webkit.org/show_bug.cgi?id=236992
         <rdar://problem/89382835>

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (290897 => 290898)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-03-07 18:18:39 UTC (rev 290897)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-03-07 19:13:52 UTC (rev 290898)
@@ -2121,9 +2121,9 @@
                 return true;
 
             if (!fromColor.isValid())
-                fromColor = Color();
+                fromColor = a.color();
             if (!toColor.isValid())
-                toColor = Color();
+                toColor = b.color();
 
             return fromColor == toColor;
         }
@@ -2132,8 +2132,11 @@
 
     void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
     {
-        if ((from.*m_paintTypeGetter)() != SVGPaintType::RGBColor
-            || (to.*m_paintTypeGetter)() != SVGPaintType::RGBColor)
+        auto isValidPaintType = [](SVGPaintType paintType) {
+            return paintType == SVGPaintType::RGBColor || paintType == SVGPaintType::CurrentColor;
+        };
+
+        if (!isValidPaintType((from.*m_paintTypeGetter)()) || !isValidPaintType((to.*m_paintTypeGetter)()))
             return;
 
         Color fromColor = (from.*m_getter)();
@@ -2143,9 +2146,9 @@
             return;
 
         if (!fromColor.isValid())
-            fromColor = Color();
+            fromColor = from.color();
         if (!toColor.isValid())
-            toColor = Color();
+            toColor = to.color();
         (destination.*m_setter)(blendFunc(fromColor, toColor, context));
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to