Changeset 275092 in webkit


Ignore:
Timestamp:
Mar 26, 2021 4:16:59 AM (16 months ago)
Author:
graouts@webkit.org
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):

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r275015 r275092  
     12021-03-25  Antoine Quint  <graouts@webkit.org>
     2
     3        Fix interpolation of the caret-color CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=223181
     5        <rdar://problem/75687413>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Add 64 PASS results for the caret-color interpolation test which now is passing completely.
     10        The test css/css-ui/caret-color-021.html also progresses.
     11
     12        * web-platform-tests/css/css-ui/animation/caret-color-interpolation-expected.txt:
     13        * web-platform-tests/css/css-ui/caret-color-021-expected.txt:
     14
    1152021-03-25  Antoine Quint  <graouts@webkit.org>
    216
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/animation/caret-color-interpolation-expected.txt

    r274408 r275092  
    2424PASS Web Animations: property <caret-color> from neutral to [green] at (1) should be [rgb(0, 128, 0)]
    2525PASS Web Animations: property <caret-color> from neutral to [green] at (1.5) should be [rgb(0, 65, 0)]
    26 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 ) "
    27 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 ) "
    28 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 ) "
    29 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 ) "
    30 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 ) "
     26PASS CSS Transitions: property <caret-color> from [initial] to [green] at (-0.3) should be [green]
     27PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0) should be [green]
     28PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0.3) should be [green]
     29PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0.5) should be [green]
     30PASS CSS Transitions: property <caret-color> from [initial] to [green] at (0.6) should be [green]
    3131PASS CSS Transitions: property <caret-color> from [initial] to [green] at (1) should be [green]
    32 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 ) "
    33 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 ) "
    34 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 ) "
    35 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 ) "
    36 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 ) "
    37 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 ) "
     32PASS CSS Transitions: property <caret-color> from [initial] to [green] at (1.5) should be [green]
     33PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (-0.3) should be [green]
     34PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0) should be [green]
     35PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.3) should be [green]
     36PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.5) should be [green]
     37PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (0.6) should be [green]
    3838PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (1) should be [green]
    39 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 ) "
    40 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 ) "
    41 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 ) "
    42 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 ) "
    43 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 ) "
    44 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 ) "
     39PASS CSS Transitions with transition: all: property <caret-color> from [initial] to [green] at (1.5) should be [green]
     40PASS CSS Animations: property <caret-color> from [initial] to [green] at (-0.3) should be [initial]
     41PASS CSS Animations: property <caret-color> from [initial] to [green] at (0) should be [initial]
     42PASS CSS Animations: property <caret-color> from [initial] to [green] at (0.3) should be [initial]
     43PASS CSS Animations: property <caret-color> from [initial] to [green] at (0.5) should be [green]
     44PASS CSS Animations: property <caret-color> from [initial] to [green] at (0.6) should be [green]
    4545PASS CSS Animations: property <caret-color> from [initial] to [green] at (1) should be [green]
    46 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 ) "
    47 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 ) "
    48 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 ) "
    49 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 ) "
    50 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 ) "
    51 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 ) "
     46PASS CSS Animations: property <caret-color> from [initial] to [green] at (1.5) should be [green]
     47PASS Web Animations: property <caret-color> from [initial] to [green] at (-0.3) should be [initial]
     48PASS Web Animations: property <caret-color> from [initial] to [green] at (0) should be [initial]
     49PASS Web Animations: property <caret-color> from [initial] to [green] at (0.3) should be [initial]
     50PASS Web Animations: property <caret-color> from [initial] to [green] at (0.5) should be [green]
     51PASS Web Animations: property <caret-color> from [initial] to [green] at (0.6) should be [green]
    5252PASS Web Animations: property <caret-color> from [initial] to [green] at (1) should be [green]
    53 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 ) "
    54 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 ) "
    55 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 ) "
    56 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 ) "
    57 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 ) "
    58 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 ) "
     53PASS Web Animations: property <caret-color> from [initial] to [green] at (1.5) should be [green]
     54PASS CSS Transitions: property <caret-color> from [auto] to [green] at (-0.3) should be [green]
     55PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0) should be [green]
     56PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0.3) should be [green]
     57PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0.5) should be [green]
     58PASS CSS Transitions: property <caret-color> from [auto] to [green] at (0.6) should be [green]
    5959PASS CSS Transitions: property <caret-color> from [auto] to [green] at (1) should be [green]
    60 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 ) "
    61 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 ) "
    62 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 ) "
    63 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 ) "
    64 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 ) "
    65 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 ) "
     60PASS CSS Transitions: property <caret-color> from [auto] to [green] at (1.5) should be [green]
     61PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (-0.3) should be [green]
     62PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0) should be [green]
     63PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.3) should be [green]
     64PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.5) should be [green]
     65PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (0.6) should be [green]
    6666PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (1) should be [green]
    67 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 ) "
    68 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 ) "
    69 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 ) "
    70 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 ) "
    71 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 ) "
    72 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 ) "
     67PASS CSS Transitions with transition: all: property <caret-color> from [auto] to [green] at (1.5) should be [green]
     68PASS CSS Animations: property <caret-color> from [auto] to [green] at (-0.3) should be [auto]
     69PASS CSS Animations: property <caret-color> from [auto] to [green] at (0) should be [auto]
     70PASS CSS Animations: property <caret-color> from [auto] to [green] at (0.3) should be [auto]
     71PASS CSS Animations: property <caret-color> from [auto] to [green] at (0.5) should be [green]
     72PASS CSS Animations: property <caret-color> from [auto] to [green] at (0.6) should be [green]
    7373PASS CSS Animations: property <caret-color> from [auto] to [green] at (1) should be [green]
    74 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 ) "
    75 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 ) "
    76 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 ) "
    77 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 ) "
    78 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 ) "
    79 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 ) "
     74PASS CSS Animations: property <caret-color> from [auto] to [green] at (1.5) should be [green]
     75PASS Web Animations: property <caret-color> from [auto] to [green] at (-0.3) should be [auto]
     76PASS Web Animations: property <caret-color> from [auto] to [green] at (0) should be [auto]
     77PASS Web Animations: property <caret-color> from [auto] to [green] at (0.3) should be [auto]
     78PASS Web Animations: property <caret-color> from [auto] to [green] at (0.5) should be [green]
     79PASS Web Animations: property <caret-color> from [auto] to [green] at (0.6) should be [green]
    8080PASS Web Animations: property <caret-color> from [auto] to [green] at (1) should be [green]
    81 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 ) "
    82 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 ) "
    83 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 ) "
    84 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 ) "
    85 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 ) "
     81PASS Web Animations: property <caret-color> from [auto] to [green] at (1.5) should be [green]
     82PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
     83PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
     84PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
     85PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
    8686PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
    8787PASS CSS Transitions: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
    88 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 ) "
    89 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 ) "
    90 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 ) "
    91 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 ) "
     88PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
     89PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
     90PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
     91PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
    9292PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
    9393PASS CSS Transitions with transition: all: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
    94 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 ) "
    95 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 ) "
    96 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 ) "
    97 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 ) "
     94PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
     95PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
     96PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
     97PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
    9898PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
    9999PASS CSS Animations: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
    100 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 ) "
    101 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 ) "
    102 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 ) "
    103 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 ) "
     100PASS Web Animations: property <caret-color> from [currentColor] to [green] at (-0.3) should be [rgb(0, 0, 0)]
     101PASS Web Animations: property <caret-color> from [currentColor] to [green] at (0) should be [rgb(0, 0, 0)]
     102PASS Web Animations: property <caret-color> from [currentColor] to [green] at (0.3) should be [rgb(0, 38, 0)]
     103PASS Web Animations: property <caret-color> from [currentColor] to [green] at (0.6) should be [rgb(0, 77, 0)]
    104104PASS Web Animations: property <caret-color> from [currentColor] to [green] at (1) should be [rgb(0, 128, 0)]
    105105PASS Web Animations: property <caret-color> from [currentColor] to [green] at (1.5) should be [rgb(0, 192, 0)]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/caret-color-021-expected.txt

    r252598 r275092  
    11
    22
    3 FAIL Default caret-color is not interpolable assert_equals: expected "rgb(0, 255, 0)" but got "rgba(0, 255, 0, 0.804)"
     3PASS Default caret-color is not interpolable
    44
  • trunk/Source/WebCore/ChangeLog

    r275091 r275092  
     12021-03-25  Antoine Quint  <graouts@webkit.org>
     2
     3        Fix interpolation of the caret-color CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=223181
     5        <rdar://problem/75687413>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Add support for the "auto" value for the "caret-color" CSS property. That value
     10        is its initial value. We support it with a new boolean flag on StyleRareInheritedData
     11        which we reset to false when setCaretColor() or setVisitedLinkCaretColor() is called.
     12
     13        Then, we can blend this property with the new CaretColorPropertyWrapper wrapper which is
     14        required to correctly get and set the "auto" bit.
     15
     16        * animation/CSSPropertyAnimation.cpp:
     17        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     18        * css/CSSProperties.json: We can remove the initial value key since this property is entirely
     19        custom.
     20        * rendering/style/RenderStyle.h:
     21        (WebCore::RenderStyle::setCaretColor):
     22        (WebCore::RenderStyle::setHasAutoCaretColor):
     23        (WebCore::RenderStyle::setVisitedLinkCaretColor):
     24        (WebCore::RenderStyle::setHasVisitedLinkAutoCaretColor):
     25        (WebCore::RenderStyle::hasAutoCaretColor const):
     26        (WebCore::RenderStyle::hasVisitedLinkAutoCaretColor const):
     27        * rendering/style/StyleRareInheritedData.cpp:
     28        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
     29        (WebCore::StyleRareInheritedData::operator== const):
     30        * rendering/style/StyleRareInheritedData.h:
     31        * style/StyleBuilderCustom.h:
     32        (WebCore::Style::BuilderCustom::applyInitialCaretColor):
     33        (WebCore::Style::BuilderCustom::applyInheritCaretColor):
     34        (WebCore::Style::BuilderCustom::applyValueCaretColor):
     35
    1362021-03-26  Jean-Yves Avenard  <jya@apple.com>
    237
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r275015 r275092  
    12351235
    12361236enum MaybeInvalidColorTag { MaybeInvalidColor };
    1237 class PropertyWrapperVisitedAffectedColor final : public AnimationPropertyWrapperBase {
     1237class PropertyWrapperVisitedAffectedColor : public AnimationPropertyWrapperBase {
    12381238    WTF_MAKE_FAST_ALLOCATED;
    12391239public:
     
    12511251    }
    12521252
    1253 private:
    1254     bool equals(const RenderStyle* a, const RenderStyle* b) const final
     1253protected:
     1254    bool equals(const RenderStyle* a, const RenderStyle* b) const override
    12551255    {
    12561256        return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
    12571257    }
    12581258
    1259     void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
     1259    void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const override
    12601260    {
    12611261        m_wrapper->blend(client, destination, from, to, progress);
     
    12631263    }
    12641264
     1265    std::unique_ptr<AnimationPropertyWrapperBase> m_wrapper;
     1266    std::unique_ptr<AnimationPropertyWrapperBase> m_visitedWrapper;
     1267
     1268private:
    12651269#if !LOG_DISABLED
    12661270    void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final
     
    12701274    }
    12711275#endif
    1272 
    1273     std::unique_ptr<AnimationPropertyWrapperBase> m_wrapper;
    1274     std::unique_ptr<AnimationPropertyWrapperBase> m_visitedWrapper;
     1276};
     1277
     1278static bool canInterpolateCaretColor(const RenderStyle* from, const RenderStyle* to, bool visited)
     1279{
     1280    if (visited)
     1281        return !from->hasVisitedLinkAutoCaretColor() && !to->hasVisitedLinkAutoCaretColor();
     1282    return !from->hasAutoCaretColor() && !to->hasAutoCaretColor();
     1283}
     1284
     1285class CaretColorPropertyWrapper final : public PropertyWrapperVisitedAffectedColor {
     1286    WTF_MAKE_FAST_ALLOCATED;
     1287public:
     1288    CaretColorPropertyWrapper()
     1289        : PropertyWrapperVisitedAffectedColor(CSSPropertyCaretColor, MaybeInvalidColor, &RenderStyle::caretColor, &RenderStyle::setCaretColor, &RenderStyle::visitedLinkCaretColor, &RenderStyle::setVisitedLinkCaretColor)
     1290    {
     1291    }
     1292
     1293private:
     1294    bool equals(const RenderStyle* a, const RenderStyle* b) const final
     1295    {
     1296        return a->hasAutoCaretColor() == b->hasAutoCaretColor()
     1297            && a->hasVisitedLinkAutoCaretColor() == b->hasVisitedLinkAutoCaretColor()
     1298            && PropertyWrapperVisitedAffectedColor::equals(a, b);
     1299    }
     1300
     1301    bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
     1302    {
     1303        return canInterpolateCaretColor(from, to, false) || canInterpolateCaretColor(from, to, true);
     1304    }
     1305
     1306    void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
     1307    {
     1308        if (canInterpolateCaretColor(from, to, false))
     1309            m_wrapper->blend(client, destination, from, to, progress);
     1310        else {
     1311            auto* blendingRenderStyle = progress < 0.5 ? from : to;
     1312            if (blendingRenderStyle->hasAutoCaretColor())
     1313                destination->setHasAutoCaretColor();
     1314            else
     1315                destination->setCaretColor(blendingRenderStyle->caretColor());
     1316        }
     1317
     1318        if (canInterpolateCaretColor(from, to, true))
     1319            m_visitedWrapper->blend(client, destination, from, to, progress);
     1320        else {
     1321            auto* blendingRenderStyle = progress < 0.5 ? from : to;
     1322            if (blendingRenderStyle->hasVisitedLinkAutoCaretColor())
     1323                destination->setHasVisitedLinkAutoCaretColor();
     1324            else
     1325                destination->setVisitedLinkCaretColor(blendingRenderStyle->visitedLinkCaretColor());
     1326        }
     1327    }
    12751328};
    12761329
     
    20252078        new LengthPropertyWrapper(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom, { LengthPropertyWrapper::Flags::NegativeLengthsAreInvalid }),
    20262079
    2027         new PropertyWrapperVisitedAffectedColor(CSSPropertyCaretColor, &RenderStyle::caretColor, &RenderStyle::setCaretColor, &RenderStyle::visitedLinkCaretColor, &RenderStyle::setVisitedLinkCaretColor),
     2080        new CaretColorPropertyWrapper,
    20282081
    20292082        new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor),
  • trunk/Source/WebCore/css/CSSProperties.json

    r274793 r275092  
    189189            "inherited": true,
    190190            "codegen-properties": {
    191                 "initial": "currentColor",
    192                 "visited-link-color-support": true
     191                "visited-link-color-support": true,
     192                "custom": "All"
    193193            },
    194194            "specification": {
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r274793 r275092  
    11121112    void setTextStrokeWidth(float w) { SET_VAR(m_rareInheritedData, textStrokeWidth, w); }
    11131113    void setTextFillColor(const Color& c) { SET_VAR(m_rareInheritedData, textFillColor, c); }
    1114     void setCaretColor(const Color& c) { SET_VAR(m_rareInheritedData, caretColor, c); }
     1114    void setCaretColor(const Color& c) { SET_VAR(m_rareInheritedData, caretColor, c); SET_VAR(m_rareInheritedData, hasAutoCaretColor, false);  }
     1115    void setHasAutoCaretColor() { SET_VAR(m_rareInheritedData, hasAutoCaretColor, true); SET_VAR(m_rareInheritedData, caretColor, currentColor()); }
    11151116    void setOpacity(float f) { float v = clampTo<float>(f, 0.f, 1.f); SET_VAR(m_rareNonInheritedData, opacity, v); }
    11161117    void setAppearance(ControlPart a) { SET_VAR(m_rareNonInheritedData, appearance, a); }
     
    18081809    void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextFillColor, v); }
    18091810    void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextStrokeColor, v); }
    1810     void setVisitedLinkCaretColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkCaretColor, v); }
     1811    void setVisitedLinkCaretColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkCaretColor, v); SET_VAR(m_rareInheritedData, hasVisitedLinkAutoCaretColor, false); }
     1812    void setHasVisitedLinkAutoCaretColor() { SET_VAR(m_rareInheritedData, hasVisitedLinkAutoCaretColor, true); SET_VAR(m_rareInheritedData, visitedLinkCaretColor, currentColor()); }
    18111813
    18121814    void inheritUnicodeBidiFrom(const RenderStyle* parent) { m_nonInheritedFlags.unicodeBidi = parent->m_nonInheritedFlags.unicodeBidi; }
     
    18311833    const Color& textStrokeColor() const { return m_rareInheritedData->textStrokeColor; }
    18321834    const Color& caretColor() const { return m_rareInheritedData->caretColor; }
     1835    bool hasAutoCaretColor() const { return m_rareInheritedData->hasAutoCaretColor; }
    18331836    const Color& visitedLinkColor() const;
    18341837    const Color& visitedLinkBackgroundColor() const { return m_rareNonInheritedData->visitedLinkBackgroundColor; }
     
    18451848    const Color& visitedLinkTextStrokeColor() const { return m_rareInheritedData->visitedLinkTextStrokeColor; }
    18461849    const Color& visitedLinkCaretColor() const { return m_rareInheritedData->visitedLinkCaretColor; }
     1850    bool hasVisitedLinkAutoCaretColor() const { return m_rareInheritedData->hasVisitedLinkAutoCaretColor; }
    18471851
    18481852    const Color& stopColor() const { return svgStyle().stopColor(); }
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r267940 r275092  
    136136    , hasSetStrokeColor(false)
    137137    , mathStyle(static_cast<unsigned>(RenderStyle::initialMathStyle()))
     138    , hasAutoCaretColor(true)
     139    , hasVisitedLinkAutoCaretColor(true)
    138140    , effectiveTouchActions(RenderStyle::initialTouchActions())
    139141    , strokeWidth(RenderStyle::initialStrokeWidth())
     
    232234    , hasSetStrokeColor(o.hasSetStrokeColor)
    233235    , mathStyle(o.mathStyle)
     236    , hasAutoCaretColor(o.hasAutoCaretColor)
     237    , hasVisitedLinkAutoCaretColor(o.hasVisitedLinkAutoCaretColor)
    234238    , effectiveTouchActions(o.effectiveTouchActions)
    235239    , eventListenerRegionTypes(o.eventListenerRegionTypes)
     
    355359        && hasSetStrokeColor == o.hasSetStrokeColor
    356360        && mathStyle == o.mathStyle
     361        && hasAutoCaretColor == o.hasAutoCaretColor
     362        && hasVisitedLinkAutoCaretColor == o.hasVisitedLinkAutoCaretColor
    357363        && effectiveTouchActions == o.effectiveTouchActions
    358364        && eventListenerRegionTypes == o.eventListenerRegionTypes
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h

    r274050 r275092  
    161161    unsigned mathStyle : 1;
    162162
     163    unsigned hasAutoCaretColor : 1;
     164    unsigned hasVisitedLinkAutoCaretColor : 1;
     165
    163166    OptionSet<TouchAction> effectiveTouchActions;
    164167    OptionSet<EventListenerRegionType> eventListenerRegionTypes;
  • trunk/Source/WebCore/style/StyleBuilderCustom.h

    r274957 r275092  
    7878    DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageWidth);
    7979    DECLARE_PROPERTY_CUSTOM_HANDLERS(BoxShadow);
     80    DECLARE_PROPERTY_CUSTOM_HANDLERS(CaretColor);
    8081    DECLARE_PROPERTY_CUSTOM_HANDLERS(Clip);
    8182    DECLARE_PROPERTY_CUSTOM_HANDLERS(Contain);
     
    794795    builderState.style().setOutlineStyleIsAuto(primitiveValue);
    795796    builderState.style().setOutlineStyle(primitiveValue);
     797}
     798
     799inline void BuilderCustom::applyInitialCaretColor(BuilderState& builderState)
     800{
     801    if (builderState.applyPropertyToRegularStyle())
     802        builderState.style().setHasAutoCaretColor();
     803    if (builderState.applyPropertyToVisitedLinkStyle())
     804        builderState.style().setHasVisitedLinkAutoCaretColor();
     805}
     806
     807inline void BuilderCustom::applyInheritCaretColor(BuilderState& builderState)
     808{
     809    Color color = builderState.parentStyle().caretColor();
     810    if (builderState.applyPropertyToRegularStyle()) {
     811        if (builderState.parentStyle().hasAutoCaretColor())
     812            builderState.style().setHasAutoCaretColor();
     813        else
     814            builderState.style().setCaretColor(color);
     815    }
     816    if (builderState.applyPropertyToVisitedLinkStyle()) {
     817        if (builderState.parentStyle().hasVisitedLinkAutoCaretColor())
     818            builderState.style().setHasVisitedLinkAutoCaretColor();
     819        else
     820            builderState.style().setVisitedLinkCaretColor(color);
     821    }
     822}
     823
     824inline void BuilderCustom::applyValueCaretColor(BuilderState& builderState, CSSValue& value)
     825{
     826    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
     827    if (builderState.applyPropertyToRegularStyle()) {
     828        if (primitiveValue.valueID() == CSSValueAuto)
     829            builderState.style().setHasAutoCaretColor();
     830        else
     831            builderState.style().setCaretColor(builderState.colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ false));
     832    }
     833    if (builderState.applyPropertyToVisitedLinkStyle()) {
     834        if (primitiveValue.valueID() == CSSValueAuto)
     835            builderState.style().setHasVisitedLinkAutoCaretColor();
     836        else
     837            builderState.style().setVisitedLinkCaretColor(builderState.colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
     838    }
    796839}
    797840
Note: See TracChangeset for help on using the changeset viewer.