Title: [275092] trunk
Revision
275092
Author
[email protected]
Date
2021-03-26 04:16:59 -0700 (Fri, 26 Mar 2021)

Log Message

Fix interpolation of the caret-color CSS property
https://bugs.webkit.org/show_bug.cgi?id=223181
<rdar://problem/75687413>

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Add 64 PASS results for the caret-color interpolation test which now is passing completely.
The test css/css-ui/caret-color-021.html also progresses.

* web-platform-tests/css/css-ui/animation/caret-color-interpolation-expected.txt:
* web-platform-tests/css/css-ui/caret-color-021-expected.txt:

Source/WebCore:

Add support for the "auto" value for the "caret-color" CSS property. That value
is its initial value. We support it with a new boolean flag on StyleRareInheritedData
which we reset to false when setCaretColor() or setVisitedLinkCaretColor() is called.

Then, we can blend this property with the new CaretColorPropertyWrapper wrapper which is
required to correctly get and set the "auto" bit.

* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* css/CSSProperties.json: We can remove the initial value key since this property is entirely
custom.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setCaretColor):
(WebCore::RenderStyle::setHasAutoCaretColor):
(WebCore::RenderStyle::setVisitedLinkCaretColor):
(WebCore::RenderStyle::setHasVisitedLinkAutoCaretColor):
(WebCore::RenderStyle::hasAutoCaretColor const):
(WebCore::RenderStyle::hasVisitedLinkAutoCaretColor const):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialCaretColor):
(WebCore::Style::BuilderCustom::applyInheritCaretColor):
(WebCore::Style::BuilderCustom::applyValueCaretColor):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (275091 => 275092)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-26 11:16:59 UTC (rev 275092)
@@ -1,5 +1,19 @@
 2021-03-25  Antoine Quint  <[email protected]>
 
+        Fix interpolation of the caret-color CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=223181
+        <rdar://problem/75687413>
+
+        Reviewed by Antti Koivisto.
+
+        Add 64 PASS results for the caret-color interpolation test which now is passing completely.
+        The test css/css-ui/caret-color-021.html also progresses.
+
+        * web-platform-tests/css/css-ui/animation/caret-color-interpolation-expected.txt:
+        * web-platform-tests/css/css-ui/caret-color-021-expected.txt:
+
+2021-03-25  Antoine Quint  <[email protected]>
+
         Improve interpolation of the shape-outside CSS property
         https://bugs.webkit.org/show_bug.cgi?id=223738
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/animation/caret-color-interpolation-expected.txt (275091 => 275092)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/animation/caret-color-interpolation-expected.txt	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/animation/caret-color-interpolation-expected.txt	2021-03-26 11:16:59 UTC (rev 275092)
@@ -23,84 +23,84 @@
 PASS Web Animations: property <caret-color> from neutral to [green] at (0.6) should be [rgb(102, 179, 0)]
 PASS Web Animations: property <caret-color> from neutral to [green] at (1) should be [rgb(0, 128, 0)]
 PASS Web Animations: property <caret-color> from neutral to [green] at (1.5) should be [rgb(0, 65, 0)]
-FAIL CSS Transitions: property <caret-color> from [initial] to [green] at (-0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [initial] to [green] at (0) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [initial] to [green] at (0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Transitions: property <caret-color> from [initial] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL CSS Transitions: property <caret-color> from [initial] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Transitions: property <caret-color> from [initial] to [green] at (-0.3) should be [green]
+PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0) should be [green]
+PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0.3) should be [green]
+PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0.5) should be [green]
+PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0.6) should be [green]
 PASS CSS Transitions: property <caret-color> from [initial] to [green] at (1) should be [green]
-FAIL CSS Transitions: property <caret-color> from [initial] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (-0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Transitions: property <caret-color> from [initial] to [green] at (1.5) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (-0.3) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.3) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.5) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.6) should be [green]
 PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (1) should be [green]
-FAIL CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [initial] to [green] at (-0.3) should be [initial] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [initial] to [green] at (0) should be [initial] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [initial] to [green] at (0.3) should be [initial] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Animations: property <caret-color> from [initial] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL CSS Animations: property <caret-color> from [initial] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (1.5) should be [green]
+PASS CSS Animations: property <caret-color> from [initial] to [green] at (-0.3) should be [initial]
+PASS CSS Animations: property <caret-color> from [initial] to [green] at (0) should be [initial]
+PASS CSS Animations: property <caret-color> from [initial] to [green] at (0.3) should be [initial]
+PASS CSS Animations: property <caret-color> from [initial] to [green] at (0.5) should be [green]
+PASS CSS Animations: property <caret-color> from [initial] to [green] at (0.6) should be [green]
 PASS CSS Animations: property <caret-color> from [initial] to [green] at (1) should be [green]
-FAIL CSS Animations: property <caret-color> from [initial] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL Web Animations: property <caret-color> from [initial] to [green] at (-0.3) should be [initial] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL Web Animations: property <caret-color> from [initial] to [green] at (0) should be [initial] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL Web Animations: property <caret-color> from [initial] to [green] at (0.3) should be [initial] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL Web Animations: property <caret-color> from [initial] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL Web Animations: property <caret-color> from [initial] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Animations: property <caret-color> from [initial] to [green] at (1.5) should be [green]
+PASS Web Animations: property <caret-color> from [initial] to [green] at (-0.3) should be [initial]
+PASS Web Animations: property <caret-color> from [initial] to [green] at (0) should be [initial]
+PASS Web Animations: property <caret-color> from [initial] to [green] at (0.3) should be [initial]
+PASS Web Animations: property <caret-color> from [initial] to [green] at (0.5) should be [green]
+PASS Web Animations: property <caret-color> from [initial] to [green] at (0.6) should be [green]
 PASS Web Animations: property <caret-color> from [initial] to [green] at (1) should be [green]
-FAIL Web Animations: property <caret-color> from [initial] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [auto] to [green] at (-0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [auto] to [green] at (0) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [auto] to [green] at (0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Transitions: property <caret-color> from [auto] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL CSS Transitions: property <caret-color> from [auto] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS Web Animations: property <caret-color> from [initial] to [green] at (1.5) should be [green]
+PASS CSS Transitions: property <caret-color> from [auto] to [green] at (-0.3) should be [green]
+PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0) should be [green]
+PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0.3) should be [green]
+PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0.5) should be [green]
+PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0.6) should be [green]
 PASS CSS Transitions: property <caret-color> from [auto] to [green] at (1) should be [green]
-FAIL CSS Transitions: property <caret-color> from [auto] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (-0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.3) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Transitions: property <caret-color> from [auto] to [green] at (1.5) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (-0.3) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.3) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.5) should be [green]
+PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.6) should be [green]
 PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (1) should be [green]
-FAIL CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [auto] to [green] at (-0.3) should be [auto] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [auto] to [green] at (0) should be [auto] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [auto] to [green] at (0.3) should be [auto] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Animations: property <caret-color> from [auto] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL CSS Animations: property <caret-color> from [auto] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (1.5) should be [green]
+PASS CSS Animations: property <caret-color> from [auto] to [green] at (-0.3) should be [auto]
+PASS CSS Animations: property <caret-color> from [auto] to [green] at (0) should be [auto]
+PASS CSS Animations: property <caret-color> from [auto] to [green] at (0.3) should be [auto]
+PASS CSS Animations: property <caret-color> from [auto] to [green] at (0.5) should be [green]
+PASS CSS Animations: property <caret-color> from [auto] to [green] at (0.6) should be [green]
 PASS CSS Animations: property <caret-color> from [auto] to [green] at (1) should be [green]
-FAIL CSS Animations: property <caret-color> from [auto] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL Web Animations: property <caret-color> from [auto] to [green] at (-0.3) should be [auto] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL Web Animations: property <caret-color> from [auto] to [green] at (0) should be [auto] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL Web Animations: property <caret-color> from [auto] to [green] at (0.3) should be [auto] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL Web Animations: property <caret-color> from [auto] to [green] at (0.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.5 ) "
-FAIL Web Animations: property <caret-color> from [auto] to [green] at (0.6) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Animations: property <caret-color> from [auto] to [green] at (1.5) should be [green]
+PASS Web Animations: property <caret-color> from [auto] to [green] at (-0.3) should be [auto]
+PASS Web Animations: property <caret-color> from [auto] to [green] at (0) should be [auto]
+PASS Web Animations: property <caret-color> from [auto] to [green] at (0.3) should be [auto]
+PASS Web Animations: property <caret-color> from [auto] to [green] at (0.5) should be [green]
+PASS Web Animations: property <caret-color> from [auto] to [green] at (0.6) should be [green]
 PASS Web Animations: property <caret-color> from [auto] to [green] at (1) should be [green]
-FAIL Web Animations: property <caret-color> from [auto] to [green] at (1.5) should be [green] assert_equals: expected "rgb ( 0 , 128 , 0 ) " but got "rgb ( 0 , 192 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)] assert_equals: expected "rgb ( 0 , 38 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Transitions: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)] assert_equals: expected "rgb ( 0 , 77 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS Web Animations: property <caret-color> from [auto] to [green] at (1.5) should be [green]
+PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
+PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
+PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
+PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
 PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
 PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
-FAIL CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)] assert_equals: expected "rgb ( 0 , 38 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)] assert_equals: expected "rgb ( 0 , 77 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
+PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
+PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
+PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
 PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
 PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
-FAIL CSS Animations: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL CSS Animations: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)] assert_equals: expected "rgb ( 0 , 38 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL CSS Animations: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)] assert_equals: expected "rgb ( 0 , 77 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
+PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
+PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
+PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
 PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
 PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
-FAIL Web Animations: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL Web Animations: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)] assert_equals: expected "rgb ( 0 , 0 , 0 ) " but got "rgba ( 0 , 0 , 0 , 0 ) "
-FAIL Web Animations: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)] assert_equals: expected "rgb ( 0 , 38 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.3 ) "
-FAIL Web Animations: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)] assert_equals: expected "rgb ( 0 , 77 , 0 ) " but got "rgba ( 0 , 128 , 0 , 0.6 ) "
+PASS Web Animations: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
+PASS Web Animations: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
+PASS Web Animations: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
+PASS Web Animations: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
 PASS Web Animations: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
 PASS Web Animations: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
 PASS CSS Transitions: property <caret-color> from [inherit] to [green] at (-0.3) should be [rgb(0, 0, 255)]

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/caret-color-021-expected.txt (275091 => 275092)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/caret-color-021-expected.txt	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/caret-color-021-expected.txt	2021-03-26 11:16:59 UTC (rev 275092)
@@ -1,4 +1,4 @@
 
 
-FAIL Default caret-color is not interpolable assert_equals: expected "rgb(0, 255, 0)" but got "rgba(0, 255, 0, 0.804)"
+PASS Default caret-color is not interpolable
 

Modified: trunk/Source/WebCore/ChangeLog (275091 => 275092)


--- trunk/Source/WebCore/ChangeLog	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/Source/WebCore/ChangeLog	2021-03-26 11:16:59 UTC (rev 275092)
@@ -1,3 +1,38 @@
+2021-03-25  Antoine Quint  <[email protected]>
+
+        Fix interpolation of the caret-color CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=223181
+        <rdar://problem/75687413>
+
+        Reviewed by Antti Koivisto.
+
+        Add support for the "auto" value for the "caret-color" CSS property. That value
+        is its initial value. We support it with a new boolean flag on StyleRareInheritedData
+        which we reset to false when setCaretColor() or setVisitedLinkCaretColor() is called.
+
+        Then, we can blend this property with the new CaretColorPropertyWrapper wrapper which is
+        required to correctly get and set the "auto" bit.
+
+        * animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * css/CSSProperties.json: We can remove the initial value key since this property is entirely
+        custom.
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setCaretColor):
+        (WebCore::RenderStyle::setHasAutoCaretColor):
+        (WebCore::RenderStyle::setVisitedLinkCaretColor):
+        (WebCore::RenderStyle::setHasVisitedLinkAutoCaretColor):
+        (WebCore::RenderStyle::hasAutoCaretColor const):
+        (WebCore::RenderStyle::hasVisitedLinkAutoCaretColor const):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator== const):
+        * rendering/style/StyleRareInheritedData.h:
+        * style/StyleBuilderCustom.h:
+        (WebCore::Style::BuilderCustom::applyInitialCaretColor):
+        (WebCore::Style::BuilderCustom::applyInheritCaretColor):
+        (WebCore::Style::BuilderCustom::applyValueCaretColor):
+
 2021-03-26  Jean-Yves Avenard  <[email protected]>
 
         Fix NowPlayingInfoArtwork operator== logic.

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (275091 => 275092)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-03-26 11:16:59 UTC (rev 275092)
@@ -1234,7 +1234,7 @@
 
 
 enum MaybeInvalidColorTag { MaybeInvalidColor };
-class PropertyWrapperVisitedAffectedColor final : public AnimationPropertyWrapperBase {
+class PropertyWrapperVisitedAffectedColor : public AnimationPropertyWrapperBase {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     PropertyWrapperVisitedAffectedColor(CSSPropertyID property, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
@@ -1250,18 +1250,22 @@
     {
     }
 
-private:
-    bool equals(const RenderStyle* a, const RenderStyle* b) const final
+protected:
+    bool equals(const RenderStyle* a, const RenderStyle* b) const override
     {
         return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
     }
 
-    void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
+    void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const override
     {
         m_wrapper->blend(client, destination, from, to, progress);
         m_visitedWrapper->blend(client, destination, from, to, progress);
     }
 
+    std::unique_ptr<AnimationPropertyWrapperBase> m_wrapper;
+    std::unique_ptr<AnimationPropertyWrapperBase> m_visitedWrapper;
+
+private:
 #if !LOG_DISABLED
     void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final
     {
@@ -1269,9 +1273,58 @@
         m_visitedWrapper->logBlend(from, to, result, progress);
     }
 #endif
+};
 
-    std::unique_ptr<AnimationPropertyWrapperBase> m_wrapper;
-    std::unique_ptr<AnimationPropertyWrapperBase> m_visitedWrapper;
+static bool canInterpolateCaretColor(const RenderStyle* from, const RenderStyle* to, bool visited)
+{
+    if (visited)
+        return !from->hasVisitedLinkAutoCaretColor() && !to->hasVisitedLinkAutoCaretColor();
+    return !from->hasAutoCaretColor() && !to->hasAutoCaretColor();
+}
+
+class CaretColorPropertyWrapper final : public PropertyWrapperVisitedAffectedColor {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    CaretColorPropertyWrapper()
+        : PropertyWrapperVisitedAffectedColor(CSSPropertyCaretColor, MaybeInvalidColor, &RenderStyle::caretColor, &RenderStyle::setCaretColor, &RenderStyle::visitedLinkCaretColor, &RenderStyle::setVisitedLinkCaretColor)
+    {
+    }
+
+private:
+    bool equals(const RenderStyle* a, const RenderStyle* b) const final
+    {
+        return a->hasAutoCaretColor() == b->hasAutoCaretColor()
+            && a->hasVisitedLinkAutoCaretColor() == b->hasVisitedLinkAutoCaretColor()
+            && PropertyWrapperVisitedAffectedColor::equals(a, b);
+    }
+
+    bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
+    {
+        return canInterpolateCaretColor(from, to, false) || canInterpolateCaretColor(from, to, true);
+    }
+
+    void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
+    {
+        if (canInterpolateCaretColor(from, to, false))
+            m_wrapper->blend(client, destination, from, to, progress);
+        else {
+            auto* blendingRenderStyle = progress < 0.5 ? from : to;
+            if (blendingRenderStyle->hasAutoCaretColor())
+                destination->setHasAutoCaretColor();
+            else
+                destination->setCaretColor(blendingRenderStyle->caretColor());
+        }
+
+        if (canInterpolateCaretColor(from, to, true))
+            m_visitedWrapper->blend(client, destination, from, to, progress);
+        else {
+            auto* blendingRenderStyle = progress < 0.5 ? from : to;
+            if (blendingRenderStyle->hasVisitedLinkAutoCaretColor())
+                destination->setHasVisitedLinkAutoCaretColor();
+            else
+                destination->setVisitedLinkCaretColor(blendingRenderStyle->visitedLinkCaretColor());
+        }
+    }
 };
 
 // Wrapper base class for an animatable property in a FillLayer
@@ -2024,7 +2077,7 @@
         new LengthPropertyWrapper(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop, { LengthPropertyWrapper::Flags::NegativeLengthsAreInvalid }),
         new LengthPropertyWrapper(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, { LengthPropertyWrapper::Flags::NegativeLengthsAreInvalid }),
 
-        new PropertyWrapperVisitedAffectedColor(CSSPropertyCaretColor, &RenderStyle::caretColor, &RenderStyle::setCaretColor, &RenderStyle::visitedLinkCaretColor, &RenderStyle::setVisitedLinkCaretColor),
+        new CaretColorPropertyWrapper,
 
         new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor),
 

Modified: trunk/Source/WebCore/css/CSSProperties.json (275091 => 275092)


--- trunk/Source/WebCore/css/CSSProperties.json	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/Source/WebCore/css/CSSProperties.json	2021-03-26 11:16:59 UTC (rev 275092)
@@ -188,8 +188,8 @@
         "caret-color" : {
             "inherited": true,
             "codegen-properties": {
-                "initial": "currentColor",
-                "visited-link-color-support": true
+                "visited-link-color-support": true,
+                "custom": "All"
             },
             "specification": {
                 "category": "css-ui",

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (275091 => 275092)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-03-26 11:16:59 UTC (rev 275092)
@@ -1111,7 +1111,8 @@
     void setTextStrokeColor(const Color& c) { SET_VAR(m_rareInheritedData, textStrokeColor, c); }
     void setTextStrokeWidth(float w) { SET_VAR(m_rareInheritedData, textStrokeWidth, w); }
     void setTextFillColor(const Color& c) { SET_VAR(m_rareInheritedData, textFillColor, c); }
-    void setCaretColor(const Color& c) { SET_VAR(m_rareInheritedData, caretColor, c); }
+    void setCaretColor(const Color& c) { SET_VAR(m_rareInheritedData, caretColor, c); SET_VAR(m_rareInheritedData, hasAutoCaretColor, false);  }
+    void setHasAutoCaretColor() { SET_VAR(m_rareInheritedData, hasAutoCaretColor, true); SET_VAR(m_rareInheritedData, caretColor, currentColor()); }
     void setOpacity(float f) { float v = clampTo<float>(f, 0.f, 1.f); SET_VAR(m_rareNonInheritedData, opacity, v); }
     void setAppearance(ControlPart a) { SET_VAR(m_rareNonInheritedData, appearance, a); }
     // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
@@ -1807,7 +1808,8 @@
     void setVisitedLinkTextEmphasisColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextEmphasisColor, v); }
     void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextFillColor, v); }
     void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextStrokeColor, v); }
-    void setVisitedLinkCaretColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkCaretColor, v); }
+    void setVisitedLinkCaretColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkCaretColor, v); SET_VAR(m_rareInheritedData, hasVisitedLinkAutoCaretColor, false); }
+    void setHasVisitedLinkAutoCaretColor() { SET_VAR(m_rareInheritedData, hasVisitedLinkAutoCaretColor, true); SET_VAR(m_rareInheritedData, visitedLinkCaretColor, currentColor()); }
 
     void inheritUnicodeBidiFrom(const RenderStyle* parent) { m_nonInheritedFlags.unicodeBidi = parent->m_nonInheritedFlags.unicodeBidi; }
 
@@ -1830,6 +1832,7 @@
     const Color& textFillColor() const { return m_rareInheritedData->textFillColor; }
     const Color& textStrokeColor() const { return m_rareInheritedData->textStrokeColor; }
     const Color& caretColor() const { return m_rareInheritedData->caretColor; }
+    bool hasAutoCaretColor() const { return m_rareInheritedData->hasAutoCaretColor; }
     const Color& visitedLinkColor() const;
     const Color& visitedLinkBackgroundColor() const { return m_rareNonInheritedData->visitedLinkBackgroundColor; }
     const Color& visitedLinkBorderLeftColor() const { return m_rareNonInheritedData->visitedLinkBorderLeftColor; }
@@ -1844,6 +1847,7 @@
     const Color& visitedLinkTextFillColor() const { return m_rareInheritedData->visitedLinkTextFillColor; }
     const Color& visitedLinkTextStrokeColor() const { return m_rareInheritedData->visitedLinkTextStrokeColor; }
     const Color& visitedLinkCaretColor() const { return m_rareInheritedData->visitedLinkCaretColor; }
+    bool hasVisitedLinkAutoCaretColor() const { return m_rareInheritedData->hasVisitedLinkAutoCaretColor; }
 
     const Color& stopColor() const { return svgStyle().stopColor(); }
     const Color& floodColor() const { return svgStyle().floodColor(); }

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (275091 => 275092)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2021-03-26 11:16:59 UTC (rev 275092)
@@ -135,6 +135,8 @@
     , hasSetStrokeWidth(false)
     , hasSetStrokeColor(false)
     , mathStyle(static_cast<unsigned>(RenderStyle::initialMathStyle()))
+    , hasAutoCaretColor(true)
+    , hasVisitedLinkAutoCaretColor(true)
     , effectiveTouchActions(RenderStyle::initialTouchActions())
     , strokeWidth(RenderStyle::initialStrokeWidth())
     , strokeColor(RenderStyle::initialStrokeColor())
@@ -231,6 +233,8 @@
     , hasSetStrokeWidth(o.hasSetStrokeWidth)
     , hasSetStrokeColor(o.hasSetStrokeColor)
     , mathStyle(o.mathStyle)
+    , hasAutoCaretColor(o.hasAutoCaretColor)
+    , hasVisitedLinkAutoCaretColor(o.hasVisitedLinkAutoCaretColor)
     , effectiveTouchActions(o.effectiveTouchActions)
     , eventListenerRegionTypes(o.eventListenerRegionTypes)
     , strokeWidth(o.strokeWidth)
@@ -354,6 +358,8 @@
         && hasSetStrokeWidth == o.hasSetStrokeWidth
         && hasSetStrokeColor == o.hasSetStrokeColor
         && mathStyle == o.mathStyle
+        && hasAutoCaretColor == o.hasAutoCaretColor
+        && hasVisitedLinkAutoCaretColor == o.hasVisitedLinkAutoCaretColor
         && effectiveTouchActions == o.effectiveTouchActions
         && eventListenerRegionTypes == o.eventListenerRegionTypes
         && strokeWidth == o.strokeWidth

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (275091 => 275092)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2021-03-26 11:16:59 UTC (rev 275092)
@@ -160,6 +160,9 @@
 
     unsigned mathStyle : 1;
 
+    unsigned hasAutoCaretColor : 1;
+    unsigned hasVisitedLinkAutoCaretColor : 1;
+
     OptionSet<TouchAction> effectiveTouchActions;
     OptionSet<EventListenerRegionType> eventListenerRegionTypes;
 

Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (275091 => 275092)


--- trunk/Source/WebCore/style/StyleBuilderCustom.h	2021-03-26 11:07:44 UTC (rev 275091)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h	2021-03-26 11:16:59 UTC (rev 275092)
@@ -77,6 +77,7 @@
     DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageSlice);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageWidth);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(BoxShadow);
+    DECLARE_PROPERTY_CUSTOM_HANDLERS(CaretColor);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(Clip);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(Contain);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(Content);
@@ -795,6 +796,48 @@
     builderState.style().setOutlineStyle(primitiveValue);
 }
 
+inline void BuilderCustom::applyInitialCaretColor(BuilderState& builderState)
+{
+    if (builderState.applyPropertyToRegularStyle())
+        builderState.style().setHasAutoCaretColor();
+    if (builderState.applyPropertyToVisitedLinkStyle())
+        builderState.style().setHasVisitedLinkAutoCaretColor();
+}
+
+inline void BuilderCustom::applyInheritCaretColor(BuilderState& builderState)
+{
+    Color color = builderState.parentStyle().caretColor();
+    if (builderState.applyPropertyToRegularStyle()) {
+        if (builderState.parentStyle().hasAutoCaretColor())
+            builderState.style().setHasAutoCaretColor();
+        else
+            builderState.style().setCaretColor(color);
+    }
+    if (builderState.applyPropertyToVisitedLinkStyle()) {
+        if (builderState.parentStyle().hasVisitedLinkAutoCaretColor())
+            builderState.style().setHasVisitedLinkAutoCaretColor();
+        else
+            builderState.style().setVisitedLinkCaretColor(color);
+    }
+}
+
+inline void BuilderCustom::applyValueCaretColor(BuilderState& builderState, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (builderState.applyPropertyToRegularStyle()) {
+        if (primitiveValue.valueID() == CSSValueAuto)
+            builderState.style().setHasAutoCaretColor();
+        else
+            builderState.style().setCaretColor(builderState.colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ false));
+    }
+    if (builderState.applyPropertyToVisitedLinkStyle()) {
+        if (primitiveValue.valueID() == CSSValueAuto)
+            builderState.style().setHasVisitedLinkAutoCaretColor();
+        else
+            builderState.style().setVisitedLinkCaretColor(builderState.colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
+    }
+}
+
 inline void BuilderCustom::applyInitialClip(BuilderState& builderState)
 {
     builderState.style().setClip(Length(), Length(), Length(), Length());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to