Changeset 268483 in webkit
- Timestamp:
- Oct 14, 2020 1:37:54 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r268477 r268483 1 2020-10-14 Antoine Quint <graouts@webkit.org> 2 3 Simplify management of LayerPropertyAnimation instances in GraphicsLayerCA 4 https://bugs.webkit.org/show_bug.cgi?id=217707 5 <rdar://problem/70291140> 6 7 Reviewed by Dean Jackson. 8 9 The management of LayerPropertyAnimation instances in GraphicsLayerCA spread 10 those animations between different data structures. We now simplify this to 11 be a single Vector<LayerPropertyAnimation> with three new properties. 12 13 The m_playState property indicates: 14 15 - whether the animation has been added to the list but awaiting the next commit 16 to be played (PlayPending) 17 - whether the animation has been committed and playing (Playing) 18 - whether the animation has been marked to be paused but awaiting the next commit 19 to be paused (PausePending) 20 - whether the animation has been committed and paused (Paused) 21 22 The m_pendingRemoval property indicates whether the animation has been marked for 23 removal upon the next commit. 24 25 The m_beginTime property indicates the time at which the animation was first added, 26 ensuring that the animation can be removed and re-added while preserving the same 27 begin time. 28 29 As such, when GraphicsLayerCA::updateAnimations() is called we remove all animations 30 from the layer, filter m_animations to only have animations that are not marked 31 as pending removal, and add the now-current list of animations to the layer. 32 33 No new test since this change is refactoring only and should not have any change 34 in behavior. 35 36 * platform/graphics/ca/GraphicsLayerCA.cpp: 37 (WebCore::GraphicsLayerCA::moveOrCopyAnimations): 38 (WebCore::GraphicsLayerCA::animationIsRunning const): 39 (WebCore::animationCanBeAccelerated): 40 (WebCore::GraphicsLayerCA::pauseAnimation): 41 (WebCore::GraphicsLayerCA::removeAnimation): 42 (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted): 43 (WebCore::GraphicsLayerCA::updateAnimations): 44 (WebCore::GraphicsLayerCA::isRunningTransformAnimation const): 45 (WebCore::GraphicsLayerCA::setAnimationOnLayer): 46 (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer): 47 (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): 48 (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): 49 (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): 50 (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): 51 (WebCore::animationIdentifier): Deleted. 52 (WebCore::GraphicsLayerCA::animationCanBeAccelerated const): Deleted. 53 (WebCore::GraphicsLayerCA::addProcessingActionForAnimation): Deleted. 54 (WebCore::GraphicsLayerCA::ensureLayerAnimations): Deleted. 55 * platform/graphics/ca/GraphicsLayerCA.h: 56 (WebCore::GraphicsLayerCA::hasAnimations const): 57 (WebCore::GraphicsLayerCA::LayerPropertyAnimation::animationIdentifier const): 58 (WebCore::GraphicsLayerCA::moveAnimations): 59 (WebCore::GraphicsLayerCA::copyAnimations): 60 (WebCore::GraphicsLayerCA::animationIsRunning const): Deleted. 61 (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction): Deleted. 62 1 63 2020-10-14 Youenn Fablet <youenn@apple.com> 2 64 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r267188 r268483 271 271 } 272 272 273 static String animationIdentifier(const String& animationName, AnimatedPropertyID property, int index, int subIndex)274 {275 return makeString(animationName, '_', static_cast<unsigned>(property), '_', index, '_', subIndex);276 }277 278 273 static bool animationHasStepsTimingFunction(const KeyframeValueList& valueList, const Animation* anim) 279 274 { … … 694 689 void GraphicsLayerCA::moveOrCopyAnimations(MoveOrCopy operation, PlatformCALayer *fromLayer, PlatformCALayer *toLayer) 695 690 { 696 if (!hasAnimations()) 697 return; 698 699 // Look for running animations affecting this property. 700 for (const auto& it : m_animations->runningAnimations) { 701 const auto& propertyAnimations = it.value; 702 size_t numAnimations = propertyAnimations.size(); 703 for (size_t i = 0; i < numAnimations; ++i) { 704 const LayerPropertyAnimation& currAnimation = propertyAnimations[i]; 705 706 if (currAnimation.m_property == AnimatedPropertyTransform 707 || currAnimation.m_property == AnimatedPropertyOpacity 708 || currAnimation.m_property == AnimatedPropertyBackgroundColor 709 || currAnimation.m_property == AnimatedPropertyFilter) 710 moveOrCopyLayerAnimation(operation, animationIdentifier(currAnimation.m_name, currAnimation.m_property, currAnimation.m_index, currAnimation.m_subIndex), fromLayer, toLayer); 711 } 691 for (auto& animation : m_animations) { 692 if ((animation.m_property == AnimatedPropertyTransform 693 || animation.m_property == AnimatedPropertyOpacity 694 || animation.m_property == AnimatedPropertyBackgroundColor 695 || animation.m_property == AnimatedPropertyFilter) 696 && (animation.m_playState == PlayState::Playing || animation.m_playState == PlayState::Paused)) 697 moveOrCopyLayerAnimation(operation, animation.animationIdentifier(), fromLayer, toLayer); 712 698 } 713 699 } … … 1027 1013 } 1028 1014 1029 bool GraphicsLayerCA::animationCanBeAccelerated(const KeyframeValueList& valueList, const Animation* anim) const 1015 bool GraphicsLayerCA::animationIsRunning(const String& animationName) const 1016 { 1017 auto index = m_animations.findMatching([&](LayerPropertyAnimation animation) { 1018 return animation.m_name == animationName; 1019 }); 1020 return index != notFound && m_animations[index].m_playState == PlayState::Playing; 1021 } 1022 1023 static bool animationCanBeAccelerated(const KeyframeValueList& valueList, const Animation* anim) 1030 1024 { 1031 1025 if (anim->playbackRate() != 1 || !anim->directionIsForwards()) … … 1039 1033 1040 1034 return true; 1041 }1042 1043 void GraphicsLayerCA::addProcessingActionForAnimation(const String& animationName, AnimationProcessingAction processingAction)1044 {1045 ensureLayerAnimations();1046 1047 auto& processingActions = m_animations->animationsToProcess.ensure(animationName, [] {1048 return Vector<AnimationProcessingAction> { };1049 }).iterator->value;1050 1051 if (!processingActions.isEmpty() && processingActions.last().action == Remove)1052 return;1053 1054 processingActions.append(processingAction);1055 1035 } 1056 1036 … … 1090 1070 LOG_WITH_STREAM(Animations, stream << "GraphicsLayerCA " << this << " id " << primaryLayerID() << " pauseAnimation " << animationName << " (is running " << animationIsRunning(animationName) << ")"); 1091 1071 1092 // Call add since if there is already a Remove in there, we don't want to overwrite it with a Pause. 1093 addProcessingActionForAnimation(animationName, AnimationProcessingAction { Pause, Seconds { timeOffset } }); 1072 auto index = m_animations.findMatching([&](LayerPropertyAnimation animation) { 1073 return animation.m_name == animationName && !animation.m_pendingRemoval; 1074 }); 1075 1076 if (index == notFound) 1077 return; 1078 1079 auto& animation = m_animations[index]; 1080 animation.m_playState = PlayState::PausePending; 1081 animation.m_timeOffset = Seconds { timeOffset }; 1094 1082 1095 1083 noteLayerPropertyChanged(AnimationChanged); … … 1100 1088 LOG_WITH_STREAM(Animations, stream << "GraphicsLayerCA " << this << " id " << primaryLayerID() << " removeAnimation " << animationName << " (is running " << animationIsRunning(animationName) << ")"); 1101 1089 1102 if (!animationIsRunning(animationName)) { 1103 removeFromUncommittedAnimations(animationName); 1104 return; 1105 } 1106 1107 addProcessingActionForAnimation(animationName, AnimationProcessingAction(Remove)); 1090 auto index = m_animations.findMatching([&](LayerPropertyAnimation animation) { 1091 return animation.m_name == animationName && !animation.m_pendingRemoval; 1092 }); 1093 1094 if (index == notFound) 1095 return; 1096 1097 m_animations[index].m_pendingRemoval = true; 1098 1108 1099 noteLayerPropertyChanged(AnimationChanged | CoverageRectChanged); 1109 1100 } … … 1112 1103 { 1113 1104 LOG_WITH_STREAM(Animations, stream << "GraphicsLayerCA " << this << " id " << primaryLayerID() << " platformCALayerAnimationStarted " << animationKey); 1105 1106 auto index = m_animations.findMatching([&](LayerPropertyAnimation animation) { 1107 return animation.animationIdentifier() == animationKey && !animation.m_beginTime; 1108 }); 1109 1110 if (index != notFound) 1111 m_animations[index].m_beginTime = startTime.secondsSinceEpoch(); 1112 1114 1113 client().notifyAnimationStarted(this, animationKey, startTime); 1115 1114 } … … 2853 2852 void GraphicsLayerCA::updateAnimations() 2854 2853 { 2855 if (!hasAnimations()) 2856 return; 2857 2858 size_t numAnimations; 2859 if ((numAnimations = m_animations->uncomittedAnimations.size())) { 2860 for (size_t i = 0; i < numAnimations; ++i) { 2861 const LayerPropertyAnimation& pendingAnimation = m_animations->uncomittedAnimations[i]; 2862 setAnimationOnLayer(*pendingAnimation.m_animation, pendingAnimation.m_property, pendingAnimation.m_name, pendingAnimation.m_index, pendingAnimation.m_subIndex, pendingAnimation.m_timeOffset); 2863 2864 AnimationsMap::iterator it = m_animations->runningAnimations.find(pendingAnimation.m_name); 2865 if (it == m_animations->runningAnimations.end()) { 2866 Vector<LayerPropertyAnimation> animations; 2867 animations.append(pendingAnimation); 2868 m_animations->runningAnimations.add(pendingAnimation.m_name, animations); 2869 } else { 2870 Vector<LayerPropertyAnimation>& animations = it->value; 2871 animations.append(pendingAnimation); 2872 } 2873 } 2874 m_animations->uncomittedAnimations.clear(); 2875 } 2876 2877 if (m_animations->animationsToProcess.size()) { 2878 for (const auto& it : m_animations->animationsToProcess) { 2879 const String& currentAnimationName = it.key; 2880 auto animationIterator = m_animations->runningAnimations.find(currentAnimationName); 2881 if (animationIterator == m_animations->runningAnimations.end()) 2882 continue; 2883 2884 for (const auto& processingInfo : it.value) { 2885 const Vector<LayerPropertyAnimation>& animations = animationIterator->value; 2886 for (const auto& currentAnimation : animations) { 2887 switch (processingInfo.action) { 2888 case Remove: 2889 removeCAAnimationFromLayer(currentAnimation.m_property, currentAnimationName, currentAnimation.m_index, currentAnimation.m_subIndex); 2890 break; 2891 case Pause: 2892 pauseCAAnimationOnLayer(currentAnimation.m_property, currentAnimationName, currentAnimation.m_index, currentAnimation.m_subIndex, processingInfo.timeOffset); 2893 break; 2894 } 2895 } 2896 2897 if (processingInfo.action == Remove) 2898 m_animations->runningAnimations.remove(currentAnimationName); 2899 } 2900 } 2901 2902 m_animations->animationsToProcess.clear(); 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) { 2865 setAnimationOnLayer(animation); 2866 if (animation.m_playState == PlayState::PausePending || animation.m_playState == PlayState::Paused) { 2867 pauseCAAnimationOnLayer(animation); 2868 animation.m_playState = PlayState::Paused; 2869 } else 2870 animation.m_playState = PlayState::Playing; 2903 2871 } 2904 2872 } … … 2906 2874 bool GraphicsLayerCA::isRunningTransformAnimation() const 2907 2875 { 2908 if (!hasAnimations()) 2909 return false; 2910 2911 for (const auto& it : m_animations->runningAnimations) { 2912 const auto& propertyAnimations = it.value; 2913 size_t numAnimations = propertyAnimations.size(); 2914 for (size_t i = 0; i < numAnimations; ++i) { 2915 const LayerPropertyAnimation& currAnimation = propertyAnimations[i]; 2916 if (currAnimation.m_property == AnimatedPropertyTransform) 2917 return true; 2918 } 2919 } 2920 return false; 2921 } 2922 2923 void GraphicsLayerCA::ensureLayerAnimations() 2924 { 2925 if (!m_animations) 2926 m_animations = makeUnique<LayerAnimations>(); 2927 } 2928 2929 void GraphicsLayerCA::setAnimationOnLayer(PlatformCAAnimation& caAnim, AnimatedPropertyID property, const String& animationName, int index, int subIndex, Seconds timeOffset) 2930 { 2876 return m_animations.findMatching([&](LayerPropertyAnimation animation) { 2877 return animation.m_property == AnimatedPropertyTransform && animation.m_playState == PlayState::Playing; 2878 }) != notFound; 2879 } 2880 2881 void GraphicsLayerCA::setAnimationOnLayer(LayerPropertyAnimation& animation) 2882 { 2883 auto property = animation.m_property; 2931 2884 PlatformCALayer* layer = animatedLayer(property); 2932 2885 2933 if (timeOffset) 2934 caAnim.setBeginTime(CACurrentMediaTime() - timeOffset.seconds()); 2935 2936 String animationID = animationIdentifier(animationName, property, index, subIndex); 2886 auto& caAnim = *animation.m_animation; 2887 2888 if (animation.m_timeOffset) { 2889 // In case we have an offset, we need to record the beginTime now since we have to pass in an explicit 2890 // value in the first place. 2891 if (!animation.m_beginTime) 2892 animation.m_beginTime = Seconds(CACurrentMediaTime()); 2893 caAnim.setBeginTime((animation.m_beginTime - animation.m_timeOffset).seconds()); 2894 } else if (animation.m_beginTime) { 2895 // If we already have a begin time, then we already started in the past and must ensure we use that same 2896 // begin time. Any other case will get use the CA transaction's time as its begin time and will be recorded 2897 // in platformCALayerAnimationStarted(). 2898 caAnim.setBeginTime(animation.m_beginTime.seconds()); 2899 } 2900 2901 String animationID = animation.animationIdentifier(); 2937 2902 2938 2903 layer->removeAnimationForKey(animationID); … … 2965 2930 } 2966 2931 2967 bool GraphicsLayerCA::removeCAAnimationFromLayer( AnimatedPropertyID property, const String& animationName, int index, int subIndex)2968 { 2969 PlatformCALayer* layer = animatedLayer( property);2970 2971 String animationID = animation Identifier(animationName, property, index, subIndex);2932 bool GraphicsLayerCA::removeCAAnimationFromLayer(LayerPropertyAnimation& animation) 2933 { 2934 PlatformCALayer* layer = animatedLayer(animation.m_property); 2935 2936 String animationID = animation.animationIdentifier(); 2972 2937 2973 2938 if (!layer->animationForKey(animationID)) … … 2977 2942 bug7311367Workaround(m_structuralLayer.get(), transform()); 2978 2943 2979 if (LayerMap* layerCloneMap = animatedLayerClones( property)) {2944 if (LayerMap* layerCloneMap = animatedLayerClones(animation.m_property)) { 2980 2945 for (auto& clone : *layerCloneMap) { 2981 2946 // Skip immediate replicas, since they move with the original. … … 2989 2954 } 2990 2955 2991 void GraphicsLayerCA::pauseCAAnimationOnLayer( AnimatedPropertyID property, const String& animationName, int index, int subIndex, Seconds timeOffset)2992 { 2993 PlatformCALayer* layer = animatedLayer( property);2994 2995 String animationID = animation Identifier(animationName, property, index, subIndex);2956 void GraphicsLayerCA::pauseCAAnimationOnLayer(LayerPropertyAnimation& animation) 2957 { 2958 PlatformCALayer* layer = animatedLayer(animation.m_property); 2959 2960 String animationID = animation.animationIdentifier(); 2996 2961 2997 2962 RefPtr<PlatformCAAnimation> curAnim = layer->animationForKey(animationID); … … 3003 2968 3004 2969 newAnim->setSpeed(0); 3005 newAnim->setTimeOffset( timeOffset.seconds());2970 newAnim->setTimeOffset(animation.m_timeOffset.seconds()); 3006 2971 3007 2972 layer->addAnimationForKey(animationID, *newAnim); // This will replace the running animation. 3008 2973 3009 2974 // Pause the animations on the clones too. 3010 if (LayerMap* layerCloneMap = animatedLayerClones( property)) {2975 if (LayerMap* layerCloneMap = animatedLayerClones(animation.m_property)) { 3011 2976 for (auto& clone : *layerCloneMap) { 3012 2977 // Skip immediate replicas, since they move with the original. … … 3069 3034 return false; 3070 3035 3071 appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));3036 m_animations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset)); 3072 3037 3073 3038 return true; … … 3100 3065 return false; 3101 3066 3102 appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset));3067 m_animations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, 0, timeOffset)); 3103 3068 return true; 3104 3069 } … … 3160 3125 ASSERT(valuesOK); 3161 3126 3162 appendToUncommittedAnimations(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, internalFilterPropertyIndex, timeOffset));3127 m_animations.append(LayerPropertyAnimation(caAnimation.releaseNonNull(), animationName, valueList.property(), animationIndex, internalFilterPropertyIndex, timeOffset)); 3163 3128 } 3164 3129 3165 3130 return true; 3166 }3167 3168 void GraphicsLayerCA::appendToUncommittedAnimations(LayerPropertyAnimation&& animation)3169 {3170 ensureLayerAnimations();3171 3172 // Since we're adding a new animation, make sure we clear any pending AnimationProcessingAction for this animation3173 // as these are applied after we've committed new animations. However, we want to check if we had a pending removal3174 // such that removing an animation prior to adding a new one for the same name works.3175 auto processingInfoIterator = m_animations->animationsToProcess.find(animation.m_name);3176 if (processingInfoIterator != m_animations->animationsToProcess.end()) {3177 auto animationIterator = m_animations->runningAnimations.find(animation.m_name);3178 if (animationIterator != m_animations->runningAnimations.end()) {3179 auto& animations = animationIterator->value;3180 for (const auto& processingInfo : processingInfoIterator->value) {3181 if (processingInfo.action == Remove) {3182 for (const auto& currentAnimation : animations)3183 removeCAAnimationFromLayer(currentAnimation.m_property, animation.m_name, currentAnimation.m_index, currentAnimation.m_subIndex);3184 m_animations->runningAnimations.remove(animationIterator);3185 break;3186 }3187 }3188 }3189 m_animations->animationsToProcess.remove(processingInfoIterator);3190 }3191 3192 m_animations->uncomittedAnimations.append(WTFMove(animation));3193 }3194 3195 void GraphicsLayerCA::removeFromUncommittedAnimations(const String& animationName)3196 {3197 if (!m_animations)3198 return;3199 3200 m_animations->uncomittedAnimations.removeFirstMatching([&animationName] (auto& current) {3201 return current.m_name == animationName;3202 });3203 3131 } 3204 3132 … … 4309 4237 Vector<std::pair<String, double>> animations; 4310 4238 4311 if (hasAnimations()) { 4312 for (auto it : m_animations->runningAnimations) { 4313 auto& propertyAnimations = it.value; 4314 size_t numAnimations = propertyAnimations.size(); 4315 for (size_t i = 0; i < numAnimations; ++i) { 4316 const LayerPropertyAnimation& currAnimation = propertyAnimations[i]; 4317 auto caAnimation = animatedLayer(currAnimation.m_property)->animationForKey(animationIdentifier(currAnimation.m_name, currAnimation.m_property, currAnimation.m_index, currAnimation.m_subIndex)); 4318 animations.append({ animatedPropertyIDAsString(currAnimation.m_property), caAnimation->speed() }); 4319 } 4320 } 4239 for (auto& animation : m_animations) { 4240 auto caAnimation = animatedLayer(animation.m_property)->animationForKey(animation.animationIdentifier()); 4241 animations.append({ animatedPropertyIDAsString(animation.m_property), caAnimation->speed() }); 4321 4242 } 4322 4243 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r266342 r268483 184 184 WEBCORE_EXPORT void setOpacityInternal(float) override; 185 185 186 WEBCORE_EXPORT bool animationCanBeAccelerated(const KeyframeValueList&, const Animation*) const;187 188 186 private: 189 187 bool isGraphicsLayerCA() const override { return true; } … … 276 274 WEBCORE_EXPORT bool backingStoreAttachedForTesting() const override; 277 275 278 bool hasAnimations() const { return m_animations.get(); } 279 bool animationIsRunning(const String& animationName) const 280 { 281 return m_animations && m_animations->runningAnimations.contains(animationName); 282 } 276 bool hasAnimations() const { return !m_animations.isEmpty(); } 277 bool animationIsRunning(const String& animationName) const; 283 278 284 279 void commitLayerChangesBeforeSublayers(CommitState&, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool& layerTypeChanged); … … 453 448 bool ensureStructuralLayer(StructuralLayerPurpose); 454 449 StructuralLayerPurpose structuralLayerPurpose() const; 455 456 void ensureLayerAnimations();457 458 void setAnimationOnLayer(PlatformCAAnimation&, AnimatedPropertyID, const String& animationName, int index, int subIndex, Seconds timeOffset);459 bool removeCAAnimationFromLayer(AnimatedPropertyID, const String& animationName, int index, int subINdex);460 void pauseCAAnimationOnLayer(AnimatedPropertyID, const String& animationName, int index, int subIndex, Seconds timeOffset);461 462 enum MoveOrCopy { Move, Copy };463 static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer);464 void moveOrCopyAnimations(MoveOrCopy, PlatformCALayer* fromLayer, PlatformCALayer* toLayer);465 466 void moveAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer)467 {468 moveOrCopyAnimations(Move, fromLayer, toLayer);469 }470 void copyAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer)471 {472 moveOrCopyAnimations(Copy, fromLayer, toLayer);473 }474 450 475 451 // This represents the animation of a single property. There may be multiple transform animations for 476 452 // a single transition or keyframe animation, so index is used to distinguish these. 453 enum class PlayState { Playing, PlayPending, Paused, PausePending }; 477 454 struct LayerPropertyAnimation { 478 455 LayerPropertyAnimation(Ref<PlatformCAAnimation>&& caAnimation, const String& animationName, AnimatedPropertyID property, int index, int subIndex, Seconds timeOffset) … … 485 462 { } 486 463 464 String animationIdentifier() const { return makeString(m_name, '_', static_cast<unsigned>(m_property), '_', m_index, '_', m_subIndex); } 465 487 466 RefPtr<PlatformCAAnimation> m_animation; 488 467 String m_name; … … 490 469 int m_index; 491 470 int m_subIndex; 492 Seconds m_timeOffset; 471 Seconds m_timeOffset { 0_s }; 472 Seconds m_beginTime { 0_s }; 473 PlayState m_playState { PlayState::PlayPending }; 474 bool m_pendingRemoval { false }; 493 475 }; 476 477 void setAnimationOnLayer(LayerPropertyAnimation&); 478 bool removeCAAnimationFromLayer(LayerPropertyAnimation&); 479 void pauseCAAnimationOnLayer(LayerPropertyAnimation&); 480 481 enum MoveOrCopy { Move, Copy }; 482 static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer); 483 void moveOrCopyAnimations(MoveOrCopy, PlatformCALayer* fromLayer, PlatformCALayer* toLayer); 484 485 void moveAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer) 486 { 487 moveOrCopyAnimations(Move, fromLayer, toLayer); 488 } 489 void copyAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer) 490 { 491 moveOrCopyAnimations(Copy, fromLayer, toLayer); 492 } 494 493 495 494 bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const FloatSize& boxSize, int animationIndex, Seconds timeOffset, bool isMatrixAnimation); 496 495 bool appendToUncommittedAnimations(const KeyframeValueList&, const FilterOperation*, const Animation*, const String& animationName, int animationIndex, Seconds timeOffset); 497 void appendToUncommittedAnimations(LayerPropertyAnimation&&);498 void removeFromUncommittedAnimations(const String&);499 496 500 497 enum LayerChange : uint64_t { … … 560 557 void repaintLayerDirtyRects(); 561 558 562 enum Action { Remove, Pause };563 struct AnimationProcessingAction {564 AnimationProcessingAction(Action action = Remove, Seconds timeOffset = 0_s)565 : action(action)566 , timeOffset(timeOffset)567 {568 }569 Action action;570 Seconds timeOffset; // Only used for pause.571 };572 void addProcessingActionForAnimation(const String&, AnimationProcessingAction);573 574 559 LayerChangeFlags m_uncommittedChanges { 0 }; 575 560 … … 612 597 RetainPtr<CGImageRef> m_pendingContentsImage; 613 598 614 typedef HashMap<String, Vector<AnimationProcessingAction>> AnimationsToProcessMap; 615 typedef HashMap<String, Vector<LayerPropertyAnimation>> AnimationsMap; 616 struct LayerAnimations { 617 WTF_MAKE_STRUCT_FAST_ALLOCATED; 618 Vector<LayerPropertyAnimation> uncomittedAnimations; 619 AnimationsToProcessMap animationsToProcess; 620 AnimationsMap runningAnimations; 621 }; 622 623 std::unique_ptr<LayerAnimations> m_animations; 599 Vector<LayerPropertyAnimation> m_animations; 624 600 625 601 Vector<FloatRect> m_dirtyRects;
Note: See TracChangeset
for help on using the changeset viewer.