Changeset 268615 in webkit
- Timestamp:
- Oct 16, 2020 3:43:54 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r268614 r268615 1 2020-10-16 Antoine Quint <graouts@webkit.org> 2 3 Support accelerated animation of individual transform CSS properties 4 https://bugs.webkit.org/show_bug.cgi?id=217842 5 <rdar://problem/70391914> 6 7 Reviewed by Dean Jackson. 8 9 Add some new tests that check animations of individual CSS transform properties can be performed, 10 checking on their relative order with the transform property, updating the transform property while 11 an animation is in flight and adding animations while in flight. 12 13 * TestExpectations: 14 * webanimations/accelerated-transform-related-animation-property-order-expected.html: Added. 15 * webanimations/accelerated-transform-related-animation-property-order.html: Added. 16 * webanimations/accelerated-translate-animation-additional-animation-added-in-flight-expected.html: Added. 17 * webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html: Added. 18 * webanimations/accelerated-translate-animation-expected.html: Added. 19 * webanimations/accelerated-translate-animation-underlying-transform-changed-in-flight-expected.html: Added. 20 * webanimations/accelerated-translate-animation-underlying-transform-changed-in-flight.html: Added. 21 * webanimations/accelerated-translate-animation-with-transform-expected.html: Added. 22 * webanimations/accelerated-translate-animation-with-transform.html: Added. 23 * webanimations/accelerated-translate-animation.html: Added. 24 1 25 2020-10-16 Karl Rackler <rackler@apple.com> 2 26 -
trunk/LayoutTests/TestExpectations
r268488 r268615 4520 4520 webkit.org/b/217054 fast/layoutformattingcontext/horizontal-sizing-with-trailing-letter-spacing.html [ Skip ] 4521 4521 4522 webkit.org/b/217851 transitions/interrupted-transition-hardware.html [ Pass Failure ] 4523 webkit.org/b/217851 webanimations/accelerated-transform-related-animation-property-order.html [ Pass Failure ] 4524 webkit.org/b/217851 webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html [ Pass Failure ] 4525 webkit.org/b/217851 webanimations/accelerated-translate-animation-underlying-transform-changed-in-flight.html [ Pass Failure ] 4526 webkit.org/b/217851 webanimations/accelerated-translate-animation-with-transform.html [ Pass Failure ] 4527 webkit.org/b/217851 webanimations/accelerated-translate-animation.html [ Pass Failure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r268564 r268615 1 2020-10-16 Antoine Quint <graouts@webkit.org> 2 3 Support accelerated animation of individual transform CSS properties 4 https://bugs.webkit.org/show_bug.cgi?id=217842 5 <rdar://problem/70391914> 6 7 Reviewed by Dean Jackson. 8 9 * web-platform-tests/css/css-transforms/animation/rotate-interpolation-expected.txt: 10 * web-platform-tests/css/css-transforms/animation/scale-interpolation-expected.txt: 11 * web-platform-tests/css/css-transforms/animation/translate-interpolation-expected.txt: 12 1 13 2020-10-15 Sam Weinig <weinig@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/rotate-interpolation-expected.txt
r268173 r268615 138 138 PASS CSS Animations: property <rotate> from neutral to [30deg] at (1) should be [30deg] 139 139 PASS CSS Animations: property <rotate> from neutral to [30deg] at (2) should be [50deg] 140 PASS Web Animations: property <rotate> from neutral to [30deg] at (-1) should be [-10deg] 140 FAIL Web Animations: property <rotate> from neutral to [30deg] at (-1) should be [-10deg] assert_equals: expected "- 10deg " but got "- 50deg " 141 141 FAIL Web Animations: property <rotate> from neutral to [30deg] at (0) should be [10deg] assert_equals: expected "10deg " but got "- 10deg " 142 FAIL Web Animations: property <rotate> from neutral to [30deg] at (0.25) should be [15deg] assert_equals: expected "15deg " but got " none"143 FAIL Web Animations: property <rotate> from neutral to [30deg] at (0.75) should be [25deg] assert_equals: expected "25deg " but got "2 2.5deg "142 FAIL Web Animations: property <rotate> from neutral to [30deg] at (0.25) should be [15deg] assert_equals: expected "15deg " but got "7.5deg " 143 FAIL Web Animations: property <rotate> from neutral to [30deg] at (0.75) should be [25deg] assert_equals: expected "25deg " but got "28.13deg " 144 144 PASS Web Animations: property <rotate> from neutral to [30deg] at (1) should be [30deg] 145 145 FAIL Web Animations: property <rotate> from neutral to [30deg] at (2) should be [50deg] assert_equals: expected "50deg " but got "30deg " -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/scale-interpolation-expected.txt
r268173 r268615 186 186 PASS CSS Animations: property <scale> from neutral to [1.5 1] at (1) should be [1.5 1] 187 187 PASS CSS Animations: property <scale> from neutral to [1.5 1] at (2) should be [1.9 1] 188 PASS Web Animations: property <scale> from neutral to [1.5 1] at (-1) should be [0.7 1] 188 FAIL Web Animations: property <scale> from neutral to [1.5 1] at (-1) should be [0.7 1] assert_equals: expected "0.7 1 " but got "- 0.1 1 " 189 189 FAIL Web Animations: property <scale> from neutral to [1.5 1] at (0) should be [1.1 1] assert_equals: expected "1.1 1 " but got "0.7 1 " 190 FAIL Web Animations: property <scale> from neutral to [1.5 1] at (0.25) should be [1.2 1] assert_equals: expected "1.2 1 " but got " 0.91 "191 FAIL Web Animations: property <scale> from neutral to [1.5 1] at (0.75) should be [1.4 1] assert_equals: expected "1.4 1 " but got "1. 351 "190 FAIL Web Animations: property <scale> from neutral to [1.5 1] at (0.25) should be [1.2 1] assert_equals: expected "1.2 1 " but got "1.05 1 " 191 FAIL Web Animations: property <scale> from neutral to [1.5 1] at (0.75) should be [1.4 1] assert_equals: expected "1.4 1 " but got "1.46 1 " 192 192 PASS Web Animations: property <scale> from neutral to [1.5 1] at (1) should be [1.5 1] 193 193 FAIL Web Animations: property <scale> from neutral to [1.5 1] at (2) should be [1.9 1] assert_equals: expected "1.9 1 " but got "1.5 1 " -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/animation/translate-interpolation-expected.txt
r268173 r268615 234 234 PASS CSS Animations: property <translate> from neutral to [20px] at (1) should be [20px] 235 235 PASS CSS Animations: property <translate> from neutral to [20px] at (2) should be [30px] 236 PASS Web Animations: property <translate> from neutral to [20px] at (-1) should be [0px] 236 FAIL Web Animations: property <translate> from neutral to [20px] at (-1) should be [0px] assert_equals: expected "none " but got "- 20px " 237 237 FAIL Web Animations: property <translate> from neutral to [20px] at (0) should be [10px] assert_equals: expected "10px " but got "none " 238 FAIL Web Animations: property <translate> from neutral to [20px] at (0.25) should be [12.5px] assert_equals: expected "12.5px " but got " 5px "239 FAIL Web Animations: property <translate> from neutral to [20px] at (0.75) should be [17.5px] assert_equals: expected "17.5px " but got "1 6.25px "238 FAIL Web Animations: property <translate> from neutral to [20px] at (0.25) should be [12.5px] assert_equals: expected "12.5px " but got "8.75px " 239 FAIL Web Animations: property <translate> from neutral to [20px] at (0.75) should be [17.5px] assert_equals: expected "17.5px " but got "19.06px " 240 240 PASS Web Animations: property <translate> from neutral to [20px] at (1) should be [20px] 241 241 FAIL Web Animations: property <translate> from neutral to [20px] at (2) should be [30px] assert_equals: expected "30px " but got "20px " -
trunk/Source/WebCore/ChangeLog
r268613 r268615 1 2020-10-16 Antoine Quint <graouts@webkit.org> 2 3 Support accelerated animation of individual transform CSS properties 4 https://bugs.webkit.org/show_bug.cgi?id=217842 5 <rdar://problem/70391914> 6 7 Reviewed by Dean Jackson. 8 9 In order to support accelerated animation of individual transform CSS properties, we make a list of the 10 various animations targeting animation-related properties in GraphicsLayerCA::updateAnimations() and apply 11 an animation for each of those properties in their expected application order – translate, scale, rotate and 12 then transform – using Core Animation's additive animation mode. 13 14 When one of those properties does not have an animation, we create a non-interpolating base transform value 15 animation set with both from and to values matching the value set in CSS for this particular property. We use 16 a new transformMatrixForProperty() method on the GraphicsLayerClient to obtain this value. 17 18 We also add a non-additive, non-interpolating identity transform first to make sure all the additive animations 19 build on top of a neutral transform and not the underlying value applied to the layer. 20 21 Finally, when GraphicsLayerCA::setTransform() is updated, we update the animations to ensure that any base 22 transform value animation is updated to match the current value of the CSS properties contributing to the 23 compound layer transform. 24 25 Tests: webanimations/accelerated-transform-related-animation-property-order.html 26 webanimations/accelerated-translate-animation-additional-animation-added-in-flight.html 27 webanimations/accelerated-translate-animation-underlying-transform-changed-in-flight.html 28 webanimations/accelerated-translate-animation-with-transform.html 29 webanimations/accelerated-translate-animation.html 30 31 * animation/CSSPropertyAnimation.cpp: Add the necessary animationIsAccelerated() overrides for each of the 32 individual CSS transform property animation wrappers to indicate that accelerated animations are supported. 33 * platform/graphics/GraphicsLayer.cpp: 34 (WebCore::GraphicsLayer::validateTransformOperations): Update the ASSERT to check that the animated property 35 is any of the transform-related properties. 36 * platform/graphics/GraphicsLayer.h: 37 (WebCore::TransformAnimationValue::TransformAnimationValue): Add a new constructor that takes a single TransformOperation* 38 value as input instead of a TransformOperations& so that the values coming from the individual CSS transform properties 39 can be used to create a TransformAnimationValue in RenderLayerBacking::startAnimation(). 40 * platform/graphics/GraphicsLayerClient.h: Add the new animated property identifiers for the individual CSS transform properties. 41 (WebCore::animatedPropertyIsTransformOrRelated): Add a new utility to identify any of the transform-related animated property 42 identifiers. 43 (WebCore::GraphicsLayerClient::transformMatrixForProperty const): New method called from GraphicsLayerCA::updateAnimations() 44 to query the client, such as RenderLayerBacking, for the TransformationMatrix representing a given CSS property value to be 45 used for base transform value non-interpolating animations. 46 * platform/graphics/ca/GraphicsLayerCA.cpp: 47 (WebCore::propertyIdToString): Account for the new animated property identifiers. 48 (WebCore::GraphicsLayerCA::setTransform): If we are currently running a transform-related animation, a change in underlying 49 transform value means we must re-evaluate all transform-related animations to ensure that the base value transform animations 50 are current. 51 (WebCore::GraphicsLayerCA::moveOrCopyAnimations): 52 (WebCore::GraphicsLayerCA::addAnimation): 53 (WebCore::GraphicsLayerCA::updateAnimations): When updating animations, keep track of the most recent animation applicable to each 54 individual CSS transform property and the list of animations targeting the transform CSS property. Then, ensure those animations 55 are applied in the specified order – translate, scale, rotate and transform – by adding those animations as additive CA animations 56 with non-interpolating base transform value animations for each property that does not have a specified interpolating animation. 57 (WebCore::GraphicsLayerCA::isRunningTransformAnimation const): Ensure we also consider paused animations as "running" animations. 58 (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): Whether a transform animation needs to be run using the additive mode 59 is now determined in updateAnimations() so we remove all code related to working out whether animations ought to be additive. 60 (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): We force the creation of CATransform3D values for individual 61 CSS transform properties since only this mode guarantees that additivity of such animations will yield the expected result where 62 the transforms are multiplied rather than simply adding float values of individual components. 63 * platform/graphics/ca/GraphicsLayerCA.h: 64 * rendering/RenderLayerBacking.cpp: 65 (WebCore::RenderLayerBacking::startAnimation): Ensure we start animations for the individual CSS transform properties. 66 (WebCore::RenderLayerBacking::graphicsLayerToCSSProperty): 67 (WebCore::RenderLayerBacking::cssToGraphicsLayerProperty): 68 (WebCore::RenderLayerBacking::transformMatrixForProperty const): Implement the new GraphicsLayerClient method to provide a 69 matrix that can be used as a value for non-interpolating base value transform animations in GraphicsLayerCA::updateAnimations() 70 for any of the transform-related CSS properties. 71 * rendering/RenderLayerBacking.h: 72 * rendering/RenderLayerCompositor.cpp: 73 (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Ensure that an animation for any of the transform-related 74 CSS properties yields composition of the target layer. 75 (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): 76 * rendering/style/WillChangeData.cpp: 77 (WebCore::propertyTriggersCompositingOnBoxesOnly): Ensure that setting the will-change CSS property to any of the transform-related 78 CSS properties yields composition of the target. 79 1 80 2020-10-16 Jiewen Tan <jiewen_tan@apple.com> 2 81 -
trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp
r268516 r268615 851 851 852 852 private: 853 bool animationIsAccelerated() const final { return true; } 854 853 855 bool equals(const RenderStyle* a, const RenderStyle* b) const final 854 856 { … … 866 868 867 869 private: 870 bool animationIsAccelerated() const final { return true; } 871 868 872 bool equals(const RenderStyle* a, const RenderStyle* b) const final 869 873 { … … 881 885 882 886 private: 887 bool animationIsAccelerated() const final { return true; } 888 883 889 bool equals(const RenderStyle* a, const RenderStyle* b) const final 884 890 { -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp
r266342 r268615 722 722 int GraphicsLayer::validateTransformOperations(const KeyframeValueList& valueList, bool& hasBigRotation) 723 723 { 724 ASSERT( valueList.property() == AnimatedPropertyTransform);724 ASSERT(animatedPropertyIsTransformOrRelated(valueList.property())); 725 725 726 726 hasBigRotation = false; -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
r267188 r268615 134 134 } 135 135 136 TransformAnimationValue(double keyTime, TransformOperation* value, TimingFunction* timingFunction = nullptr) 137 : AnimationValue(keyTime, timingFunction) 138 { 139 if (value) 140 m_value.operations().append(value); 141 } 142 136 143 std::unique_ptr<AnimationValue> clone() const override 137 144 { -
trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h
r257465 r268615 27 27 28 28 #include "TiledBacking.h" 29 #include "TransformationMatrix.h" 29 30 #include <wtf/Forward.h> 30 31 #include <wtf/OptionSet.h> … … 38 39 class IntPoint; 39 40 class IntRect; 40 class TransformationMatrix;41 41 42 42 enum class GraphicsLayerPaintingPhase { … … 52 52 enum AnimatedPropertyID { 53 53 AnimatedPropertyInvalid, 54 AnimatedPropertyTranslate, 55 AnimatedPropertyScale, 56 AnimatedPropertyRotate, 54 57 AnimatedPropertyTransform, 55 58 AnimatedPropertyOpacity, … … 60 63 #endif 61 64 }; 65 66 inline bool animatedPropertyIsTransformOrRelated(AnimatedPropertyID property) 67 { 68 return property == AnimatedPropertyTransform || property == AnimatedPropertyTranslate || property == AnimatedPropertyScale || property == AnimatedPropertyRotate; 69 } 62 70 63 71 enum LayerTreeAsTextBehaviorFlags { … … 140 148 virtual void logFilledVisibleFreshTile(unsigned) { }; 141 149 150 virtual TransformationMatrix transformMatrixForProperty(AnimatedPropertyID) const { return { }; } 151 142 152 #ifndef NDEBUG 143 153 // RenderLayerBacking overrides this to verify that it is not -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r268483 r268615 57 57 #include <wtf/SetForScope.h> 58 58 #include <wtf/SystemTracing.h> 59 #include <wtf/UUID.h> 59 60 #include <wtf/text/StringConcatenateNumbers.h> 60 61 #include <wtf/text/TextStream.h> … … 252 253 { 253 254 switch (property) { 255 case AnimatedPropertyTranslate: 256 case AnimatedPropertyScale: 257 case AnimatedPropertyRotate: 254 258 case AnimatedPropertyTransform: 255 259 return "transform"_s; … … 658 662 GraphicsLayer::setTransform(t); 659 663 noteLayerPropertyChanged(TransformChanged); 664 665 // If we are currently running a transform-related animation, a change in underlying 666 // transform value means we must re-evaluate all transform-related animations to ensure 667 // that the base value transform animations are current. 668 if (isRunningTransformAnimation()) 669 noteLayerPropertyChanged(AnimationChanged | CoverageRectChanged); 660 670 } 661 671 … … 690 700 { 691 701 for (auto& animation : m_animations) { 692 if ((animat ion.m_property == AnimatedPropertyTransform702 if ((animatedPropertyIsTransformOrRelated(animation.m_property) 693 703 || animation.m_property == AnimatedPropertyOpacity 694 704 || animation.m_property == AnimatedPropertyBackgroundColor … … 1045 1055 1046 1056 bool createdAnimations = false; 1047 if ( valueList.property() == AnimatedPropertyTransform)1057 if (animatedPropertyIsTransformOrRelated(valueList.property())) 1048 1058 createdAnimations = createTransformAnimationsFromKeyframes(valueList, anim, animationName, Seconds { timeOffset }, boxSize); 1049 1059 else if (valueList.property() == AnimatedPropertyFilter) { … … 2852 2862 void GraphicsLayerCA::updateAnimations() 2853 2863 { 2854 // Remove all animations so far. 2855 for (auto& animation : m_animations) 2856 removeCAAnimationFromLayer(animation); 2857 2858 // Remove all animations from the list that were pending removal. 2859 m_animations.removeAllMatching([&](LayerPropertyAnimation animation) { 2860 return animation.m_pendingRemoval; 2861 }); 2862 2863 // Add all remaining animations. 2864 for (auto& animation : m_animations) { 2864 enum class Additive { Yes, No }; 2865 auto addAnimation = [&](LayerPropertyAnimation& animation, Additive additive = Additive::Yes) { 2866 animation.m_animation->setAdditive(additive == Additive::Yes); 2865 2867 setAnimationOnLayer(animation); 2866 2868 if (animation.m_playState == PlayState::PausePending || animation.m_playState == PlayState::Paused) { … … 2869 2871 } else 2870 2872 animation.m_playState = PlayState::Playing; 2873 }; 2874 2875 enum class TransformationMatrixSource { UseIdentityMatrix, AskClient }; 2876 auto addBaseValueTransformAnimation = [&](AnimatedPropertyID property, TransformationMatrixSource matrixSource = TransformationMatrixSource::AskClient) { 2877 // A base value transform animation can either be set to the identity matrix or to read the underlying 2878 // value from the GraphicsLayerClient. If we didn't explicitly ask for an identity matrix, we can skip 2879 // the addition of this base value transform animation since it will be a no-op. 2880 auto matrix = matrixSource == TransformationMatrixSource::UseIdentityMatrix ? TransformationMatrix() : client().transformMatrixForProperty(property); 2881 if (matrixSource == TransformationMatrixSource::AskClient && matrix.isIdentity()) 2882 return; 2883 2884 // A base value transform animation needs to last forever and use the same value for its from and to values. 2885 auto caAnimation = createPlatformCAAnimation(PlatformCAAnimation::Basic, propertyIdToString(property)); 2886 caAnimation->setDuration(Seconds::infinity().seconds()); 2887 caAnimation->setFromValue(matrix); 2888 caAnimation->setToValue(matrix); 2889 2890 auto animation = LayerPropertyAnimation(WTFMove(caAnimation), "base-transform-" + createCanonicalUUIDString(), property, 0, 0, 0_s); 2891 // To ensure the base value transform is applied along with all the interpolating animations, we set it to have started 2892 // as early as possible, which combined with the infinite duration ensures it's current for any given CA media time. 2893 animation.m_beginTime = Seconds::fromNanoseconds(1); 2894 2895 // Additivity will depend on the source of the matrix, if it was explicitly provided as an identity matrix, it 2896 // is the initial base value transform animation and must override the current transform value for this layer. 2897 // Otherwise, it is meant to apply the underlying value for one specific transform-related property and be additive 2898 // to be combined with the other base value transform animations and interpolating animations. 2899 addAnimation(animation, matrixSource == TransformationMatrixSource::AskClient ? Additive::Yes : Additive::No); 2900 m_baseValueTransformAnimations.append(WTFMove(animation)); 2901 }; 2902 2903 // Remove all running CA animations. 2904 for (auto& animation : m_animations) { 2905 if (animation.m_playState == PlayState::Playing || animation.m_playState == PlayState::Paused) 2906 removeCAAnimationFromLayer(animation); 2907 } 2908 2909 // Also remove all the base value transform CA animations. 2910 for (auto& animation : m_baseValueTransformAnimations) 2911 removeCAAnimationFromLayer(animation); 2912 2913 // Now remove all the animations marked as pending removal and all base value transform animations. 2914 m_animations.removeAllMatching([&](LayerPropertyAnimation animation) { 2915 return animation.m_pendingRemoval; 2916 }); 2917 m_baseValueTransformAnimations.clear(); 2918 2919 // Now that our list of animations is current, we can separate animations by property so that 2920 // we can apply them in order. We only need to apply the last animation applied for a given 2921 // individual transform property, so we keep a reference to that. For animations targeting 2922 // the transform property itself, we keep them in order since they all need to apply and build 2923 // on top of each other. Finally, animations that are not transform-related can be applied 2924 // right away since their order relative to transform animations does not matter. 2925 LayerPropertyAnimation* translateAnimation = nullptr; 2926 LayerPropertyAnimation* scaleAnimation = nullptr; 2927 LayerPropertyAnimation* rotateAnimation = nullptr; 2928 Vector<LayerPropertyAnimation*> transformAnimations; 2929 2930 for (auto& animation : m_animations) { 2931 switch (animation.m_property) { 2932 case AnimatedPropertyTranslate: 2933 translateAnimation = &animation; 2934 break; 2935 case AnimatedPropertyScale: 2936 scaleAnimation = &animation; 2937 break; 2938 case AnimatedPropertyRotate: 2939 rotateAnimation = &animation; 2940 break; 2941 case AnimatedPropertyTransform: 2942 transformAnimations.append(&animation); 2943 break; 2944 case AnimatedPropertyOpacity: 2945 case AnimatedPropertyBackgroundColor: 2946 case AnimatedPropertyFilter: 2947 #if ENABLE(FILTERS_LEVEL_2) 2948 case AnimatedPropertyWebkitBackdropFilter: 2949 #endif 2950 addAnimation(animation, Additive::No); 2951 break; 2952 case AnimatedPropertyInvalid: 2953 ASSERT_NOT_REACHED(); 2954 } 2955 } 2956 2957 // Now we can apply the transform-related animations, taking care to add them in the right order 2958 // (translate/scale/rotate/transform) and generate non-interpolating base value transform animations 2959 // for each property that is not otherwise interpolated. 2960 if (translateAnimation || scaleAnimation || rotateAnimation || !transformAnimations.isEmpty()) { 2961 // Start with a base identity transform to override the transform applied to the layer and have a 2962 // sound base to add animations on top of with additivity enabled. 2963 addBaseValueTransformAnimation(AnimatedPropertyTransform, TransformationMatrixSource::UseIdentityMatrix); 2964 2965 // Core Animation might require additive animations to be applied in the reverse order. 2966 #if !PLATFORM(WIN) && !HAVE(CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED) 2967 if (translateAnimation) 2968 addAnimation(*translateAnimation); 2969 else 2970 addBaseValueTransformAnimation(AnimatedPropertyTranslate); 2971 2972 if (scaleAnimation) 2973 addAnimation(*scaleAnimation); 2974 else 2975 addBaseValueTransformAnimation(AnimatedPropertyScale); 2976 2977 if (rotateAnimation) 2978 addAnimation(*rotateAnimation); 2979 else 2980 addBaseValueTransformAnimation(AnimatedPropertyRotate); 2981 2982 for (auto* animation : transformAnimations) 2983 addAnimation(*animation); 2984 if (transformAnimations.isEmpty()) 2985 addBaseValueTransformAnimation(AnimatedPropertyTransform); 2986 #else 2987 for (auto* animation : WTF::makeReversedRange(transformAnimations)) 2988 addAnimation(*animation); 2989 if (transformAnimations.isEmpty()) 2990 addBaseValueTransformAnimation(AnimatedPropertyTransform); 2991 2992 if (rotateAnimation) 2993 addAnimation(*rotateAnimation); 2994 else 2995 addBaseValueTransformAnimation(AnimatedPropertyRotate); 2996 2997 if (scaleAnimation) 2998 addAnimation(*scaleAnimation); 2999 else 3000 addBaseValueTransformAnimation(AnimatedPropertyScale); 3001 3002 if (translateAnimation) 3003 addAnimation(*translateAnimation); 3004 else 3005 addBaseValueTransformAnimation(AnimatedPropertyTranslate); 3006 #endif 2871 3007 } 2872 3008 } … … 2875 3011 { 2876 3012 return m_animations.findMatching([&](LayerPropertyAnimation animation) { 2877 return animat ion.m_property == AnimatedPropertyTransform && animation.m_playState == PlayState::Playing;3013 return animatedPropertyIsTransformOrRelated(animation.m_property) && (animation.m_playState == PlayState::Playing || animation.m_playState == PlayState::Paused); 2878 3014 }) != notFound; 2879 3015 } … … 3011 3147 bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, Seconds timeOffset) 3012 3148 { 3013 ASSERT( valueList.property() != AnimatedPropertyTransform&& (!supportsAcceleratedFilterAnimations() || valueList.property() != AnimatedPropertyFilter));3149 ASSERT(!animatedPropertyIsTransformOrRelated(valueList.property()) && (!supportsAcceleratedFilterAnimations() || valueList.property() != AnimatedPropertyFilter)); 3014 3150 3015 3151 bool valuesOK; … … 3042 3178 { 3043 3179 TransformOperation::OperationType transformOp = isMatrixAnimation ? TransformOperation::MATRIX_3D : operations->operations().at(animationIndex)->type(); 3044 #if !PLATFORM(WIN) && !HAVE(CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED)3045 bool additive = animationIndex > 0;3046 #else3047 int numAnimations = isMatrixAnimation ? 1 : operations->size();3048 bool additive = animationIndex < numAnimations - 1;3049 #endif3050 3180 3051 3181 RefPtr<PlatformCAAnimation> caAnimation; 3052 3182 bool validMatrices = true; 3053 3183 if (isKeyframe(valueList)) { 3054 caAnimation = createKeyframeAnimation(animation, propertyIdToString(valueList.property()), additive);3184 caAnimation = createKeyframeAnimation(animation, propertyIdToString(valueList.property()), false); 3055 3185 validMatrices = setTransformAnimationKeyframes(valueList, animation, caAnimation.get(), animationIndex, transformOp, isMatrixAnimation, boxSize); 3056 3186 } else { 3057 3187 if (animation->timingFunction()->isSpringTimingFunction()) 3058 caAnimation = createSpringAnimation(animation, propertyIdToString(valueList.property()), additive);3188 caAnimation = createSpringAnimation(animation, propertyIdToString(valueList.property()), false); 3059 3189 else 3060 caAnimation = createBasicAnimation(animation, propertyIdToString(valueList.property()), additive);3190 caAnimation = createBasicAnimation(animation, propertyIdToString(valueList.property()), false); 3061 3191 validMatrices = setTransformAnimationEndpoints(valueList, animation, caAnimation.get(), animationIndex, transformOp, isMatrixAnimation, boxSize); 3062 3192 } … … 3071 3201 bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, Seconds timeOffset, const FloatSize& boxSize) 3072 3202 { 3073 ASSERT( valueList.property() == AnimatedPropertyTransform);3203 ASSERT(animatedPropertyIsTransformOrRelated(valueList.property())); 3074 3204 3075 3205 bool hasBigRotation; … … 3080 3210 3081 3211 // If function lists don't match we do a matrix animation, otherwise we do a component hardware animation. 3082 bool isMatrixAnimation = listIndex < 0;3212 bool isMatrixAnimation = valueList.property() == AnimatedPropertyTransform ? listIndex < 0 : true; 3083 3213 int numAnimations = isMatrixAnimation ? 1 : operations->size(); 3084 3214 3085 #if !PLATFORM(WIN) && !HAVE(CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED)3086 3215 for (int animationIndex = 0; animationIndex < numAnimations; ++animationIndex) { 3087 #else3088 // Some versions of CA require animation lists to be applied in reverse order (<rdar://problem/43908047> and <rdar://problem/9112233>).3089 for (int animationIndex = numAnimations - 1; animationIndex >= 0; --animationIndex) {3090 #endif3091 3216 if (!appendToUncommittedAnimations(valueList, operations, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) { 3092 3217 validMatrices = false; … … 4216 4341 static String animatedPropertyIDAsString(AnimatedPropertyID property) 4217 4342 { 4218 if (property == AnimatedPropertyTransform) 4343 switch (property) { 4344 case AnimatedPropertyTranslate: 4345 case AnimatedPropertyScale: 4346 case AnimatedPropertyRotate: 4347 case AnimatedPropertyTransform: 4219 4348 return "transform"; 4220 if (property == AnimatedPropertyOpacity)4349 case AnimatedPropertyOpacity: 4221 4350 return "opacity"; 4222 if (property == AnimatedPropertyBackgroundColor)4351 case AnimatedPropertyBackgroundColor: 4223 4352 return "background-color"; 4224 if (property == AnimatedPropertyFilter)4353 case AnimatedPropertyFilter: 4225 4354 return "filter"; 4226 if (property == AnimatedPropertyInvalid)4227 return "invalid";4228 4355 #if ENABLE(FILTERS_LEVEL_2) 4229 if (property == AnimatedPropertyWebkitBackdropFilter)4356 case AnimatedPropertyWebkitBackdropFilter: 4230 4357 return "backdrop-filter"; 4231 4358 #endif 4359 case AnimatedPropertyInvalid: 4360 return "invalid"; 4361 } 4362 ASSERT_NOT_REACHED(); 4232 4363 return ""; 4233 4364 } -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r268483 r268615 598 598 599 599 Vector<LayerPropertyAnimation> m_animations; 600 Vector<LayerPropertyAnimation> m_baseValueTransformAnimations; 600 601 601 602 Vector<FloatRect> m_dirtyRects; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r268476 r268615 3562 3562 { 3563 3563 bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity); 3564 bool hasRotate = renderer().isBox() && keyframes.containsProperty(CSSPropertyRotate); 3565 bool hasScale = renderer().isBox() && keyframes.containsProperty(CSSPropertyScale); 3566 bool hasTranslate = renderer().isBox() && keyframes.containsProperty(CSSPropertyTranslate); 3564 3567 bool hasTransform = renderer().isBox() && keyframes.containsProperty(CSSPropertyTransform); 3565 3568 bool hasFilter = keyframes.containsProperty(CSSPropertyFilter); … … 3570 3573 #endif 3571 3574 3572 if (!hasOpacity && !hasTransform && !hasFilter && !hasBackdropFilter) 3573 return false; 3574 3575 if (!hasOpacity && !hasRotate && !hasScale && !hasTranslate && !hasTransform && !hasFilter && !hasBackdropFilter) 3576 return false; 3577 3578 KeyframeValueList rotateVector(AnimatedPropertyRotate); 3579 KeyframeValueList scaleVector(AnimatedPropertyScale); 3580 KeyframeValueList translateVector(AnimatedPropertyTranslate); 3575 3581 KeyframeValueList transformVector(AnimatedPropertyTransform); 3576 3582 KeyframeValueList opacityVector(AnimatedPropertyOpacity); … … 3592 3598 3593 3599 bool isFirstOrLastKeyframe = key == 0 || key == 1; 3600 if ((hasRotate && isFirstOrLastKeyframe) || currentKeyframe.containsProperty(CSSPropertyRotate)) 3601 rotateVector.insert(makeUnique<TransformAnimationValue>(key, keyframeStyle->rotate(), tf)); 3602 3603 if ((hasScale && isFirstOrLastKeyframe) || currentKeyframe.containsProperty(CSSPropertyScale)) 3604 scaleVector.insert(makeUnique<TransformAnimationValue>(key, keyframeStyle->scale(), tf)); 3605 3606 if ((hasTranslate && isFirstOrLastKeyframe) || currentKeyframe.containsProperty(CSSPropertyTranslate)) 3607 translateVector.insert(makeUnique<TransformAnimationValue>(key, keyframeStyle->translate(), tf)); 3608 3594 3609 if ((hasTransform && isFirstOrLastKeyframe) || currentKeyframe.containsProperty(CSSPropertyTransform)) 3595 3610 transformVector.insert(makeUnique<TransformAnimationValue>(key, keyframeStyle->transform(), tf)); … … 3612 3627 bool didAnimate = false; 3613 3628 3629 if (hasRotate && m_graphicsLayer->addAnimation(rotateVector, snappedIntRect(renderBox()->borderBoxRect()).size(), &animation, keyframes.animationName(), timeOffset)) 3630 didAnimate = true; 3631 3632 if (hasScale && m_graphicsLayer->addAnimation(scaleVector, snappedIntRect(renderBox()->borderBoxRect()).size(), &animation, keyframes.animationName(), timeOffset)) 3633 didAnimate = true; 3634 3635 if (hasTranslate && m_graphicsLayer->addAnimation(translateVector, snappedIntRect(renderBox()->borderBoxRect()).size(), &animation, keyframes.animationName(), timeOffset)) 3636 didAnimate = true; 3637 3614 3638 if (hasTransform && m_graphicsLayer->addAnimation(transformVector, snappedIntRect(renderBox()->borderBoxRect()).size(), &animation, keyframes.animationName(), timeOffset)) 3615 3639 didAnimate = true; … … 3708 3732 CSSPropertyID cssProperty = CSSPropertyInvalid; 3709 3733 switch (property) { 3734 case AnimatedPropertyTranslate: 3735 cssProperty = CSSPropertyTranslate; 3736 break; 3737 case AnimatedPropertyScale: 3738 cssProperty = CSSPropertyScale; 3739 break; 3740 case AnimatedPropertyRotate: 3741 cssProperty = CSSPropertyRotate; 3742 break; 3710 3743 case AnimatedPropertyTransform: 3711 3744 cssProperty = CSSPropertyTransform; … … 3734 3767 { 3735 3768 switch (cssProperty) { 3769 case CSSPropertyTranslate: 3770 return AnimatedPropertyTranslate; 3771 case CSSPropertyScale: 3772 return AnimatedPropertyScale; 3773 case CSSPropertyRotate: 3774 return AnimatedPropertyRotate; 3736 3775 case CSSPropertyTransform: 3737 3776 return AnimatedPropertyTransform; … … 3821 3860 } 3822 3861 3862 TransformationMatrix RenderLayerBacking::transformMatrixForProperty(AnimatedPropertyID property) const 3863 { 3864 auto* box = renderBox(); 3865 if (!box) 3866 return { }; 3867 3868 TransformationMatrix matrix; 3869 3870 auto applyTransformOperation = [&](TransformOperation* operation) { 3871 if (operation) 3872 operation->apply(matrix, snappedIntRect(renderBox()->borderBoxRect()).size()); 3873 }; 3874 3875 if (property == AnimatedPropertyTranslate) 3876 applyTransformOperation(renderer().style().translate()); 3877 else if (property == AnimatedPropertyScale) 3878 applyTransformOperation(renderer().style().scale()); 3879 else if (property == AnimatedPropertyRotate) 3880 applyTransformOperation(renderer().style().rotate()); 3881 else if (property == AnimatedPropertyTransform) 3882 renderer().style().transform().apply(snappedIntRect(renderBox()->borderBoxRect()).size(), matrix); 3883 else 3884 ASSERT_NOT_REACHED(); 3885 3886 return matrix; 3887 } 3888 3823 3889 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r267188 r268615 252 252 LayoutSize subpixelOffsetFromRenderer() const { return m_subpixelOffsetFromRenderer; } 253 253 254 TransformationMatrix transformMatrixForProperty(AnimatedPropertyID) const final; 255 254 256 #if PLATFORM(IOS_FAMILY) 255 257 bool needsIOSDumpRenderTreeMainFrameRenderViewLayerIsAlwaysOpaqueHack(const GraphicsLayer&) const override; -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r268547 r268615 2973 2973 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyWebkitBackdropFilter) 2974 2974 #endif 2975 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyTranslate) 2976 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyScale) 2977 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyRotate) 2975 2978 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyTransform); 2976 2979 } … … 3518 3521 if (auto styleable = Styleable::fromRenderer(renderer)) { 3519 3522 if (auto* effectsStack = styleable->keyframeEffectStack()) 3520 return effectsStack->isCurrentlyAffectingProperty(CSSPropertyTransform); 3523 return effectsStack->isCurrentlyAffectingProperty(CSSPropertyTransform) 3524 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyRotate) 3525 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyScale) 3526 || effectsStack->isCurrentlyAffectingProperty(CSSPropertyTranslate); 3521 3527 } 3522 3528 -
trunk/Source/WebCore/rendering/style/WillChangeData.cpp
r267985 r268615 121 121 // always composite if there's no scrollable overflow. 122 122 switch (property) { 123 case CSSPropertyScale: 124 case CSSPropertyRotate: 125 case CSSPropertyTranslate: 123 126 case CSSPropertyTransform: 124 127 return true;
Note: See TracChangeset
for help on using the changeset viewer.