Chromium Code Reviews| 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() OVERRIDE FINAL { return true; } | |
| 48 | 49 | 
| 49 const AnimationEffect::CompositableValueMap* compositableValues() const | 50 const AnimationEffect::CompositableValueMap* compositableValues() const | 
| 50 { | 51 { | 
| 51 ASSERT(m_compositableValues); | 52 ASSERT(m_compositableValues); | 
| 52 return m_compositableValues.get(); | 53 return m_compositableValues.get(); | 
| 53 } | 54 } | 
| 54 | 55 | 
| 56 bool affects(CSSPropertyID property) const; | |
| 55 const AnimationEffect* effect() const { return m_effect.get(); } | 57 const AnimationEffect* effect() const { return m_effect.get(); } | 
| 56 Priority priority() const { return m_priority; } | 58 Priority priority() const { return m_priority; } | 
| 57 | 59 | 
| 60 bool isCandidateForCompositorAnimation() const; | |
| 61 bool startCompositorAnimations(); | |
| 
 
shans
2013/11/18 01:02:06
startOnCompositor?
 
dstockwell
2013/11/18 05:30:34
Sounds good, but let's defer renaming until the en
 
 | |
| 62 bool isRunningCompositorAnimation(const Element* = 0, CSSPropertyID = CSSPro pertyInvalid) const; | |
| 
 
shans
2013/11/18 01:02:06
isRunningOnCompositor?
 
dstockwell
2013/11/18 05:30:34
Sounds good, but let's defer renaming until the en
 
 | |
| 63 void cancelCompositorAnimations(); | |
| 
 
shans
2013/11/18 01:02:06
Some comments about when these can be called would
 
dstockwell
2013/11/18 05:30:34
Done.
 
 | |
| 64 | |
| 58 protected: | 65 protected: | 
| 59 // Returns whether style recalc was triggered. | 66 // Returns whether style recalc was triggered. | 
| 60 virtual bool applyEffects(bool previouslyInEffect); | 67 virtual bool applyEffects(bool previouslyInEffect); | 
| 61 virtual void clearEffects(); | 68 virtual void clearEffects(); | 
| 62 virtual bool updateChildrenAndEffects() const OVERRIDE FINAL; | 69 virtual bool updateChildrenAndEffects() const OVERRIDE FINAL; | 
| 63 virtual void didAttach() OVERRIDE FINAL; | 70 virtual void didAttach() OVERRIDE FINAL; | 
| 64 virtual void willDetach() OVERRIDE FINAL; | 71 virtual void willDetach() OVERRIDE FINAL; | 
| 65 virtual double calculateTimeToEffectChange(double inheritedTime, double time ToNextIteration) const OVERRIDE FINAL; | 72 virtual double calculateTimeToEffectChange(double inheritedTime, double time ToNextIteration) const OVERRIDE FINAL; | 
| 66 | 73 | 
| 67 private: | 74 private: | 
| 68 Animation(PassRefPtr<Element>, PassRefPtr<AnimationEffect>, const Timing&, P riority, PassOwnPtr<EventDelegate>); | 75 Animation(PassRefPtr<Element>, PassRefPtr<AnimationEffect>, const Timing&, P riority, PassOwnPtr<EventDelegate>); | 
| 69 | 76 | 
| 70 RefPtr<Element> m_target; | 77 RefPtr<Element> m_target; | 
| 71 RefPtr<AnimationEffect> m_effect; | 78 RefPtr<AnimationEffect> m_effect; | 
| 72 | 79 | 
| 73 bool m_activeInAnimationStack; | 80 bool m_activeInAnimationStack; | 
| 74 OwnPtr<AnimationEffect::CompositableValueMap> m_compositableValues; | 81 OwnPtr<AnimationEffect::CompositableValueMap> m_compositableValues; | 
| 75 | 82 | 
| 76 Priority m_priority; | 83 Priority m_priority; | 
| 84 | |
| 85 Vector<int> m_acceleratedAnimationIds; | |
| 77 }; | 86 }; | 
| 78 | 87 | 
| 88 inline Animation* toAnimation(TimedItem* timedItem) | |
| 89 { | |
| 90 ASSERT_WITH_SECURITY_IMPLICATION(timedItem && timedItem->isAnimation()); | |
| 91 return static_cast<Animation*>(timedItem); | |
| 92 } | |
| 93 | |
| 79 } // namespace WebCore | 94 } // namespace WebCore | 
| 80 | 95 | 
| 81 #endif | 96 #endif | 
| OLD | NEW |