Ignore:
Timestamp:
Jan 3, 2022, 3:55:54 AM (3 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.