Changeset 288433 in webkit
- Timestamp:
- Jan 24, 2022 2:59:39 AM (6 months ago)
- Location:
- trunk
- Files:
-
- 37 edited
- 1 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/animations/fill-unset-properties-expected.txt (modified) (1 diff)
-
LayoutTests/animations/fill-unset-properties.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (modified) (1 diff)
-
LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (modified) (1 diff)
-
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (modified) (1 diff)
-
LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (modified) (1 diff)
-
LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
Source/WebCore/animation/CSSAnimation.cpp (modified) (4 diffs)
-
Source/WebCore/animation/CSSAnimation.h (modified) (2 diffs)
-
Source/WebCore/animation/CompositeOperation.cpp (copied) (copied from trunk/Source/WebCore/animation/CompositeOperationOrAuto.h) (2 diffs)
-
Source/WebCore/animation/CompositeOperation.h (modified) (1 diff)
-
Source/WebCore/animation/CompositeOperationOrAuto.h (modified) (1 diff)
-
Source/WebCore/animation/KeyframeEffect.cpp (modified) (4 diffs)
-
Source/WebCore/animation/KeyframeEffect.h (modified) (2 diffs)
-
Source/WebCore/animation/KeyframeEffect.idl (modified) (1 diff)
-
Source/WebCore/css/CSSComputedStyleDeclaration.cpp (modified) (3 diffs)
-
Source/WebCore/css/CSSProperties.json (modified) (1 diff)
-
Source/WebCore/css/CSSToStyleMap.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSToStyleMap.h (modified) (1 diff)
-
Source/WebCore/css/CSSValueKeywords.in (modified) (1 diff)
-
Source/WebCore/css/parser/CSSPropertyParser.cpp (modified) (2 diffs)
-
Source/WebCore/platform/animation/Animation.cpp (modified) (2 diffs)
-
Source/WebCore/platform/animation/Animation.h (modified) (4 diffs)
-
Source/WebCore/platform/animation/AnimationList.cpp (modified) (1 diff)
-
Source/WebCore/style/PropertyAllowlist.cpp (modified) (1 diff)
-
Source/WebCore/style/StyleResolver.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r288429 r288433 1 2022-01-24 Antoine Quint <graouts@webkit.org> 2 3 [Web Animations] add support for animation-composition CSS property 4 https://bugs.webkit.org/show_bug.cgi?id=232086 5 <rdar://problem/84508394> 6 7 Reviewed by Darin Adler. 8 9 Update existing tests to account for the new "animation-composition" CSS property. 10 11 * animations/fill-unset-properties-expected.txt: 12 * animations/fill-unset-properties.html: 13 * platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: 14 * platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: 15 * platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: 16 * platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: 17 1 18 2022-01-23 Matt Woodrow <mattwoodrow@apple.com> 2 19 -
trunk/LayoutTests/animations/fill-unset-properties-expected.txt
r287678 r288433 11 11 Testing animationIterationCount: PASS 12 12 Testing animationTimingFunction: PASS 13 Testing animationComposition: PASS 13 14 -
trunk/LayoutTests/animations/fill-unset-properties.html
r287678 r288433 21 21 animation-iteration-count: 1, 2, 3; 22 22 animation-timing-function: linear; 23 animation-composition: add, replace, accumulate; 23 24 } 24 25 @keyframes a { } … … 44 45 { 'property': 'animationPlayState', 'value': 'running, paused, running' }, 45 46 { 'property': 'animationIterationCount', 'value': '1, 2, 3' }, 46 { 'property': 'animationTimingFunction', 'value': 'linear' } 47 { 'property': 'animationTimingFunction', 'value': 'linear' }, 48 { 'property': 'animationComposition', 'value': 'add, replace, accumulate' } 47 49 ]; 48 50 -
trunk/LayoutTests/imported/w3c/ChangeLog
r288427 r288433 1 2022-01-24 Antoine Quint <graouts@webkit.org> 2 3 [Web Animations] add support for animation-composition CSS property 4 https://bugs.webkit.org/show_bug.cgi?id=232086 5 <rdar://problem/84508394> 6 7 Reviewed by Darin Adler. 8 9 Mark WPT progressions and import one ::marker WPT test that wasn't imported originally with bug 235443. 10 11 * web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt: 12 * web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt: 13 * web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt: 14 * web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt: 15 * web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: 16 * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt: 17 * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html: 18 * web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: 19 1 20 2022-01-23 Sam Weinig <weinig@apple.com> 2 21 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt
r288402 r288433 6 6 PASS CSS animation events are dispatched at the original element even after setting an effect with a different target element 7 7 PASS After replacing a finished animation's effect with a longer one it fires an animationstart event 8 FAIL Setting animation-composition sets the composite property on the effect assert_equals: expected "add" but got "replace" 8 PASS Setting animation-composition sets the composite property on the effect 9 9 PASS Replacing the effect of a CSSAnimation causes subsequent changes to corresponding animation-* properties to be ignored 10 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative-expected.txt
r288402 r288433 6 6 PASS KeyframeEffect.getKeyframes() returns frames with expected easing values, when the easing is specified on some keyframes 7 7 PASS KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is set on the effect using animation-composition on the element 8 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" 9 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" 8 PASS KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is specified on each keyframe 9 PASS KeyframeEffect.getKeyframes() returns frames with expected composite values, when the composite is specified on some keyframes 10 10 PASS KeyframeEffect.getKeyframes() returns expected frames for a simple animation that specifies a single shorthand property 11 11 PASS KeyframeEffect.getKeyframes() returns expected frames for an animation with a 0% keyframe and no 100% keyframe -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-computed.tentative-expected.txt
r288402 r288433 1 1 2 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 2 PASS Property animation-composition value 'replace, add, accumulate' 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/parsing/animation-composition-valid.tentative-expected.txt
r288402 r288433 1 1 2 FAIL e.style['animation-composition'] = "replace" should set the property value assert_not_equals: property should be set got disallowed value "" 3 FAIL e.style['animation-composition'] = "add" should set the property value assert_not_equals: property should be set got disallowed value "" 4 FAIL e.style['animation-composition'] = "accumulate" should set the property value assert_not_equals: property should be set got disallowed value "" 5 FAIL e.style['animation-composition'] = "replace, add, accumulate" should set the property value assert_not_equals: property should be set got disallowed value "" 2 PASS e.style['animation-composition'] = "replace" should set the property value 3 PASS e.style['animation-composition'] = "add" should set the property value 4 PASS e.style['animation-composition'] = "accumulate" should set the property value 5 PASS e.style['animation-composition'] = "replace, add, accumulate" should set the property value 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt
r287712 r288433 10 10 PASS all 11 11 PASS alt 12 PASS animation-composition 12 13 PASS animation-delay 13 14 PASS animation-direction -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt
r288009 r288433 35 35 PASS Property animation-play-state value 'paused' in ::marker 36 36 PASS Property animation-timing-function value 'linear' in ::marker 37 PASS Property animation-composition value 'add' in ::marker 37 38 PASS Property transition value 'display 1s linear 2s' in ::marker 38 39 PASS Property transition-delay value '1s' in ::marker -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties.html
r288009 r288433 62 62 test_pseudo_computed_value("::marker", "animation-play-state", "paused"); 63 63 test_pseudo_computed_value("::marker", "animation-timing-function", "linear"); 64 test_pseudo_computed_value("::marker", "animation-composition", "add"); 64 65 65 66 // ::marker supports transition properties. -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt
r287487 r288433 1 1 2 2 PASS getComputedStyle returns no style for detached element 3 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 39 54 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 39 55 FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 39 56 FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 39 53 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 396 4 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 396 5 FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 396 6 FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 396 7 7 PASS getComputedStyle returns no style for shadow tree outside of flattened tree 8 8 -
trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt
r287958 r288433 10 10 PASS all 11 11 PASS alt 12 PASS animation-composition 12 13 PASS animation-delay 13 14 PASS animation-direction -
trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt
r287487 r288433 1 1 2 2 PASS getComputedStyle returns no style for detached element 3 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 39 24 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 39 25 FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 39 26 FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 39 23 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 393 4 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 393 5 FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 393 6 FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 393 7 7 PASS getComputedStyle returns no style for shadow tree outside of flattened tree 8 8 -
trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt
r287712 r288433 9 9 PASS all 10 10 PASS alt 11 PASS animation-composition 11 12 PASS animation-delay 12 13 PASS animation-direction -
trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt
r287487 r288433 1 1 2 2 PASS getComputedStyle returns no style for detached element 3 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 39 74 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 39 75 FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 39 76 FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 39 73 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 398 4 FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 398 5 FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 398 6 FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 398 7 7 PASS getComputedStyle returns no style for shadow tree outside of flattened tree 8 8 -
trunk/Source/WebCore/ChangeLog
r288432 r288433 1 2022-01-24 Antoine Quint <graouts@webkit.org> 2 3 [Web Animations] add support for animation-composition CSS property 4 https://bugs.webkit.org/show_bug.cgi?id=232086 5 <rdar://problem/84508394> 6 7 Reviewed by Darin Adler. 8 9 Add support for the "animation-composition" property from the CSS Animations Level 2 specification. 10 This property sets the "composite" property on the animation's effect and is overridden by use of 11 the Web Animations API to set that property. 12 13 * Sources.txt: 14 * WebCore.xcodeproj/project.pbxproj: 15 * animation/CSSAnimation.cpp: 16 (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): 17 (WebCore::CSSAnimation::setBindingsEffect): 18 (WebCore::CSSAnimation::effectCompositeOperationWasSetUsingBindings): 19 * animation/CSSAnimation.h: 20 * animation/CompositeOperation.cpp: Added. 21 (WebCore::toCompositeOperation): 22 * animation/CompositeOperation.h: 23 * animation/CompositeOperationOrAuto.h: 24 (WebCore::toCompositeOperationOrAuto): 25 * animation/KeyframeEffect.cpp: 26 (WebCore::KeyframeEffect::getBindingsKeyframes): 27 (WebCore::KeyframeEffect::getKeyframes): 28 (WebCore::KeyframeEffect::bindingsComposite const): 29 (WebCore::KeyframeEffect::setBindingsComposite): 30 * animation/KeyframeEffect.h: 31 * animation/KeyframeEffect.idl: 32 * css/CSSComputedStyleDeclaration.cpp: 33 (WebCore::valueForAnimationComposition): 34 (WebCore::ComputedStyleExtractor::addValueForAnimationPropertyToList): 35 (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): 36 * css/CSSProperties.json: 37 * css/CSSToStyleMap.cpp: 38 (WebCore::CSSToStyleMap::mapAnimationCompositeOperation): 39 * css/CSSToStyleMap.h: 40 * css/CSSValueKeywords.in: 41 * css/parser/CSSPropertyParser.cpp: 42 (WebCore::consumeAnimationValue): 43 (WebCore::CSSPropertyParser::parseSingleValue): 44 * platform/animation/Animation.cpp: 45 (WebCore::Animation::Animation): 46 * platform/animation/Animation.h: 47 (WebCore::Animation::clearCompositeOperation): 48 (WebCore::Animation::fillCompositeOperation): 49 (WebCore::Animation::isCompositeOperationFilled const): 50 * platform/animation/AnimationList.cpp: 51 (WebCore::AnimationList::fillUnsetProperties): 52 * style/PropertyAllowlist.cpp: 53 (WebCore::Style::isValidMarkerStyleProperty): 54 * style/StyleResolver.cpp: 55 (WebCore::Style::Resolver::styleForKeyframe): 56 (WebCore::Style::Resolver::keyframeStylesForAnimation): 57 1 58 2022-01-24 Said Abou-Hallawa <said@apple.com> 2 59 -
trunk/Source/WebCore/Sources.txt
r288432 r288433 476 476 animation/CSSPropertyAnimation.cpp 477 477 animation/CSSTransition.cpp 478 animation/CompositeOperation.cpp 478 479 animation/CustomEffect.cpp 479 480 animation/DeclarativeAnimation.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r288432 r288433 11182 11182 718C7F561DD385C500B733C8 /* status-label.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "status-label.css"; sourceTree = "<group>"; }; 11183 11183 718C7F571DD385C500B733C8 /* status-label.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "status-label.js"; sourceTree = "<group>"; }; 11184 718F2486279DE9EF00C3204D /* CompositeOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompositeOperation.cpp; sourceTree = "<group>"; }; 11184 11185 7199B94A2551F0E100494A57 /* StyleContentAlignmentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleContentAlignmentData.cpp; sourceTree = "<group>"; }; 11185 11186 7199B94F2552103E00494A57 /* StyleSelfAlignmentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSelfAlignmentData.cpp; sourceTree = "<group>"; }; … … 24442 24443 71025EC91F99F096004A250C /* AnimationTimeline.idl */, 24443 24444 7156BC9F21CA350600534397 /* BasicEffectTiming.h */, 24445 718F2486279DE9EF00C3204D /* CompositeOperation.cpp */, 24444 24446 71247E351FEA5F81008C08CE /* CompositeOperation.h */, 24445 24447 71247E361FEA5F81008C08CE /* CompositeOperation.idl */, -
trunk/Source/WebCore/animation/CSSAnimation.cpp
r287877 r288433 28 28 29 29 #include "Animation.h" 30 #include "AnimationEffect.h" 30 31 #include "AnimationEvent.h" 31 32 #include "InspectorInstrumentation.h" … … 110 111 if (!m_overriddenProperties.contains(Property::Duration)) 111 112 animationEffect->setIterationDuration(Seconds(animation.duration())); 113 114 if (!m_overriddenProperties.contains(Property::CompositeOperation)) { 115 if (is<KeyframeEffect>(animationEffect)) 116 downcast<KeyframeEffect>(*animationEffect).setComposite(animation.compositeOperation()); 117 } 112 118 113 119 animationEffect->updateStaticTimingProperties(); … … 169 175 m_overriddenProperties.add(Property::Delay); 170 176 m_overriddenProperties.add(Property::FillMode); 177 m_overriddenProperties.add(Property::CompositeOperation); 171 178 } 172 179 } … … 243 250 } 244 251 252 void CSSAnimation::effectCompositeOperationWasSetUsingBindings() 253 { 254 m_overriddenProperties.add(Property::CompositeOperation); 255 } 256 245 257 void CSSAnimation::keyframesRuleDidChange() 246 258 { -
trunk/Source/WebCore/animation/CSSAnimation.h
r287707 r288433 47 47 void effectTimingWasUpdatedUsingBindings(OptionalEffectTiming); 48 48 void effectKeyframesWereSetUsingBindings(); 49 void effectCompositeOperationWasSetUsingBindings(); 49 50 void keyframesRuleDidChange(); 50 51 void updateKeyframesIfNeeded(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&); … … 71 72 Delay = 1 << 6, 72 73 FillMode = 1 << 7, 73 Keyframes = 1 << 8 74 Keyframes = 1 << 8, 75 CompositeOperation = 1 << 9 74 76 }; 75 77 -
trunk/Source/WebCore/animation/CompositeOperation.cpp
r288432 r288433 1 1 /* 2 * Copyright (C) 20 18Apple Inc. All rights reserved.2 * Copyright (C) 2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "CompositeOperation.h" 28 29 #include "CSSPrimitiveValue.h" 30 #include "CSSValue.h" 31 #include "CSSValueKeywords.h" 27 32 28 33 namespace WebCore { 29 34 30 enum class CompositeOperationOrAuto : uint8_t { Replace, Add, Accumulate, Auto }; 35 std::optional<CompositeOperation> toCompositeOperation(const CSSValue& value) 36 { 37 if (!is<CSSPrimitiveValue>(value)) 38 return std::nullopt; 39 40 switch (downcast<CSSPrimitiveValue>(value).valueID()) { 41 case CSSValueAdd: 42 return CompositeOperation::Add; 43 case CSSValueAccumulate: 44 return CompositeOperation::Accumulate; 45 case CSSValueReplace: 46 return CompositeOperation::Replace; 47 default: 48 return std::nullopt; 49 } 50 } 31 51 32 52 } // namespace WebCore -
trunk/Source/WebCore/animation/CompositeOperation.h
r239820 r288433 26 26 #pragma once 27 27 28 #include <optional> 29 28 30 namespace WebCore { 31 32 class CSSValue; 29 33 30 34 enum class CompositeOperation : uint8_t { Replace, Add, Accumulate }; 31 35 36 std::optional<CompositeOperation> toCompositeOperation(const CSSValue&); 37 32 38 } // namespace WebCore -
trunk/Source/WebCore/animation/CompositeOperationOrAuto.h
r239820 r288433 26 26 #pragma once 27 27 28 #include "CompositeOperation.h" 29 28 30 namespace WebCore { 29 31 30 32 enum class CompositeOperationOrAuto : uint8_t { Replace, Add, Accumulate, Auto }; 31 33 34 constexpr CompositeOperationOrAuto toCompositeOperationOrAuto(CompositeOperation operation) 35 { 36 switch (operation) { 37 case CompositeOperation::Replace: 38 return CompositeOperationOrAuto::Replace; 39 case CompositeOperation::Add: 40 return CompositeOperationOrAuto::Add; 41 case CompositeOperation::Accumulate: 42 return CompositeOperationOrAuto::Accumulate; 43 } 44 } 45 32 46 } // namespace WebCore -
trunk/Source/WebCore/animation/KeyframeEffect.cpp
r288423 r288433 597 597 } 598 598 599 Vector<Strong<JSObject>> KeyframeEffect::getBindingsKeyframes(JSGlobalObject& lexicalGlobalObject )599 Vector<Strong<JSObject>> KeyframeEffect::getBindingsKeyframes(JSGlobalObject& lexicalGlobalObject, Document& document) 600 600 { 601 601 if (is<DeclarativeAnimation>(animation())) 602 602 downcast<DeclarativeAnimation>(*animation()).flushPendingStyleChanges(); 603 return getKeyframes(lexicalGlobalObject );604 } 605 606 Vector<Strong<JSObject>> KeyframeEffect::getKeyframes(JSGlobalObject& lexicalGlobalObject )603 return getKeyframes(lexicalGlobalObject, document); 604 } 605 606 Vector<Strong<JSObject>> KeyframeEffect::getKeyframes(JSGlobalObject& lexicalGlobalObject, Document& document) 607 607 { 608 608 // https://drafts.csswg.org/web-animations-1/#dom-keyframeeffectreadonly-getkeyframes 609 610 auto supportsCompositeOperation = document.settings().webAnimationsCompositeOperationsEnabled(); 609 611 610 612 auto lock = JSLockHolder { &lexicalGlobalObject }; … … 700 702 // For CSS transitions, all keyframes should return "linear" since the effect's global timing function applies. 701 703 computedKeyframe.easing = is<CSSTransition>(animation()) ? "linear" : timingFunctionForBlendingKeyframe(keyframe)->cssText(); 704 705 if (supportsCompositeOperation) { 706 if (auto compositeOperation = keyframe.compositeOperation()) 707 computedKeyframe.composite = toCompositeOperationOrAuto(*compositeOperation); 708 } 702 709 703 710 auto outputKeyframe = convertDictionaryToJS(lexicalGlobalObject, *jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject), computedKeyframe); … … 774 781 computedKeyframe.easing = timingFunctionForKeyframeAtIndex(i)->cssText(); 775 782 776 auto* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject)->scriptExecutionContext(); 777 if (is<Document>(scriptExecutionContext)) { 778 if (downcast<Document>(*scriptExecutionContext).settings().webAnimationsCompositeOperationsEnabled()) 779 computedKeyframe.composite = parsedKeyframe.composite; 780 } 783 if (supportsCompositeOperation) 784 computedKeyframe.composite = parsedKeyframe.composite; 781 785 782 786 auto outputKeyframe = convertDictionaryToJS(lexicalGlobalObject, *jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject), computedKeyframe); … … 2222 2226 } 2223 2227 2228 CompositeOperation KeyframeEffect::bindingsComposite() const 2229 { 2230 if (is<DeclarativeAnimation>(animation())) 2231 downcast<DeclarativeAnimation>(*animation()).flushPendingStyleChanges(); 2232 return composite(); 2233 } 2234 2235 void KeyframeEffect::setBindingsComposite(CompositeOperation compositeOperation) 2236 { 2237 setComposite(compositeOperation); 2238 if (is<CSSAnimation>(animation())) 2239 downcast<CSSAnimation>(*animation()).effectCompositeOperationWasSetUsingBindings(); 2240 } 2241 2224 2242 } // namespace WebCore -
trunk/Source/WebCore/animation/KeyframeEffect.h
r287707 r288433 115 115 const std::optional<const Styleable> targetStyleable() const; 116 116 117 Vector<JSC::Strong<JSC::JSObject>> getBindingsKeyframes(JSC::JSGlobalObject& );118 Vector<JSC::Strong<JSC::JSObject>> getKeyframes(JSC::JSGlobalObject& );117 Vector<JSC::Strong<JSC::JSObject>> getBindingsKeyframes(JSC::JSGlobalObject&, Document&); 118 Vector<JSC::Strong<JSC::JSObject>> getKeyframes(JSC::JSGlobalObject&, Document&); 119 119 ExceptionOr<void> setBindingsKeyframes(JSC::JSGlobalObject&, JSC::Strong<JSC::JSObject>&&); 120 120 ExceptionOr<void> setKeyframes(JSC::JSGlobalObject&, JSC::Strong<JSC::JSObject>&&); … … 124 124 CompositeOperation composite() const { return m_compositeOperation; } 125 125 void setComposite(CompositeOperation compositeOperation) { m_compositeOperation = compositeOperation; } 126 CompositeOperation bindingsComposite() const; 127 void setBindingsComposite(CompositeOperation); 126 128 127 129 void getAnimatedStyle(std::unique_ptr<RenderStyle>& animatedStyle); -
trunk/Source/WebCore/animation/KeyframeEffect.idl
r283463 r288433 36 36 attribute CSSOMString? pseudoElement; 37 37 [EnabledBySetting=WebAnimationsCompositeOperationsEnabled] attribute IterationCompositeOperation iterationComposite; 38 [EnabledBySetting=WebAnimationsCompositeOperationsEnabled ] attribute CompositeOperation composite;39 [CallWith=GlobalObject , ImplementedAs=getBindingsKeyframes] sequence<object> getKeyframes();38 [EnabledBySetting=WebAnimationsCompositeOperationsEnabled, ImplementedAs=bindingsComposite] attribute CompositeOperation composite; 39 [CallWith=GlobalObject&Document, ImplementedAs=getBindingsKeyframes] sequence<object> getKeyframes(); 40 40 [CallWith=GlobalObject, ImplementedAs=setBindingsKeyframes] undefined setKeyframes(object? keyframes); 41 41 }; -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r288200 r288433 1379 1379 } 1380 1380 1381 static Ref<CSSPrimitiveValue> valueForAnimationComposition(CompositeOperation operation) 1382 { 1383 switch (operation) { 1384 case CompositeOperation::Add: 1385 return CSSValuePool::singleton().createIdentifierValue(CSSValueAdd); 1386 case CompositeOperation::Accumulate: 1387 return CSSValuePool::singleton().createIdentifierValue(CSSValueAccumulate); 1388 case CompositeOperation::Replace: 1389 return CSSValuePool::singleton().createIdentifierValue(CSSValueReplace); 1390 } 1391 } 1392 1381 1393 static Ref<CSSPrimitiveValue> valueForAnimationPlayState(AnimationPlayState playState) 1382 1394 { … … 1459 1471 } else if (property == CSSPropertyAnimationName) 1460 1472 list.append(valueForAnimationName(animation ? animation->name() : Animation::initialName())); 1461 else if (property == CSSPropertyTransitionProperty) { 1473 else if (property == CSSPropertyAnimationComposition) { 1474 if (!animation || !animation->isCompositeOperationFilled()) 1475 list.append(valueForAnimationComposition(animation ? animation->compositeOperation() : Animation::initialCompositeOperation())); 1476 } else if (property == CSSPropertyTransitionProperty) { 1462 1477 if (animation) { 1463 1478 if (!animation->isPropertyFilled()) … … 3556 3571 case CSSPropertyAnimation: 3557 3572 return animationShorthandValue(propertyID, style.animations()); 3573 case CSSPropertyAnimationComposition: 3558 3574 case CSSPropertyAnimationDelay: 3559 3575 case CSSPropertyAnimationDirection: -
trunk/Source/WebCore/css/CSSProperties.json
r287712 r288433 917 917 } 918 918 }, 919 "animation-composition": { 920 "values": [ 921 "add", 922 "accumulate", 923 "replace" 924 ], 925 "animatable": true, 926 "codegen-properties": { 927 "name-for-methods": "CompositeOperation", 928 "settings-flag": "webAnimationsCompositeOperationsEnabled" 929 }, 930 "specification": { 931 "category": "css-animations", 932 "url": "https://drafts.csswg.org/css-animations-2/#animation-composition" 933 }, 934 "status": { 935 "status": "experimental" 936 } 937 }, 919 938 "animation-delay": { 920 939 "animatable": true, -
trunk/Source/WebCore/css/CSSToStyleMap.cpp
r286795 r288433 38 38 #include "CSSTimingFunctionValue.h" 39 39 #include "CSSValueKeywords.h" 40 #include "CompositeOperation.h" 40 41 #include "FillLayer.h" 41 42 #include "Pair.h" … … 461 462 else if (auto timingFunction = TimingFunction::createFromCSSValue(value)) 462 463 animation.setTimingFunction(WTFMove(timingFunction)); 464 } 465 466 void CSSToStyleMap::mapAnimationCompositeOperation(Animation& animation, const CSSValue& value) 467 { 468 if (value.treatAsInitialValue(CSSPropertyAnimationComposition)) 469 animation.setCompositeOperation(Animation::initialCompositeOperation()); 470 else if (auto compositeOperation = toCompositeOperation(value)) 471 animation.setCompositeOperation(*compositeOperation); 463 472 } 464 473 -
trunk/Source/WebCore/css/CSSToStyleMap.h
r282143 r288433 69 69 void mapAnimationProperty(Animation&, const CSSValue&); 70 70 void mapAnimationTimingFunction(Animation&, const CSSValue&); 71 void mapAnimationCompositeOperation(Animation&, const CSSValue&); 71 72 72 73 void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&); -
trunk/Source/WebCore/css/CSSValueKeywords.in
r287663 r288433 1034 1034 1035 1035 // 1036 // animation-composition 1037 // 1038 // add 1039 accumulate 1040 replace 1041 1042 // 1036 1043 // CSS_PROP_ZOOM 1037 1044 // -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r288184 r288433 1574 1574 case CSSPropertyAnimationPlayState: 1575 1575 return consumeIdent<CSSValueRunning, CSSValuePaused>(range); 1576 case CSSPropertyAnimationComposition: 1577 return consumeIdent<CSSValueAccumulate, CSSValueAdd, CSSValueReplace>(range); 1576 1578 case CSSPropertyTransitionProperty: 1577 1579 return consumeTransitionProperty(range); … … 4335 4337 case CSSPropertyAnimationName: 4336 4338 case CSSPropertyAnimationPlayState: 4339 case CSSPropertyAnimationComposition: 4337 4340 case CSSPropertyTransitionProperty: 4338 4341 case CSSPropertyAnimationTimingFunction: -
trunk/Source/WebCore/platform/animation/Animation.cpp
r287708 r288433 57 57 , m_propertyFilled(false) 58 58 , m_timingFunctionFilled(false) 59 , m_compositeOperationFilled(false) 59 60 { 60 61 } … … 92 93 , m_propertyFilled(o.m_propertyFilled) 93 94 , m_timingFunctionFilled(o.m_timingFunctionFilled) 95 , m_compositeOperationFilled(o.m_compositeOperationFilled) 94 96 { 95 97 } -
trunk/Source/WebCore/platform/animation/Animation.h
r288085 r288433 80 80 void clearProperty() { m_propertySet = false; m_propertyFilled = false; } 81 81 void clearTimingFunction() { m_timingFunctionSet = false; m_timingFunctionFilled = false; } 82 void clearCompositeOperation() { m_compositeOperationSet = false; }82 void clearCompositeOperation() { m_compositeOperationSet = false; m_compositeOperationFilled = false; } 83 83 84 84 void clearAll() … … 168 168 void fillProperty(TransitionProperty property) { setProperty(property); m_propertyFilled = true; } 169 169 void fillTimingFunction(RefPtr<TimingFunction>&& timingFunction) { setTimingFunction(WTFMove(timingFunction)); m_timingFunctionFilled = true; } 170 void fillCompositeOperation(CompositeOperation compositeOperation) { setCompositeOperation(compositeOperation); m_compositeOperationFilled = true; } 170 171 171 172 bool isDelayFilled() const { return m_delayFilled; } … … 177 178 bool isPropertyFilled() const { return m_propertyFilled; } 178 179 bool isTimingFunctionFilled() const { return m_timingFunctionFilled; } 180 bool isCompositeOperationFilled() const { return m_compositeOperationFilled; } 179 181 180 182 // return true if all members of this class match (excluding m_next) … … 235 237 bool m_propertyFilled : 1; 236 238 bool m_timingFunctionFilled : 1; 239 bool m_compositeOperationFilled : 1; 237 240 238 241 public: -
trunk/Source/WebCore/platform/animation/AnimationList.cpp
r287678 r288433 59 59 FILL_UNSET_PROPERTY(isTimingFunctionSet, timingFunction, fillTimingFunction); 60 60 FILL_UNSET_PROPERTY(isPropertySet, property, fillProperty); 61 FILL_UNSET_PROPERTY(isCompositeOperationSet, compositeOperation, fillCompositeOperation); 61 62 } 62 63 -
trunk/Source/WebCore/style/PropertyAllowlist.cpp
r287487 r288433 89 89 case CSSPropertyAnimationFillMode: 90 90 case CSSPropertyAnimationPlayState: 91 case CSSPropertyAnimationComposition: 91 92 case CSSPropertyAnimationName: 92 93 case CSSPropertyTransitionDuration: -
trunk/Source/WebCore/style/StyleResolver.cpp
r287828 r288433 41 41 #include "CSSStyleSheet.h" 42 42 #include "CachedResourceLoader.h" 43 #include "CompositeOperation.h" 43 44 #include "ElementRuleCollector.h" 44 45 #include "Frame.h" … … 294 295 for (unsigned i = 0; i < propertyCount; ++i) { 295 296 CSSPropertyID property = keyframe->properties().propertyAt(i).id(); 296 // Timing-function within keyframes is special, because it is not animated; it just 297 // describes the timing function between this keyframe and the next. 298 if (property != CSSPropertyAnimationTimingFunction) 297 // The animation-composition and animation-timing-function within keyframes are special 298 // because they are not animated; they just describe the composite operation and timing 299 // function between this keyframe and the next. 300 if (property != CSSPropertyAnimationTimingFunction && property != CSSPropertyAnimationComposition) 299 301 keyframeValue.addProperty(property); 300 302 } … … 397 399 if (auto timingFunctionCSSValue = keyframeRule->properties().getPropertyCSSValue(CSSPropertyAnimationTimingFunction)) 398 400 keyframeValue.setTimingFunction(TimingFunction::createFromCSSValue(*timingFunctionCSSValue.get())); 401 if (auto compositeOperationCSSValue = keyframeRule->properties().getPropertyCSSValue(CSSPropertyAnimationComposition)) { 402 if (auto compositeOperation = toCompositeOperation(*compositeOperationCSSValue)) 403 keyframeValue.setCompositeOperation(*compositeOperation); 404 } 399 405 list.insert(WTFMove(keyframeValue)); 400 406 }
Note: See TracChangeset
for help on using the changeset viewer.