Changeset 287535 in webkit


Ignore:
Timestamp:
Jan 3, 2022 3:55:54 AM (7 months ago)
Author:
graouts@webkit.org
Message:

Support the "animation" shorthand property in the computed style
https://bugs.webkit.org/show_bug.cgi?id=234785

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Mark WPT progressions.

  • web-platform-tests/css/css-animations/computed-style-animation-parsing-expected.txt:
  • web-platform-tests/css/css-animations/parsing/animation-computed-expected.txt:
  • web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:

Source/WebCore:

There is an existing WPT for the "animation" shorthand in the computed style which we
used to fail because we would simply not do any work to return the longhands compiled
into a list. It seems that the CSS WG, per https://github.com/w3c/csswg-drafts/issues/2529,
is moving in the direction of specifying what happens with shorthands in computed style,
so we're adding support for the "animation" shorthand.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::animationShorthandValue):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

Location:
trunk
Files:
6 edited

Legend:

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

    r287534 r287535  
     12022-01-03  Antoine Quint  <graouts@webkit.org>
     2
     3        Support the "animation" shorthand property in the computed style
     4        https://bugs.webkit.org/show_bug.cgi?id=234785
     5
     6        Reviewed by Sam Weinig.
     7
     8        Mark WPT progressions.
     9
     10        * web-platform-tests/css/css-animations/computed-style-animation-parsing-expected.txt:
     11        * web-platform-tests/css/css-animations/parsing/animation-computed-expected.txt:
     12        * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:
     13
    1142022-01-02  Antoine Quint  <graouts@webkit.org>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/computed-style-animation-parsing-expected.txt

    r267650 r287535  
    11
    22PASS Test animation name being empty.
    3 FAIL Test a non-conflicting animation name. assert_equals: computedStyle2.animationName expected "myShorthandAnim" but got "none"
    4 FAIL Test an animation name that is the same as a possible animation fill-mode. assert_equals: computedStyle2.animationName expected "forwards" but got "none"
    5 FAIL Test an animation name that is the same as a possible animation direction. assert_equals: computedStyle2.animationName expected "normal" but got "none"
    6 FAIL Test an animation name that is the same as a possible running state. assert_equals: computedStyle2.animationName expected "running" but got "none"
     3PASS Test a non-conflicting animation name.
     4PASS Test an animation name that is the same as a possible animation fill-mode.
     5PASS Test an animation name that is the same as a possible animation direction.
     6PASS Test an animation name that is the same as a possible running state.
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-computed-expected.txt

    r264456 r287535  
    11
    2 FAIL Property animation value '1s' assert_equals: expected "1s ease 0s 1 normal none running none" but got ""
    3 FAIL Property animation value 'cubic-bezier(0, -2, 1, 3)' assert_equals: expected "0s cubic-bezier(0, -2, 1, 3) 0s 1 normal none running none" but got ""
    4 FAIL Property animation value '1s -3s' assert_equals: expected "1s ease -3s 1 normal none running none" but got ""
    5 FAIL Property animation value '4' assert_equals: expected "0s ease 0s 4 normal none running none" but got ""
    6 FAIL Property animation value 'reverse' assert_equals: expected "0s ease 0s 1 reverse none running none" but got ""
    7 FAIL Property animation value 'both' assert_equals: expected "0s ease 0s 1 normal both running none" but got ""
    8 FAIL Property animation value 'paused' assert_equals: expected "0s ease 0s 1 normal none paused none" but got ""
    9 FAIL Property animation value 'none' assert_equals: expected "0s ease 0s 1 normal none running none" but got ""
    10 FAIL Property animation value 'anim' assert_equals: expected "0s ease 0s 1 normal none running anim" but got ""
    11 FAIL Property animation value 'anim paused both reverse 4 1s -3s cubic-bezier(0, -2, 1, 3)' assert_equals: expected "1s cubic-bezier(0, -2, 1, 3) -3s 4 reverse both paused anim" but got ""
    12 FAIL Property animation value 'anim paused both reverse, 4 1s -3s cubic-bezier(0, -2, 1, 3)' assert_equals: expected "0s ease 0s 1 reverse both paused anim, 1s cubic-bezier(0, -2, 1, 3) -3s 4 normal none running none" but got ""
     2PASS Property animation value '1s'
     3PASS Property animation value 'cubic-bezier(0, -2, 1, 3)'
     4PASS Property animation value '1s -3s'
     5PASS Property animation value '4'
     6PASS Property animation value 'reverse'
     7PASS Property animation value 'both'
     8PASS Property animation value 'paused'
     9PASS Property animation value 'none'
     10PASS Property animation value 'anim'
     11PASS Property animation value 'anim paused both reverse 4 1s -3s cubic-bezier(0, -2, 1, 3)'
     12PASS Property animation value 'anim paused both reverse, 4 1s -3s cubic-bezier(0, -2, 1, 3)'
    1313
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt

    r287487 r287535  
    2323PASS Property direction value 'rtl' in ::marker
    2424PASS Property content value '"foo"' in ::marker
    25 FAIL Property animation value '1s linear 2s infinite alternate forwards paused anim' in ::marker assert_equals: expected "1s linear 2s infinite alternate forwards paused anim" but got ""
     25PASS Property animation value '1s linear 2s infinite alternate forwards paused anim' in ::marker
    2626PASS Property animation-delay value '1s' in ::marker
    2727PASS Property animation-direction value 'alternate' in ::marker
  • trunk/Source/WebCore/ChangeLog

    r287534 r287535  
     12022-01-03  Antoine Quint  <graouts@webkit.org>
     2
     3        Support the "animation" shorthand property in the computed style
     4        https://bugs.webkit.org/show_bug.cgi?id=234785
     5
     6        Reviewed by Sam Weinig.
     7
     8        There is an existing WPT for the "animation" shorthand in the computed style which we
     9        used to fail because we would simply not do any work to return the longhands compiled
     10        into a list. It seems that the CSS WG, per https://github.com/w3c/csswg-drafts/issues/2529,
     11        is moving in the direction of specifying what happens with shorthands in computed style,
     12        so we're adding support for the "animation" shorthand.
     13
     14        * css/CSSComputedStyleDeclaration.cpp:
     15        (WebCore::animationShorthandValue):
     16        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
     17
    1182022-01-02  Antoine Quint  <graouts@webkit.org>
    219
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r287534 r287535  
    14841484        list->append(ComputedStyleExtractor::valueForAnimationTimingFunction(Animation::initialTimingFunction()));
    14851485    return list;
     1486}
     1487
     1488static Ref<CSSValueList> animationShorthandValue(const AnimationList* animationList)
     1489{
     1490    auto parentList = CSSValueList::createCommaSeparated();
     1491    if (animationList) {
     1492        for (size_t i = 0; i < animationList->size(); ++i) {
     1493            const auto& animation = animationList->animation(i);
     1494            auto childList = CSSValueList::createSpaceSeparated();
     1495            childList->append(ComputedStyleExtractor::valueForAnimationDuration(animation.duration()));
     1496            childList->append(ComputedStyleExtractor::valueForAnimationTimingFunction(*animation.timingFunction()));
     1497            childList->append(ComputedStyleExtractor::valueForAnimationDelay(animation.delay()));
     1498            childList->append(ComputedStyleExtractor::valueForAnimationIterationCount(animation.iterationCount()));
     1499            childList->append(ComputedStyleExtractor::valueForAnimationDirection(animation.direction()));
     1500            childList->append(ComputedStyleExtractor::valueForAnimationFillMode(animation.fillMode()));
     1501            childList->append(ComputedStyleExtractor::valueForAnimationPlayState(animation.playState()));
     1502            childList->append(ComputedStyleExtractor::valueForAnimationName(animation.name()));
     1503            parentList->append(childList);
     1504        }
     1505    }
     1506    return parentList;
    14861507}
    14871508
     
    35673588                return cssValuePool.createIdentifierValue(CSSValueContentBox);
    35683589            return cssValuePool.createIdentifierValue(CSSValueBorderBox);
     3590        case CSSPropertyAnimation:
     3591            return animationShorthandValue(style.animations());
    35693592        case CSSPropertyAnimationDelay:
    35703593            return delayValue(style.animations());
     
    40994122        /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
    41004123        case CSSPropertyAll:
    4101         case CSSPropertyAnimation:
    41024124        case CSSPropertyTextEmphasis:
    41034125            break;
Note: See TracChangeset for help on using the changeset viewer.