Chromium Code Reviews| Index: Source/core/animation/css/CSSAnimations.h |
| diff --git a/Source/core/animation/css/CSSAnimations.h b/Source/core/animation/css/CSSAnimations.h |
| index 3d935a0392a9dd78270de333d48ef9cb5020609f..cb3a9d8c088a4f7e5599d1e85f23b40edec34ed4 100644 |
| --- a/Source/core/animation/css/CSSAnimations.h |
| +++ b/Source/core/animation/css/CSSAnimations.h |
| @@ -36,6 +36,7 @@ |
| #include "core/animation/InertAnimation.h" |
| #include "core/animation/Interpolation.h" |
| #include "core/animation/css/CSSAnimationData.h" |
| +#include "core/css/CSSKeyframesRule.h" |
| #include "core/css/StylePropertySet.h" |
| #include "core/dom/Document.h" |
| #include "core/rendering/style/RenderStyleConstants.h" |
| @@ -49,18 +50,20 @@ class CSSTransitionData; |
| class Element; |
| class StylePropertyShorthand; |
| class StyleResolver; |
| -class StyleRuleKeyframes; |
| // This class stores the CSS Animations/Transitions information we use during a style recalc. |
| // This includes updates to animations/transitions as well as the Interpolations to be applied. |
| class CSSAnimationUpdate final : public NoBaseWillBeGarbageCollectedFinalized<CSSAnimationUpdate> { |
| public: |
| - void startAnimation(const AtomicString& animationName, PassRefPtrWillBeRawPtr<InertAnimation> animation) |
| + void startAnimation(const AtomicString& animationName, PassRefPtrWillBeRawPtr<InertAnimation> animation, const Timing& timing, PassRefPtrWillBeRawPtr<StyleRuleKeyframes> styleRule) |
| { |
| animation->setName(animationName); |
| NewAnimation newAnimation; |
| newAnimation.name = animationName; |
| newAnimation.animation = animation; |
| + newAnimation.timing = timing; |
| + newAnimation.styleChangeCounter = styleRule->styleChangeCounter(); |
| + newAnimation.styleRule = styleRule; |
| m_newAnimations.append(newAnimation); |
| } |
| // Returns whether player has been suppressed and should be filtered during style application. |
| @@ -74,13 +77,16 @@ public: |
| { |
| m_animationsWithPauseToggled.append(name); |
| } |
| - void updateAnimationTiming(AnimationPlayer* player, PassRefPtrWillBeRawPtr<InertAnimation> animation, const Timing& timing) |
| + void updateAnimation(const AtomicString& name, AnimationPlayer* player, PassRefPtrWillBeRawPtr<InertAnimation> animation, const Timing& specifiedTiming, PassRefPtrWillBeRawPtr<StyleRuleKeyframes> styleRule) |
| { |
| - UpdatedAnimationTiming updatedAnimation; |
| + UpdatedAnimation updatedAnimation; |
| + updatedAnimation.name = name; |
| updatedAnimation.player = player; |
| updatedAnimation.animation = animation; |
| - updatedAnimation.newTiming = timing; |
| - m_animationsWithTimingUpdates.append(updatedAnimation); |
| + updatedAnimation.specifiedTiming = specifiedTiming; |
|
shans
2015/01/14 00:26:19
just 'timing' for consistency with InertAnimations
shend
2015/01/14 00:42:04
The 'timing' in InertAnimations isn't actually the
shans
2015/01/15 00:29:52
Could InertAnimations have the easing from the CSS
shend
2015/01/15 01:51:28
I originally talked to Sam about this, but we thou
|
| + updatedAnimation.styleChangeCounter = styleRule->styleChangeCounter(); |
| + updatedAnimation.styleRule = styleRule; |
| + m_animationsWithUpdates.append(updatedAnimation); |
| m_suppressedAnimationPlayers.add(player); |
| } |
| @@ -108,9 +114,12 @@ public: |
| AtomicString name; |
| RefPtrWillBeMember<InertAnimation> animation; |
| + Timing timing; |
| + RefPtrWillBeMember<StyleRuleKeyframes> styleRule; |
| + unsigned styleChangeCounter; |
| }; |
| - struct UpdatedAnimationTiming { |
| + struct UpdatedAnimation { |
| ALLOW_ONLY_INLINE_ALLOCATION(); |
| public: |
| void trace(Visitor* visitor) |
| @@ -119,16 +128,19 @@ public: |
| visitor->trace(animation); |
| } |
| + AtomicString name; |
| RawPtrWillBeMember<AnimationPlayer> player; |
| RefPtrWillBeMember<InertAnimation> animation; |
| - Timing newTiming; |
| + Timing specifiedTiming; |
| + RefPtrWillBeMember<StyleRuleKeyframes> styleRule; |
| + unsigned styleChangeCounter; |
| }; |
| const WillBeHeapVector<NewAnimation>& newAnimations() const { return m_newAnimations; } |
| const Vector<AtomicString>& cancelledAnimationNames() const { return m_cancelledAnimationNames; } |
| const WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>>& suppressedAnimationAnimationPlayers() const { return m_suppressedAnimationPlayers; } |
| const Vector<AtomicString>& animationsWithPauseToggled() const { return m_animationsWithPauseToggled; } |
| - const WillBeHeapVector<UpdatedAnimationTiming>& animationsWithTimingUpdates() const { return m_animationsWithTimingUpdates; } |
| + const WillBeHeapVector<UpdatedAnimation>& animationsWithUpdates() const { return m_animationsWithUpdates; } |
| struct NewTransition { |
| ALLOW_ONLY_INLINE_ALLOCATION(); |
| @@ -162,7 +174,7 @@ public: |
| && m_cancelledAnimationNames.isEmpty() |
| && m_suppressedAnimationPlayers.isEmpty() |
| && m_animationsWithPauseToggled.isEmpty() |
| - && m_animationsWithTimingUpdates.isEmpty() |
| + && m_animationsWithUpdates.isEmpty() |
| && m_newTransitions.isEmpty() |
| && m_cancelledTransitions.isEmpty() |
| && m_activeInterpolationsForAnimations.isEmpty() |
| @@ -180,7 +192,7 @@ private: |
| Vector<AtomicString> m_cancelledAnimationNames; |
| WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>> m_suppressedAnimationPlayers; |
| Vector<AtomicString> m_animationsWithPauseToggled; |
| - WillBeHeapVector<UpdatedAnimationTiming> m_animationsWithTimingUpdates; |
| + WillBeHeapVector<UpdatedAnimation> m_animationsWithUpdates; |
| NewTransitionMap m_newTransitions; |
| HashSet<CSSPropertyID> m_cancelledTransitions; |
| @@ -209,6 +221,20 @@ public: |
| void trace(Visitor*); |
| private: |
| + struct RunningAnimation { |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
| + public: |
| + void trace(Visitor* visitor) |
| + { |
| + visitor->trace(player); |
| + } |
| + |
| + RefPtrWillBeMember<AnimationPlayer> player; |
| + Timing specifiedTiming; |
| + RefPtrWillBeMember<StyleRuleKeyframes> styleRule; |
| + unsigned styleChangeCounter; |
| + }; |
| + |
| struct RunningTransition { |
| ALLOW_ONLY_INLINE_ALLOCATION(); |
| public: |
| @@ -224,7 +250,7 @@ private: |
| RawPtrWillBeMember<const AnimatableValue> to; |
| }; |
| - using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<AnimationPlayer>>; |
| + using AnimationMap = WillBeHeapHashMap<AtomicString, RunningAnimation>; |
| AnimationMap m_animations; |
| using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; |
| @@ -284,6 +310,6 @@ private: |
| } // namespace blink |
| WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::NewAnimation); |
| -WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::UpdatedAnimationTiming); |
| +WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::UpdatedAnimation); |
| #endif |