- Revision
- 287535
- Author
- [email protected]
- Date
- 2022-01-03 03:55:54 -0800 (Mon, 03 Jan 2022)
Log 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):
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (287534 => 287535)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-03 10:00:53 UTC (rev 287534)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-03 11:55:54 UTC (rev 287535)
@@ -1,3 +1,16 @@
+2022-01-03 Antoine Quint <[email protected]>
+
+ Support the "animation" shorthand property in the computed style
+ https://bugs.webkit.org/show_bug.cgi?id=234785
+
+ Reviewed by Sam Weinig.
+
+ 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:
+
2022-01-02 Antoine Quint <[email protected]>
"animation" shorthand should list all longhand values when serializing
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/computed-style-animation-parsing-expected.txt (287534 => 287535)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/computed-style-animation-parsing-expected.txt 2022-01-03 10:00:53 UTC (rev 287534)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/computed-style-animation-parsing-expected.txt 2022-01-03 11:55:54 UTC (rev 287535)
@@ -1,7 +1,7 @@
PASS Test animation name being empty.
-FAIL Test a non-conflicting animation name. assert_equals: computedStyle2.animationName expected "myShorthandAnim" but got "none"
-FAIL Test an animation name that is the same as a possible animation fill-mode. assert_equals: computedStyle2.animationName expected "forwards" but got "none"
-FAIL Test an animation name that is the same as a possible animation direction. assert_equals: computedStyle2.animationName expected "normal" but got "none"
-FAIL Test an animation name that is the same as a possible running state. assert_equals: computedStyle2.animationName expected "running" but got "none"
+PASS Test a non-conflicting animation name.
+PASS Test an animation name that is the same as a possible animation fill-mode.
+PASS Test an animation name that is the same as a possible animation direction.
+PASS Test an animation name that is the same as a possible running state.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-computed-expected.txt (287534 => 287535)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-computed-expected.txt 2022-01-03 10:00:53 UTC (rev 287534)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-computed-expected.txt 2022-01-03 11:55:54 UTC (rev 287535)
@@ -1,13 +1,13 @@
-FAIL Property animation value '1s' assert_equals: expected "1s ease 0s 1 normal none running none" but got ""
-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 ""
-FAIL Property animation value '1s -3s' assert_equals: expected "1s ease -3s 1 normal none running none" but got ""
-FAIL Property animation value '4' assert_equals: expected "0s ease 0s 4 normal none running none" but got ""
-FAIL Property animation value 'reverse' assert_equals: expected "0s ease 0s 1 reverse none running none" but got ""
-FAIL Property animation value 'both' assert_equals: expected "0s ease 0s 1 normal both running none" but got ""
-FAIL Property animation value 'paused' assert_equals: expected "0s ease 0s 1 normal none paused none" but got ""
-FAIL Property animation value 'none' assert_equals: expected "0s ease 0s 1 normal none running none" but got ""
-FAIL Property animation value 'anim' assert_equals: expected "0s ease 0s 1 normal none running anim" but got ""
-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 ""
-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 ""
+PASS Property animation value '1s'
+PASS Property animation value 'cubic-bezier(0, -2, 1, 3)'
+PASS Property animation value '1s -3s'
+PASS Property animation value '4'
+PASS Property animation value 'reverse'
+PASS Property animation value 'both'
+PASS Property animation value 'paused'
+PASS Property animation value 'none'
+PASS Property animation value 'anim'
+PASS Property animation value 'anim paused both reverse 4 1s -3s cubic-bezier(0, -2, 1, 3)'
+PASS Property animation value 'anim paused both reverse, 4 1s -3s cubic-bezier(0, -2, 1, 3)'
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt (287534 => 287535)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt 2022-01-03 10:00:53 UTC (rev 287534)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt 2022-01-03 11:55:54 UTC (rev 287535)
@@ -22,7 +22,7 @@
PASS Property unicode-bidi value 'plaintext' in ::marker
PASS Property direction value 'rtl' in ::marker
PASS Property content value '"foo"' in ::marker
-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 ""
+PASS Property animation value '1s linear 2s infinite alternate forwards paused anim' in ::marker
PASS Property animation-delay value '1s' in ::marker
PASS Property animation-direction value 'alternate' in ::marker
PASS Property animation-duration value '2s' in ::marker
Modified: trunk/Source/WebCore/ChangeLog (287534 => 287535)
--- trunk/Source/WebCore/ChangeLog 2022-01-03 10:00:53 UTC (rev 287534)
+++ trunk/Source/WebCore/ChangeLog 2022-01-03 11:55:54 UTC (rev 287535)
@@ -1,3 +1,20 @@
+2022-01-03 Antoine Quint <[email protected]>
+
+ Support the "animation" shorthand property in the computed style
+ https://bugs.webkit.org/show_bug.cgi?id=234785
+
+ Reviewed by Sam Weinig.
+
+ 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):
+
2022-01-02 Antoine Quint <[email protected]>
"animation" shorthand should list all longhand values when serializing
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (287534 => 287535)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2022-01-03 10:00:53 UTC (rev 287534)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2022-01-03 11:55:54 UTC (rev 287535)
@@ -1485,6 +1485,27 @@
return list;
}
+static Ref<CSSValueList> animationShorthandValue(const AnimationList* animationList)
+{
+ auto parentList = CSSValueList::createCommaSeparated();
+ if (animationList) {
+ for (size_t i = 0; i < animationList->size(); ++i) {
+ const auto& animation = animationList->animation(i);
+ auto childList = CSSValueList::createSpaceSeparated();
+ childList->append(ComputedStyleExtractor::valueForAnimationDuration(animation.duration()));
+ childList->append(ComputedStyleExtractor::valueForAnimationTimingFunction(*animation.timingFunction()));
+ childList->append(ComputedStyleExtractor::valueForAnimationDelay(animation.delay()));
+ childList->append(ComputedStyleExtractor::valueForAnimationIterationCount(animation.iterationCount()));
+ childList->append(ComputedStyleExtractor::valueForAnimationDirection(animation.direction()));
+ childList->append(ComputedStyleExtractor::valueForAnimationFillMode(animation.fillMode()));
+ childList->append(ComputedStyleExtractor::valueForAnimationPlayState(animation.playState()));
+ childList->append(ComputedStyleExtractor::valueForAnimationName(animation.name()));
+ parentList->append(childList);
+ }
+ }
+ return parentList;
+}
+
static Ref<CSSValue> createLineBoxContainValue(OptionSet<LineBoxContain> lineBoxContain)
{
if (!lineBoxContain)
@@ -3566,6 +3587,8 @@
if (style.boxSizing() == BoxSizing::ContentBox)
return cssValuePool.createIdentifierValue(CSSValueContentBox);
return cssValuePool.createIdentifierValue(CSSValueBorderBox);
+ case CSSPropertyAnimation:
+ return animationShorthandValue(style.animations());
case CSSPropertyAnimationDelay:
return delayValue(style.animations());
case CSSPropertyAnimationDirection: {
@@ -4098,7 +4121,6 @@
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
case CSSPropertyAll:
- case CSSPropertyAnimation:
case CSSPropertyTextEmphasis:
break;