Title: [288433] trunk
Revision
288433
Author
[email protected]
Date
2022-01-24 02:59:39 -0800 (Mon, 24 Jan 2022)

Log Message

[Web Animations] add support for animation-composition CSS property
https://bugs.webkit.org/show_bug.cgi?id=232086
<rdar://problem/84508394>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Mark WPT progressions and import one ::marker WPT test that wasn't imported originally with bug 235443.

* web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt:
* web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt:
* web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt:
* web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt:
* web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:
* web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html:
* web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:

Source/WebCore:

Add support for the "animation-composition" property from the CSS Animations Level 2 specification.
This property sets the "composite" property on the animation's effect and is overridden by use of
the Web Animations API to set that property.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* animation/CSSAnimation.cpp:
(WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
(WebCore::CSSAnimation::setBindingsEffect):
(WebCore::CSSAnimation::effectCompositeOperationWasSetUsingBindings):
* animation/CSSAnimation.h:
* animation/CompositeOperation.cpp: Added.
(WebCore::toCompositeOperation):
* animation/CompositeOperation.h:
* animation/CompositeOperationOrAuto.h:
(WebCore::toCompositeOperationOrAuto):
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::getBindingsKeyframes):
(WebCore::KeyframeEffect::getKeyframes):
(WebCore::KeyframeEffect::bindingsComposite const):
(WebCore::KeyframeEffect::setBindingsComposite):
* animation/KeyframeEffect.h:
* animation/KeyframeEffect.idl:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForAnimationComposition):
(WebCore::ComputedStyleExtractor::addValueForAnimationPropertyToList):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapAnimationCompositeOperation):
* css/CSSToStyleMap.h:
* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeAnimationValue):
(WebCore::CSSPropertyParser::parseSingleValue):
* platform/animation/Animation.cpp:
(WebCore::Animation::Animation):
* platform/animation/Animation.h:
(WebCore::Animation::clearCompositeOperation):
(WebCore::Animation::fillCompositeOperation):
(WebCore::Animation::isCompositeOperationFilled const):
* platform/animation/AnimationList.cpp:
(WebCore::AnimationList::fillUnsetProperties):
* style/PropertyAllowlist.cpp:
(WebCore::Style::isValidMarkerStyleProperty):
* style/StyleResolver.cpp:
(WebCore::Style::Resolver::styleForKeyframe):
(WebCore::Style::Resolver::keyframeStylesForAnimation):

LayoutTests:

Update existing tests to account for the new "animation-composition" CSS property.

* animations/fill-unset-properties-expected.txt:
* animations/fill-unset-properties.html:
* platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288432 => 288433)


--- trunk/LayoutTests/ChangeLog	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/ChangeLog	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,3 +1,20 @@
+2022-01-24  Antoine Quint  <[email protected]>
+
+        [Web Animations] add support for animation-composition CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=232086
+        <rdar://problem/84508394>
+
+        Reviewed by Darin Adler.
+
+        Update existing tests to account for the new "animation-composition" CSS property.
+
+        * animations/fill-unset-properties-expected.txt:
+        * animations/fill-unset-properties.html:
+        * platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+
 2022-01-23  Matt Woodrow  <[email protected]>
 
         Position:fixed layers shouldn't allocate a backing buffer if all children are offscreen.

Modified: trunk/LayoutTests/animations/fill-unset-properties-expected.txt (288432 => 288433)


--- trunk/LayoutTests/animations/fill-unset-properties-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/animations/fill-unset-properties-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -10,4 +10,5 @@
 Testing animationPlayState: PASS
 Testing animationIterationCount: PASS
 Testing animationTimingFunction: PASS
+Testing animationComposition: PASS
 

Modified: trunk/LayoutTests/animations/fill-unset-properties.html (288432 => 288433)


--- trunk/LayoutTests/animations/fill-unset-properties.html	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/animations/fill-unset-properties.html	2022-01-24 10:59:39 UTC (rev 288433)
@@ -20,6 +20,7 @@
     animation-play-state: running, paused, running;
     animation-iteration-count: 1, 2, 3;
     animation-timing-function: linear;
+    animation-composition: add, replace, accumulate;
 }
 @keyframes a { }
 @keyframes b { }
@@ -43,7 +44,8 @@
       { 'property': 'animationFillMode',  'value': 'forwards, backwards' },
       { 'property': 'animationPlayState', 'value': 'running, paused, running' },
       { 'property': 'animationIterationCount', 'value': '1, 2, 3' },
-      { 'property': 'animationTimingFunction', 'value': 'linear' }
+      { 'property': 'animationTimingFunction', 'value': 'linear' },
+      { 'property': 'animationComposition', 'value': 'add, replace, accumulate' }
     ];
     
     function start()

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,3 +1,22 @@
+2022-01-24  Antoine Quint  <[email protected]>
+
+        [Web Animations] add support for animation-composition CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=232086
+        <rdar://problem/84508394>
+
+        Reviewed by Darin Adler.
+
+        Mark WPT progressions and import one ::marker WPT test that wasn't imported originally with bug 235443.
+
+        * web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt:
+        * web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt:
+        * web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt:
+        * web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt:
+        * web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:
+        * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html:
+        * web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+
 2022-01-23  Sam Weinig  <[email protected]>
 
         Support interpolating colors with missing/none components via color-mix()

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -5,6 +5,6 @@
 PASS A play-pending animation's effect whose effect is replaced still exits the pending state
 PASS CSS animation events are dispatched at the original element even after setting an effect with a different target element
 PASS After replacing a finished animation's effect with a longer one it fires an animationstart event
-FAIL Setting animation-composition sets the composite property on the effect assert_equals: expected "add" but got "replace"
+PASS Setting animation-composition sets the composite property on the effect
 PASS Replacing the effect of a CSSAnimation causes subsequent changes to corresponding animation-* properties to be ignored
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -5,8 +5,8 @@
 PASS KeyframeEffect.getKeyframes() returns frames with expected easing values, when the easing is specified on each keyframe
 PASS KeyframeEffect.getKeyframes() returns frames with expected easing values, when the easing is specified on some keyframes
 PASS KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is set on the effect using animation-composition on the element
-FAIL KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is specified on each keyframe assert_equals: value of 'composite' on ComputedKeyframe #0 expected "replace" but got "auto"
-FAIL KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is specified on some keyframes assert_equals: value of 'composite' on ComputedKeyframe #0 expected "add" but got "auto"
+PASS KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is specified on each keyframe
+PASS KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is specified on some keyframes
 PASS KeyframeEffect.getKeyframes() returns expected frames for a simple animation that specifies a single shorthand property
 PASS KeyframeEffect.getKeyframes() returns expected frames for an animation with a 0% keyframe and no 100% keyframe
 PASS KeyframeEffect.getKeyframes() returns expected frames for an animation with a 100% keyframe and no 0% keyframe

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,3 +1,3 @@
 
-FAIL Property animation-composition value 'replace, add, accumulate' assert_true: animation-composition doesn't seem to be supported in the computed style expected true got false
+PASS Property animation-composition value 'replace, add, accumulate'
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,6 +1,6 @@
 
-FAIL e.style['animation-composition'] = "replace" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['animation-composition'] = "add" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['animation-composition'] = "accumulate" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['animation-composition'] = "replace, add, accumulate" should set the property value assert_not_equals: property should be set got disallowed value ""
+PASS e.style['animation-composition'] = "replace" should set the property value
+PASS e.style['animation-composition'] = "add" should set the property value
+PASS e.style['animation-composition'] = "accumulate" should set the property value
+PASS e.style['animation-composition'] = "replace, add, accumulate" should set the property value
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -9,6 +9,7 @@
 PASS alignment-baseline
 PASS all
 PASS alt
+PASS animation-composition
 PASS animation-delay
 PASS animation-direction
 PASS animation-duration

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -34,6 +34,7 @@
 PASS Property animation-name value 'anim' in ::marker
 PASS Property animation-play-state value 'paused' in ::marker
 PASS Property animation-timing-function value 'linear' in ::marker
+PASS Property animation-composition value 'add' in ::marker
 PASS Property transition value 'display 1s linear 2s' in ::marker
 PASS Property transition-delay value '1s' in ::marker
 PASS Property transition-duration value '2s' in ::marker

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html	2022-01-24 10:59:39 UTC (rev 288433)
@@ -61,6 +61,7 @@
 test_pseudo_computed_value("::marker", "animation-name", "anim");
 test_pseudo_computed_value("::marker", "animation-play-state", "paused");
 test_pseudo_computed_value("::marker", "animation-timing-function", "linear");
+test_pseudo_computed_value("::marker", "animation-composition", "add");
 
 // ::marker supports transition properties.
 test_pseudo_computed_value("::marker", "transition", "display 1s linear 2s");

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (288432 => 288433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 395
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 395
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 395
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 395
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 396
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 396
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 396
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 396
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (288432 => 288433)


--- trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -9,6 +9,7 @@
 PASS alignment-baseline
 PASS all
 PASS alt
+PASS animation-composition
 PASS animation-delay
 PASS animation-direction
 PASS animation-duration

Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (288432 => 288433)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 392
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 392
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 392
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 392
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 393
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 393
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 393
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 393
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (288432 => 288433)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -8,6 +8,7 @@
 PASS alignment-baseline
 PASS all
 PASS alt
+PASS animation-composition
 PASS animation-delay
 PASS animation-direction
 PASS animation-duration

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (288432 => 288433)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 397
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 397
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 397
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 397
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 398
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/Source/WebCore/ChangeLog (288432 => 288433)


--- trunk/Source/WebCore/ChangeLog	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/ChangeLog	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1,3 +1,60 @@
+2022-01-24  Antoine Quint  <[email protected]>
+
+        [Web Animations] add support for animation-composition CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=232086
+        <rdar://problem/84508394>
+
+        Reviewed by Darin Adler.
+
+        Add support for the "animation-composition" property from the CSS Animations Level 2 specification.
+        This property sets the "composite" property on the animation's effect and is overridden by use of
+        the Web Animations API to set that property.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * animation/CSSAnimation.cpp:
+        (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
+        (WebCore::CSSAnimation::setBindingsEffect):
+        (WebCore::CSSAnimation::effectCompositeOperationWasSetUsingBindings):
+        * animation/CSSAnimation.h:
+        * animation/CompositeOperation.cpp: Added.
+        (WebCore::toCompositeOperation):
+        * animation/CompositeOperation.h:
+        * animation/CompositeOperationOrAuto.h:
+        (WebCore::toCompositeOperationOrAuto):
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::getBindingsKeyframes):
+        (WebCore::KeyframeEffect::getKeyframes):
+        (WebCore::KeyframeEffect::bindingsComposite const):
+        (WebCore::KeyframeEffect::setBindingsComposite):
+        * animation/KeyframeEffect.h:
+        * animation/KeyframeEffect.idl:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::valueForAnimationComposition):
+        (WebCore::ComputedStyleExtractor::addValueForAnimationPropertyToList):
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/CSSProperties.json:
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::mapAnimationCompositeOperation):
+        * css/CSSToStyleMap.h:
+        * css/CSSValueKeywords.in:
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeAnimationValue):
+        (WebCore::CSSPropertyParser::parseSingleValue):
+        * platform/animation/Animation.cpp:
+        (WebCore::Animation::Animation):
+        * platform/animation/Animation.h:
+        (WebCore::Animation::clearCompositeOperation):
+        (WebCore::Animation::fillCompositeOperation):
+        (WebCore::Animation::isCompositeOperationFilled const):
+        * platform/animation/AnimationList.cpp:
+        (WebCore::AnimationList::fillUnsetProperties):
+        * style/PropertyAllowlist.cpp:
+        (WebCore::Style::isValidMarkerStyleProperty):
+        * style/StyleResolver.cpp:
+        (WebCore::Style::Resolver::styleForKeyframe):
+        (WebCore::Style::Resolver::keyframeStylesForAnimation):
+
 2022-01-24  Said Abou-Hallawa  <[email protected]>
 
         [GPU Process] [Filters] Move FEImage to the 'platform' directory

Modified: trunk/Source/WebCore/Sources.txt (288432 => 288433)


--- trunk/Source/WebCore/Sources.txt	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/Sources.txt	2022-01-24 10:59:39 UTC (rev 288433)
@@ -475,6 +475,7 @@
 animation/CSSAnimation.cpp
 animation/CSSPropertyAnimation.cpp
 animation/CSSTransition.cpp
+animation/CompositeOperation.cpp
 animation/CustomEffect.cpp
 animation/DeclarativeAnimation.cpp
 animation/DocumentTimeline.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (288432 => 288433)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-01-24 10:59:39 UTC (rev 288433)
@@ -11181,6 +11181,7 @@
 		718675461DF101C60033D7F3 /* seek-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "seek-support.js"; sourceTree = "<group>"; };
 		718C7F561DD385C500B733C8 /* status-label.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "status-label.css"; sourceTree = "<group>"; };
 		718C7F571DD385C500B733C8 /* status-label.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "status-label.js"; sourceTree = "<group>"; };
+		718F2486279DE9EF00C3204D /* CompositeOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompositeOperation.cpp; sourceTree = "<group>"; };
 		7199B94A2551F0E100494A57 /* StyleContentAlignmentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleContentAlignmentData.cpp; sourceTree = "<group>"; };
 		7199B94F2552103E00494A57 /* StyleSelfAlignmentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSelfAlignmentData.cpp; sourceTree = "<group>"; };
 		7199F81E26FE15C000C627C2 /* close-button.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = "close-button.js"; sourceTree = "<group>"; };
@@ -24441,6 +24442,7 @@
 				71025EC71F99F096004A250C /* AnimationTimeline.h */,
 				71025EC91F99F096004A250C /* AnimationTimeline.idl */,
 				7156BC9F21CA350600534397 /* BasicEffectTiming.h */,
+				718F2486279DE9EF00C3204D /* CompositeOperation.cpp */,
 				71247E351FEA5F81008C08CE /* CompositeOperation.h */,
 				71247E361FEA5F81008C08CE /* CompositeOperation.idl */,
 				7111243B216FA6E000EB7B67 /* CompositeOperationOrAuto.h */,

Modified: trunk/Source/WebCore/animation/CSSAnimation.cpp (288432 => 288433)


--- trunk/Source/WebCore/animation/CSSAnimation.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/animation/CSSAnimation.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -27,6 +27,7 @@
 #include "CSSAnimation.h"
 
 #include "Animation.h"
+#include "AnimationEffect.h"
 #include "AnimationEvent.h"
 #include "InspectorInstrumentation.h"
 #include "KeyframeEffect.h"
@@ -110,6 +111,11 @@
     if (!m_overriddenProperties.contains(Property::Duration))
         animationEffect->setIterationDuration(Seconds(animation.duration()));
 
+    if (!m_overriddenProperties.contains(Property::CompositeOperation)) {
+        if (is<KeyframeEffect>(animationEffect))
+            downcast<KeyframeEffect>(*animationEffect).setComposite(animation.compositeOperation());
+    }
+
     animationEffect->updateStaticTimingProperties();
     effectTimingDidChange();
 
@@ -168,6 +174,7 @@
         m_overriddenProperties.add(Property::Direction);
         m_overriddenProperties.add(Property::Delay);
         m_overriddenProperties.add(Property::FillMode);
+        m_overriddenProperties.add(Property::CompositeOperation);
     }
 }
 
@@ -242,6 +249,11 @@
     m_overriddenProperties.add(Property::TimingFunction);
 }
 
+void CSSAnimation::effectCompositeOperationWasSetUsingBindings()
+{
+    m_overriddenProperties.add(Property::CompositeOperation);
+}
+
 void CSSAnimation::keyframesRuleDidChange()
 {
     if (m_overriddenProperties.contains(Property::Keyframes) || !is<KeyframeEffect>(effect()))

Modified: trunk/Source/WebCore/animation/CSSAnimation.h (288432 => 288433)


--- trunk/Source/WebCore/animation/CSSAnimation.h	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/animation/CSSAnimation.h	2022-01-24 10:59:39 UTC (rev 288433)
@@ -46,6 +46,7 @@
 
     void effectTimingWasUpdatedUsingBindings(OptionalEffectTiming);
     void effectKeyframesWereSetUsingBindings();
+    void effectCompositeOperationWasSetUsingBindings();
     void keyframesRuleDidChange();
     void updateKeyframesIfNeeded(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&);
 
@@ -70,7 +71,8 @@
         PlayState = 1 << 5,
         Delay = 1 << 6,
         FillMode = 1 << 7,
-        Keyframes = 1 << 8
+        Keyframes = 1 << 8,
+        CompositeOperation = 1 << 9
     };
 
     String m_animationName;

Copied: trunk/Source/WebCore/animation/CompositeOperation.cpp (from rev 288432, trunk/Source/WebCore/animation/CompositeOperationOrAuto.h) (0 => 288433)


--- trunk/Source/WebCore/animation/CompositeOperation.cpp	                        (rev 0)
+++ trunk/Source/WebCore/animation/CompositeOperation.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CompositeOperation.h"
+
+#include "CSSPrimitiveValue.h"
+#include "CSSValue.h"
+#include "CSSValueKeywords.h"
+
+namespace WebCore {
+
+std::optional<CompositeOperation> toCompositeOperation(const CSSValue& value)
+{
+    if (!is<CSSPrimitiveValue>(value))
+        return std::nullopt;
+
+    switch (downcast<CSSPrimitiveValue>(value).valueID()) {
+    case CSSValueAdd:
+        return CompositeOperation::Add;
+    case CSSValueAccumulate:
+        return CompositeOperation::Accumulate;
+    case CSSValueReplace:
+        return CompositeOperation::Replace;
+    default:
+        return std::nullopt;
+    }
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/animation/CompositeOperation.h (288432 => 288433)


--- trunk/Source/WebCore/animation/CompositeOperation.h	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/animation/CompositeOperation.h	2022-01-24 10:59:39 UTC (rev 288433)
@@ -25,8 +25,14 @@
 
 #pragma once
 
+#include <optional>
+
 namespace WebCore {
 
+class CSSValue;
+
 enum class CompositeOperation : uint8_t { Replace, Add, Accumulate };
 
+std::optional<CompositeOperation> toCompositeOperation(const CSSValue&);
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/animation/CompositeOperationOrAuto.h (288432 => 288433)


--- trunk/Source/WebCore/animation/CompositeOperationOrAuto.h	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/animation/CompositeOperationOrAuto.h	2022-01-24 10:59:39 UTC (rev 288433)
@@ -25,8 +25,22 @@
 
 #pragma once
 
+#include "CompositeOperation.h"
+
 namespace WebCore {
 
 enum class CompositeOperationOrAuto : uint8_t { Replace, Add, Accumulate, Auto };
 
+constexpr CompositeOperationOrAuto toCompositeOperationOrAuto(CompositeOperation operation)
+{
+    switch (operation) {
+    case CompositeOperation::Replace:
+        return CompositeOperationOrAuto::Replace;
+    case CompositeOperation::Add:
+        return CompositeOperationOrAuto::Add;
+    case CompositeOperation::Accumulate:
+        return CompositeOperationOrAuto::Accumulate;
+    }
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (288432 => 288433)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -596,17 +596,19 @@
     setBlendingKeyframes(keyframeList);
 }
 
-Vector<Strong<JSObject>> KeyframeEffect::getBindingsKeyframes(JSGlobalObject& lexicalGlobalObject)
+Vector<Strong<JSObject>> KeyframeEffect::getBindingsKeyframes(JSGlobalObject& lexicalGlobalObject, Document& document)
 {
     if (is<DeclarativeAnimation>(animation()))
         downcast<DeclarativeAnimation>(*animation()).flushPendingStyleChanges();
-    return getKeyframes(lexicalGlobalObject);
+    return getKeyframes(lexicalGlobalObject, document);
 }
 
-Vector<Strong<JSObject>> KeyframeEffect::getKeyframes(JSGlobalObject& lexicalGlobalObject)
+Vector<Strong<JSObject>> KeyframeEffect::getKeyframes(JSGlobalObject& lexicalGlobalObject, Document& document)
 {
     // https://drafts.csswg.org/web-animations-1/#dom-keyframeeffectreadonly-getkeyframes
 
+    auto supportsCompositeOperation = document.settings().webAnimationsCompositeOperationsEnabled();
+
     auto lock = JSLockHolder { &lexicalGlobalObject };
 
     // Since keyframes are represented by a partially open-ended dictionary type that is not currently able to be expressed with WebIDL,
@@ -700,6 +702,11 @@
             // For CSS transitions, all keyframes should return "linear" since the effect's global timing function applies.
             computedKeyframe.easing = is<CSSTransition>(animation()) ? "linear" : timingFunctionForBlendingKeyframe(keyframe)->cssText();
 
+            if (supportsCompositeOperation) {
+                if (auto compositeOperation = keyframe.compositeOperation())
+                    computedKeyframe.composite = toCompositeOperationOrAuto(*compositeOperation);
+            }
+
             auto outputKeyframe = convertDictionaryToJS(lexicalGlobalObject, *jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject), computedKeyframe);
 
             auto addPropertyToKeyframe = [&](CSSPropertyID cssPropertyId) {
@@ -773,11 +780,8 @@
             computedKeyframe.computedOffset = parsedKeyframe.computedOffset;
             computedKeyframe.easing = timingFunctionForKeyframeAtIndex(i)->cssText();
 
-            auto* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject)->scriptExecutionContext();
-            if (is<Document>(scriptExecutionContext)) {
-                if (downcast<Document>(*scriptExecutionContext).settings().webAnimationsCompositeOperationsEnabled())
-                    computedKeyframe.composite = parsedKeyframe.composite;
-            }
+            if (supportsCompositeOperation)
+                computedKeyframe.composite = parsedKeyframe.composite;
 
             auto outputKeyframe = convertDictionaryToJS(lexicalGlobalObject, *jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject), computedKeyframe);
 
@@ -2221,4 +2225,18 @@
     return AnimationEffect::timeToNextTick(timing);
 }
 
+CompositeOperation KeyframeEffect::bindingsComposite() const
+{
+    if (is<DeclarativeAnimation>(animation()))
+        downcast<DeclarativeAnimation>(*animation()).flushPendingStyleChanges();
+    return composite();
+}
+
+void KeyframeEffect::setBindingsComposite(CompositeOperation compositeOperation)
+{
+    setComposite(compositeOperation);
+    if (is<CSSAnimation>(animation()))
+        downcast<CSSAnimation>(*animation()).effectCompositeOperationWasSetUsingBindings();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (288432 => 288433)


--- trunk/Source/WebCore/animation/KeyframeEffect.h	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h	2022-01-24 10:59:39 UTC (rev 288433)
@@ -114,8 +114,8 @@
 
     const std::optional<const Styleable> targetStyleable() const;
 
-    Vector<JSC::Strong<JSC::JSObject>> getBindingsKeyframes(JSC::JSGlobalObject&);
-    Vector<JSC::Strong<JSC::JSObject>> getKeyframes(JSC::JSGlobalObject&);
+    Vector<JSC::Strong<JSC::JSObject>> getBindingsKeyframes(JSC::JSGlobalObject&, Document&);
+    Vector<JSC::Strong<JSC::JSObject>> getKeyframes(JSC::JSGlobalObject&, Document&);
     ExceptionOr<void> setBindingsKeyframes(JSC::JSGlobalObject&, JSC::Strong<JSC::JSObject>&&);
     ExceptionOr<void> setKeyframes(JSC::JSGlobalObject&, JSC::Strong<JSC::JSObject>&&);
 
@@ -123,6 +123,8 @@
     void setIterationComposite(IterationCompositeOperation iterationCompositeOperation) { m_iterationCompositeOperation = iterationCompositeOperation; }
     CompositeOperation composite() const { return m_compositeOperation; }
     void setComposite(CompositeOperation compositeOperation) { m_compositeOperation = compositeOperation; }
+    CompositeOperation bindingsComposite() const;
+    void setBindingsComposite(CompositeOperation);
 
     void getAnimatedStyle(std::unique_ptr<RenderStyle>& animatedStyle);
     void apply(RenderStyle& targetStyle, const Style::ResolutionContext&, std::optional<Seconds> = std::nullopt);

Modified: trunk/Source/WebCore/animation/KeyframeEffect.idl (288432 => 288433)


--- trunk/Source/WebCore/animation/KeyframeEffect.idl	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/animation/KeyframeEffect.idl	2022-01-24 10:59:39 UTC (rev 288433)
@@ -35,8 +35,8 @@
     attribute Element? target;
     attribute CSSOMString? pseudoElement;
     [EnabledBySetting=WebAnimationsCompositeOperationsEnabled] attribute IterationCompositeOperation iterationComposite;
-    [EnabledBySetting=WebAnimationsCompositeOperationsEnabled] attribute CompositeOperation composite;
-    [CallWith=GlobalObject, ImplementedAs=getBindingsKeyframes] sequence<object> getKeyframes();
+    [EnabledBySetting=WebAnimationsCompositeOperationsEnabled, ImplementedAs=bindingsComposite] attribute CompositeOperation composite;
+    [CallWith=GlobalObject&Document, ImplementedAs=getBindingsKeyframes] sequence<object> getKeyframes();
     [CallWith=GlobalObject, ImplementedAs=setBindingsKeyframes] undefined setKeyframes(object? keyframes);
 };
 

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (288432 => 288433)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1378,6 +1378,18 @@
     RELEASE_ASSERT_NOT_REACHED();
 }
 
+static Ref<CSSPrimitiveValue> valueForAnimationComposition(CompositeOperation operation)
+{
+    switch (operation) {
+    case CompositeOperation::Add:
+        return CSSValuePool::singleton().createIdentifierValue(CSSValueAdd);
+    case CompositeOperation::Accumulate:
+        return CSSValuePool::singleton().createIdentifierValue(CSSValueAccumulate);
+    case CompositeOperation::Replace:
+        return CSSValuePool::singleton().createIdentifierValue(CSSValueReplace);
+    }
+}
+
 static Ref<CSSPrimitiveValue> valueForAnimationPlayState(AnimationPlayState playState)
 {
     switch (playState) {
@@ -1458,7 +1470,10 @@
             list.append(valueForAnimationPlayState(animation ? animation->playState() : Animation::initialPlayState()));
     } else if (property == CSSPropertyAnimationName)
         list.append(valueForAnimationName(animation ? animation->name() : Animation::initialName()));
-    else if (property == CSSPropertyTransitionProperty) {
+    else if (property == CSSPropertyAnimationComposition) {
+        if (!animation || !animation->isCompositeOperationFilled())
+            list.append(valueForAnimationComposition(animation ? animation->compositeOperation() : Animation::initialCompositeOperation()));
+    } else if (property == CSSPropertyTransitionProperty) {
         if (animation) {
             if (!animation->isPropertyFilled())
                 list.append(createTransitionPropertyValue(*animation));
@@ -3555,6 +3570,7 @@
             return cssValuePool.createIdentifierValue(CSSValueBorderBox);
         case CSSPropertyAnimation:
             return animationShorthandValue(propertyID, style.animations());
+        case CSSPropertyAnimationComposition:
         case CSSPropertyAnimationDelay:
         case CSSPropertyAnimationDirection:
         case CSSPropertyAnimationDuration:

Modified: trunk/Source/WebCore/css/CSSProperties.json (288432 => 288433)


--- trunk/Source/WebCore/css/CSSProperties.json	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/css/CSSProperties.json	2022-01-24 10:59:39 UTC (rev 288433)
@@ -916,6 +916,25 @@
                 "description": "Used to animate elements"
             }
         },
+        "animation-composition": {
+            "values": [
+                "add",
+                "accumulate",
+                "replace"
+            ],
+            "animatable": true,
+            "codegen-properties": {
+                "name-for-methods": "CompositeOperation",
+                "settings-flag": "webAnimationsCompositeOperationsEnabled"
+            },
+            "specification": {
+                "category": "css-animations",
+                "url": "https://drafts.csswg.org/css-animations-2/#animation-composition"
+            },
+            "status": {
+                "status": "experimental"
+            }
+        },
         "animation-delay": {
             "animatable": true,
             "codegen-properties": {

Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (288432 => 288433)


--- trunk/Source/WebCore/css/CSSToStyleMap.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -37,6 +37,7 @@
 #include "CSSPrimitiveValueMappings.h"
 #include "CSSTimingFunctionValue.h"
 #include "CSSValueKeywords.h"
+#include "CompositeOperation.h"
 #include "FillLayer.h"
 #include "Pair.h"
 #include "Rect.h"
@@ -462,6 +463,14 @@
         animation.setTimingFunction(WTFMove(timingFunction));
 }
 
+void CSSToStyleMap::mapAnimationCompositeOperation(Animation& animation, const CSSValue& value)
+{
+    if (value.treatAsInitialValue(CSSPropertyAnimationComposition))
+        animation.setCompositeOperation(Animation::initialCompositeOperation());
+    else if (auto compositeOperation = toCompositeOperation(value))
+        animation.setCompositeOperation(*compositeOperation);
+}
+
 void CSSToStyleMap::mapNinePieceImage(CSSPropertyID property, CSSValue* value, NinePieceImage& image)
 {
     // If we're not a value list, then we are "none" and don't need to alter the empty image at all.

Modified: trunk/Source/WebCore/css/CSSToStyleMap.h (288432 => 288433)


--- trunk/Source/WebCore/css/CSSToStyleMap.h	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/css/CSSToStyleMap.h	2022-01-24 10:59:39 UTC (rev 288433)
@@ -68,6 +68,7 @@
     void mapAnimationPlayState(Animation&, const CSSValue&);
     void mapAnimationProperty(Animation&, const CSSValue&);
     void mapAnimationTimingFunction(Animation&, const CSSValue&);
+    void mapAnimationCompositeOperation(Animation&, const CSSValue&);
 
     void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
     void mapNinePieceImageSlice(CSSValue&, NinePieceImage&);

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (288432 => 288433)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1033,6 +1033,13 @@
 // end
 
 //
+// animation-composition
+//
+// add
+accumulate
+replace
+
+//
 // CSS_PROP_ZOOM
 //
 document

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (288432 => 288433)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -1573,6 +1573,8 @@
         return consumeAnimationName(range);
     case CSSPropertyAnimationPlayState:
         return consumeIdent<CSSValueRunning, CSSValuePaused>(range);
+    case CSSPropertyAnimationComposition:
+        return consumeIdent<CSSValueAccumulate, CSSValueAdd, CSSValueReplace>(range);
     case CSSPropertyTransitionProperty:
         return consumeTransitionProperty(range);
     case CSSPropertyAnimationTimingFunction:
@@ -4334,6 +4336,7 @@
     case CSSPropertyAnimationIterationCount:
     case CSSPropertyAnimationName:
     case CSSPropertyAnimationPlayState:
+    case CSSPropertyAnimationComposition:
     case CSSPropertyTransitionProperty:
     case CSSPropertyAnimationTimingFunction:
     case CSSPropertyTransitionTimingFunction:

Modified: trunk/Source/WebCore/platform/animation/Animation.cpp (288432 => 288433)


--- trunk/Source/WebCore/platform/animation/Animation.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/platform/animation/Animation.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -56,6 +56,7 @@
     , m_playStateFilled(false)
     , m_propertyFilled(false)
     , m_timingFunctionFilled(false)
+    , m_compositeOperationFilled(false)
 {
 }
 
@@ -91,6 +92,7 @@
     , m_playStateFilled(o.m_playStateFilled)
     , m_propertyFilled(o.m_propertyFilled)
     , m_timingFunctionFilled(o.m_timingFunctionFilled)
+    , m_compositeOperationFilled(o.m_compositeOperationFilled)
 {
 }
 

Modified: trunk/Source/WebCore/platform/animation/Animation.h (288432 => 288433)


--- trunk/Source/WebCore/platform/animation/Animation.h	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/platform/animation/Animation.h	2022-01-24 10:59:39 UTC (rev 288433)
@@ -79,7 +79,7 @@
     void clearPlayState() { m_playStateSet = false; m_playStateFilled = false; }
     void clearProperty() { m_propertySet = false; m_propertyFilled = false; }
     void clearTimingFunction() { m_timingFunctionSet = false; m_timingFunctionFilled = false; }
-    void clearCompositeOperation() { m_compositeOperationSet = false; }
+    void clearCompositeOperation() { m_compositeOperationSet = false; m_compositeOperationFilled = false; }
 
     void clearAll()
     {
@@ -167,6 +167,7 @@
     void fillPlayState(AnimationPlayState playState) { setPlayState(playState); m_playStateFilled = true; }
     void fillProperty(TransitionProperty property) { setProperty(property); m_propertyFilled = true; }
     void fillTimingFunction(RefPtr<TimingFunction>&& timingFunction) { setTimingFunction(WTFMove(timingFunction)); m_timingFunctionFilled = true; }
+    void fillCompositeOperation(CompositeOperation compositeOperation) { setCompositeOperation(compositeOperation); m_compositeOperationFilled = true; }
 
     bool isDelayFilled() const { return m_delayFilled; }
     bool isDirectionFilled() const { return m_directionFilled; }
@@ -176,6 +177,7 @@
     bool isPlayStateFilled() const { return m_playStateFilled; }
     bool isPropertyFilled() const { return m_propertyFilled; }
     bool isTimingFunctionFilled() const { return m_timingFunctionFilled; }
+    bool isCompositeOperationFilled() const { return m_compositeOperationFilled; }
 
     // return true if all members of this class match (excluding m_next)
     bool animationsMatch(const Animation&, bool matchProperties = true) const;
@@ -234,6 +236,7 @@
     bool m_playStateFilled : 1;
     bool m_propertyFilled : 1;
     bool m_timingFunctionFilled : 1;
+    bool m_compositeOperationFilled : 1;
 
 public:
     static double initialDelay() { return 0; }

Modified: trunk/Source/WebCore/platform/animation/AnimationList.cpp (288432 => 288433)


--- trunk/Source/WebCore/platform/animation/AnimationList.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/platform/animation/AnimationList.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -58,6 +58,7 @@
     FILL_UNSET_PROPERTY(isPlayStateSet, playState, fillPlayState);
     FILL_UNSET_PROPERTY(isTimingFunctionSet, timingFunction, fillTimingFunction);
     FILL_UNSET_PROPERTY(isPropertySet, property, fillProperty);
+    FILL_UNSET_PROPERTY(isCompositeOperationSet, compositeOperation, fillCompositeOperation);
 }
 
 bool AnimationList::operator==(const AnimationList& other) const

Modified: trunk/Source/WebCore/style/PropertyAllowlist.cpp (288432 => 288433)


--- trunk/Source/WebCore/style/PropertyAllowlist.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/style/PropertyAllowlist.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -88,6 +88,7 @@
     case CSSPropertyAnimationDirection:
     case CSSPropertyAnimationFillMode:
     case CSSPropertyAnimationPlayState:
+    case CSSPropertyAnimationComposition:
     case CSSPropertyAnimationName:
     case CSSPropertyTransitionDuration:
     case CSSPropertyTransitionTimingFunction:

Modified: trunk/Source/WebCore/style/StyleResolver.cpp (288432 => 288433)


--- trunk/Source/WebCore/style/StyleResolver.cpp	2022-01-24 08:58:48 UTC (rev 288432)
+++ trunk/Source/WebCore/style/StyleResolver.cpp	2022-01-24 10:59:39 UTC (rev 288433)
@@ -40,6 +40,7 @@
 #include "CSSStyleRule.h"
 #include "CSSStyleSheet.h"
 #include "CachedResourceLoader.h"
+#include "CompositeOperation.h"
 #include "ElementRuleCollector.h"
 #include "Frame.h"
 #include "FrameSelection.h"
@@ -293,9 +294,10 @@
     unsigned propertyCount = keyframe->properties().propertyCount();
     for (unsigned i = 0; i < propertyCount; ++i) {
         CSSPropertyID property = keyframe->properties().propertyAt(i).id();
-        // Timing-function within keyframes is special, because it is not animated; it just
-        // describes the timing function between this keyframe and the next.
-        if (property != CSSPropertyAnimationTimingFunction)
+        // The animation-composition and animation-timing-function within keyframes are special
+        // because they are not animated; they just describe the composite operation and timing
+        // function between this keyframe and the next.
+        if (property != CSSPropertyAnimationTimingFunction && property != CSSPropertyAnimationComposition)
             keyframeValue.addProperty(property);
     }
 
@@ -396,6 +398,10 @@
             keyframeValue.setKey(key);
             if (auto timingFunctionCSSValue = keyframeRule->properties().getPropertyCSSValue(CSSPropertyAnimationTimingFunction))
                 keyframeValue.setTimingFunction(TimingFunction::createFromCSSValue(*timingFunctionCSSValue.get()));
+            if (auto compositeOperationCSSValue = keyframeRule->properties().getPropertyCSSValue(CSSPropertyAnimationComposition)) {
+                if (auto compositeOperation = toCompositeOperation(*compositeOperationCSSValue))
+                    keyframeValue.setCompositeOperation(*compositeOperation);
+            }
             list.insert(WTFMove(keyframeValue));
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to