| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 class Element; | 40 class Element; |
| 41 | 41 |
| 42 class Animation FINAL : public TimedItem { | 42 class Animation FINAL : public TimedItem { |
| 43 | 43 |
| 44 public: | 44 public: |
| 45 enum Priority { DefaultPriority, TransitionPriority }; | 45 enum Priority { DefaultPriority, TransitionPriority }; |
| 46 | 46 |
| 47 static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtr<Animatio
nEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<EventDelegate> =
nullptr); | 47 static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtr<Animatio
nEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<EventDelegate> =
nullptr); |
| 48 virtual bool isAnimation() const OVERRIDE FINAL { return true; } | 48 virtual bool isAnimation() const OVERRIDE { return true; } |
| 49 | 49 |
| 50 const AnimationEffect::CompositableValueList* compositableValues() const | 50 const AnimationEffect::CompositableValueList* compositableValues() const |
| 51 { | 51 { |
| 52 ASSERT(m_compositableValues); | 52 ASSERT(m_compositableValues); |
| 53 return m_compositableValues.get(); | 53 return m_compositableValues.get(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool affects(CSSPropertyID) const; | 56 bool affects(CSSPropertyID) const; |
| 57 const AnimationEffect* effect() const { return m_effect.get(); } | 57 const AnimationEffect* effect() const { return m_effect.get(); } |
| 58 Priority priority() const { return m_priority; } | 58 Priority priority() const { return m_priority; } |
| 59 Element* target() { return m_target.get(); } | 59 Element* target() { return m_target.get(); } |
| 60 | 60 |
| 61 bool isCandidateForAnimationOnCompositor() const; | 61 bool isCandidateForAnimationOnCompositor() const; |
| 62 // Must only be called once and assumes to be part of a player without a sta
rt time. | 62 // Must only be called once and assumes to be part of a player without a sta
rt time. |
| 63 bool maybeStartAnimationOnCompositor(); | 63 bool maybeStartAnimationOnCompositor(); |
| 64 bool hasActiveAnimationsOnCompositor() const; | 64 bool hasActiveAnimationsOnCompositor() const; |
| 65 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | 65 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
| 66 void cancelAnimationOnCompositor(); | 66 void cancelAnimationOnCompositor(); |
| 67 void pauseAnimationForTestingOnCompositor(double pauseTime); | 67 void pauseAnimationForTestingOnCompositor(double pauseTime); |
| 68 | 68 |
| 69 protected: | 69 protected: |
| 70 // Returns whether style recalc was triggered. | 70 // Returns whether style recalc was triggered. |
| 71 virtual bool applyEffects(bool previouslyInEffect); | 71 bool applyEffects(bool previouslyInEffect); |
| 72 virtual void clearEffects(); | 72 void clearEffects(); |
| 73 virtual bool updateChildrenAndEffects() const OVERRIDE FINAL; | 73 virtual bool updateChildrenAndEffects() const OVERRIDE; |
| 74 virtual void didAttach() OVERRIDE FINAL; | 74 virtual void didAttach() OVERRIDE; |
| 75 virtual void willDetach() OVERRIDE FINAL; | 75 virtual void willDetach() OVERRIDE; |
| 76 virtual double calculateTimeToEffectChange(double inheritedTime, double time
ToNextIteration) const OVERRIDE FINAL; | 76 virtual double calculateTimeToEffectChange(double inheritedTime, double time
ToNextIteration) const OVERRIDE; |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 Animation(PassRefPtr<Element>, PassRefPtr<AnimationEffect>, const Timing&, P
riority, PassOwnPtr<EventDelegate>); | 79 Animation(PassRefPtr<Element>, PassRefPtr<AnimationEffect>, const Timing&, P
riority, PassOwnPtr<EventDelegate>); |
| 80 | 80 |
| 81 RefPtr<Element> m_target; | 81 RefPtr<Element> m_target; |
| 82 RefPtr<AnimationEffect> m_effect; | 82 RefPtr<AnimationEffect> m_effect; |
| 83 | 83 |
| 84 bool m_activeInAnimationStack; | 84 bool m_activeInAnimationStack; |
| 85 OwnPtr<AnimationEffect::CompositableValueList> m_compositableValues; | 85 OwnPtr<AnimationEffect::CompositableValueList> m_compositableValues; |
| 86 | 86 |
| 87 Priority m_priority; | 87 Priority m_priority; |
| 88 | 88 |
| 89 Vector<int> m_compositorAnimationIds; | 89 Vector<int> m_compositorAnimationIds; |
| 90 | 90 |
| 91 friend class CSSAnimations; | 91 friend class CSSAnimations; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); | 94 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); |
| 95 | 95 |
| 96 } // namespace WebCore | 96 } // namespace WebCore |
| 97 | 97 |
| 98 #endif | 98 #endif |
| OLD | NEW |