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 65ae4dd0a60deb0cdfe75c3058a952bf96bcb82f..94c2f659b14762aa18d3f207df7cb2783d585e72 100644 |
| --- a/Source/core/animation/css/CSSAnimations.h |
| +++ b/Source/core/animation/css/CSSAnimations.h |
| @@ -68,19 +68,34 @@ public: |
| m_newAnimations.append(newAnimation); |
| } |
| // Returns whether player has been cancelled and should be filtered during style application. |
| - bool isCancelled(const Player* player) const { return m_cancelledAnimationPlayers.contains(player); } |
| + bool isCancelledAnimation(const Player* player) const { return m_cancelledAnimationPlayers.contains(player); } |
|
dstockwell
2013/10/08 21:02:59
Not sure why this was renamed. Shouldn't this also
Timothy Loh
2013/10/09 01:33:07
Transitions and animations are basically disjoint
|
| void cancelAnimation(const AtomicString& name, const HashSet<RefPtr<Player> >& players) |
| { |
| m_cancelledAnimationNames.append(name); |
| for (HashSet<RefPtr<Player> >::const_iterator iter = players.begin(); iter != players.end(); ++iter) |
| m_cancelledAnimationPlayers.add(iter->get()); |
| } |
| + |
| + void startTransition(CSSPropertyID id, PassRefPtr<InertAnimation> animation) { m_newTransitions.set(id, animation); } |
| + void endTransition(CSSPropertyID id) { m_endedTransitions.add(id); } |
|
dstockwell
2013/10/08 21:02:59
cancelTransition
Timothy Loh
2013/10/09 01:33:07
This is also used for transitions which finish nor
dstockwell
2013/10/09 21:03:51
I meant that this should just be called cancelTran
Timothy Loh
2013/10/10 02:10:19
Yeah, I see finishing transitions normally and fin
|
| + |
| struct NewAnimation { |
| AtomicString name; |
| HashSet<RefPtr<InertAnimation> > animations; |
| }; |
| const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; } |
| const Vector<AtomicString>& cancelledAnimationNames() const { return m_cancelledAnimationNames; } |
| + const HashMap<CSSPropertyID, RefPtr<InertAnimation> >& newTransitions() const { return m_newTransitions; } |
| + const HashSet<CSSPropertyID>& endedTransitions() const { return m_endedTransitions; } |
| + |
| + bool isEmpty() const |
| + { |
| + return m_newAnimations.isEmpty() |
| + && m_cancelledAnimationNames.isEmpty() |
| + && m_cancelledAnimationPlayers.isEmpty() |
| + && m_newTransitions.isEmpty() |
| + && m_endedTransitions.isEmpty(); |
| + } |
| private: |
| // Order is significant since it defines the order in which new animations |
| // will be started. Note that there may be multiple animations present |
| @@ -89,16 +104,23 @@ private: |
| Vector<NewAnimation> m_newAnimations; |
| Vector<AtomicString> m_cancelledAnimationNames; |
| HashSet<const Player*> m_cancelledAnimationPlayers; |
| + |
| + HashMap<CSSPropertyID, RefPtr<InertAnimation> > m_newTransitions; |
| + HashSet<CSSPropertyID> m_endedTransitions; |
| }; |
| class CSSAnimations FINAL { |
| public: |
| static bool isAnimatableProperty(CSSPropertyID); |
| - static bool needsUpdate(const Element*, const RenderStyle*); |
| - static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(Element*, const RenderStyle*, const CSSAnimations*, const CSSAnimationDataList*, StyleResolver*); |
| + static const Vector<CSSPropertyID>& animatableProperties(); |
| + // FIXME: This should take a const ScopedStyleTree instead of a StyleResolver. |
| + // We should also change the Element* to a const Element* |
| + static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(Element*, const RenderStyle*, StyleResolver*); |
| + static AnimationEffect::CompositableValueMap compositableValuesForTransitions(const CSSAnimations*, const CSSAnimationUpdate*); |
| + |
| void setPendingUpdate(PassOwnPtr<CSSAnimationUpdate> update) { m_pendingUpdate = update; } |
| void maybeApplyPendingUpdate(Element*); |
| - bool isEmpty() const { return m_animations.isEmpty() && !m_pendingUpdate; } |
| + bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpty() && !m_pendingUpdate; } |
| void cancel(); |
| private: |
| // Note that a single animation name may map to multiple players due to |
| @@ -106,11 +128,18 @@ private: |
| // FIXME: Once the Web Animations model supports groups, we could use a |
| // ParGroup to drive multiple animations from a single Player. |
| typedef HashMap<AtomicString, HashSet<RefPtr<Player> > > AnimationMap; |
| + typedef HashMap<CSSPropertyID, RefPtr<Player> > TransitionMap; |
| AnimationMap m_animations; |
| + TransitionMap m_transitions; |
| OwnPtr<CSSAnimationUpdate> m_pendingUpdate; |
| - class EventDelegate FINAL : public TimedItem::EventDelegate { |
| + |
| + static void updateAnimationUpdate(CSSAnimationUpdate*, Element*, const RenderStyle*, StyleResolver*); |
| + static void updateTransitionUpdate(CSSAnimationUpdate*, const Element*, const RenderStyle*); |
| + static void updateTransitionUpdate(CSSAnimationUpdate*, CSSPropertyID, const AnimatableValue* from, const AnimatableValue* to, const CSSAnimationData*, const TransitionMap* transitions); |
| + |
| + class AnimationEventDelegate FINAL : public TimedItem::EventDelegate { |
| public: |
| - EventDelegate(Element* target, const AtomicString& name) |
| + AnimationEventDelegate(Element* target, const AtomicString& name) |
| : m_target(target) |
| , m_name(name) |
| { |
| @@ -121,6 +150,19 @@ private: |
| Element* m_target; |
| const AtomicString m_name; |
| }; |
| + |
| + class TransitionEventDelegate FINAL : public TimedItem::EventDelegate { |
| + public: |
| + TransitionEventDelegate(Element* target, CSSPropertyID id) |
| + : m_target(target) |
| + , m_id(id) |
| + { |
| + } |
| + virtual void onEventCondition(const TimedItem*, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration) OVERRIDE; |
| + private: |
| + Element* m_target; |
| + const CSSPropertyID m_id; |
|
Steve Block
2013/10/09 00:57:12
Probably better to call this m_property or m_prope
Timothy Loh
2013/10/09 07:39:23
Done.
|
| + }; |
| }; |
| } // namespace WebCore |