| Index: Source/core/animation/css/CSSAnimations.h
|
| diff --git a/Source/core/animation/css/CSSAnimations.h b/Source/core/animation/css/CSSAnimations.h
|
| index c2e1227fa7459f3b90d783fd6d6b3344f27ffd77..0853351dc7bed7f0ee257338580bb6cbbf8f338d 100644
|
| --- a/Source/core/animation/css/CSSAnimations.h
|
| +++ b/Source/core/animation/css/CSSAnimations.h
|
| @@ -44,9 +44,9 @@
|
|
|
| namespace WebCore {
|
|
|
| -class CSSAnimationDataList;
|
| +class CandidateTransition;
|
| class Element;
|
| -class RenderObject;
|
| +class StylePropertyShorthand;
|
| class StyleResolver;
|
|
|
| // Applied to scopes where an animation update will be added as pending and should then be applied (eg. Element style recalc).
|
| @@ -68,19 +68,49 @@ 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); }
|
| 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, const AnimatableValue* from, const AnimatableValue* to, PassRefPtr<InertAnimation> animation)
|
| + {
|
| + NewTransition newTransition;
|
| + newTransition.id = id;
|
| + newTransition.from = from;
|
| + newTransition.to = to;
|
| + newTransition.animation = animation;
|
| + m_newTransitions.append(newTransition);
|
| + }
|
| + void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.add(id); }
|
| +
|
| struct NewAnimation {
|
| AtomicString name;
|
| HashSet<RefPtr<InertAnimation> > animations;
|
| };
|
| const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; }
|
| const Vector<AtomicString>& cancelledAnimationNames() const { return m_cancelledAnimationNames; }
|
| +
|
| + struct NewTransition {
|
| + CSSPropertyID id;
|
| + const AnimatableValue* from;
|
| + const AnimatableValue* to;
|
| + RefPtr<InertAnimation> animation;
|
| + };
|
| + const Vector<NewTransition>& newTransitions() const { return m_newTransitions; }
|
| + const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancelledTransitions; }
|
| +
|
| + bool isEmpty() const
|
| + {
|
| + return m_newAnimations.isEmpty()
|
| + && m_cancelledAnimationNames.isEmpty()
|
| + && m_cancelledAnimationPlayers.isEmpty()
|
| + && m_newTransitions.isEmpty()
|
| + && m_cancelledTransitions.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 +119,22 @@ private:
|
| Vector<NewAnimation> m_newAnimations;
|
| Vector<AtomicString> m_cancelledAnimationNames;
|
| HashSet<const Player*> m_cancelledAnimationPlayers;
|
| +
|
| + Vector<NewTransition> m_newTransitions;
|
| + HashSet<CSSPropertyID> m_cancelledTransitions;
|
| };
|
|
|
| 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 StylePropertyShorthand& 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*);
|
| +
|
| 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 +142,23 @@ 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;
|
| + struct RunningTransition {
|
| + RefPtr<Player> player;
|
| + const AnimatableValue* from;
|
| + const AnimatableValue* to;
|
| + };
|
| + typedef HashMap<CSSPropertyID, RunningTransition > TransitionMap;
|
| AnimationMap m_animations;
|
| + TransitionMap m_transitions;
|
| OwnPtr<CSSAnimationUpdate> m_pendingUpdate;
|
| - class EventDelegate FINAL : public TimedItem::EventDelegate {
|
| +
|
| + static void calculateAnimationUpdate(CSSAnimationUpdate*, Element*, const RenderStyle*, StyleResolver*);
|
| + static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, const RenderStyle*);
|
| + static void calculateTransitionUpdateForProperty(CSSAnimationUpdate*, CSSPropertyID, const CandidateTransition&, const TransitionMap*);
|
| +
|
| + 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 +169,19 @@ private:
|
| Element* m_target;
|
| const AtomicString m_name;
|
| };
|
| +
|
| + class TransitionEventDelegate FINAL : public TimedItem::EventDelegate {
|
| + public:
|
| + TransitionEventDelegate(Element* target, CSSPropertyID property)
|
| + : m_target(target)
|
| + , m_property(property)
|
| + {
|
| + }
|
| + virtual void onEventCondition(const TimedItem*, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration) OVERRIDE;
|
| + private:
|
| + Element* m_target;
|
| + const CSSPropertyID m_property;
|
| + };
|
| };
|
|
|
| } // namespace WebCore
|
|
|