| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef CompositorAnimations_h | 31 #ifndef CompositorAnimations_h |
| 32 #define CompositorAnimations_h | 32 #define CompositorAnimations_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "core/animation/AnimationEffect.h" | 35 #include "core/animation/EffectModel.h" |
| 36 #include "core/animation/Timing.h" | 36 #include "core/animation/Timing.h" |
| 37 #include "platform/animation/TimingFunction.h" | 37 #include "platform/animation/TimingFunction.h" |
| 38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class AnimationPlayer; | 42 class Animation; |
| 43 class Element; | 43 class Element; |
| 44 class FloatBox; | 44 class FloatBox; |
| 45 | 45 |
| 46 class CORE_EXPORT CompositorAnimations { | 46 class CORE_EXPORT CompositorAnimations { |
| 47 public: | 47 public: |
| 48 static CompositorAnimations* instance() { return instance(0); } | 48 static CompositorAnimations* instance() { return instance(0); } |
| 49 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta
nce(newInstance); } | 49 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta
nce(newInstance); } |
| 50 static bool isCompositableProperty(CSSPropertyID property) { return property
== CSSPropertyOpacity || property == CSSPropertyTransform || property == CSSPro
pertyWebkitFilter; } | 50 static bool isCompositableProperty(CSSPropertyID property) { return property
== CSSPropertyOpacity || property == CSSPropertyTransform || property == CSSPro
pertyWebkitFilter; } |
| 51 static CSSPropertyID CompositableProperties[3]; | 51 static CSSPropertyID CompositableProperties[3]; |
| 52 | 52 |
| 53 virtual bool isCandidateForAnimationOnCompositor(const Timing&, const Elemen
t&, const AnimationPlayer*, const AnimationEffect&, double playerPlaybackRate); | 53 virtual bool isCandidateForAnimationOnCompositor(const Timing&, const Elemen
t&, const Animation*, const EffectModel&, double animationPlaybackRate); |
| 54 virtual void cancelIncompatibleAnimationsOnCompositor(const Element&, const
AnimationPlayer&, const AnimationEffect&); | 54 virtual void cancelIncompatibleAnimationsOnCompositor(const Element&, const
Animation&, const EffectModel&); |
| 55 virtual bool canStartAnimationOnCompositor(const Element&); | 55 virtual bool canStartAnimationOnCompositor(const Element&); |
| 56 // FIXME: This should return void. We should know ahead of time whether thes
e animations can be started. | 56 // FIXME: This should return void. We should know ahead of time whether thes
e animations can be started. |
| 57 virtual bool startAnimationOnCompositor(const Element&, int group, double st
artTime, double timeOffset, const Timing&, const AnimationPlayer&, const Animati
onEffect&, Vector<int>& startedAnimationIds, double playerPlaybackRate); | 57 virtual bool startAnimationOnCompositor(const Element&, int group, double st
artTime, double timeOffset, const Timing&, const Animation&, const EffectModel&,
Vector<int>& startedAnimationIds, double animationPlaybackRate); |
| 58 virtual void cancelAnimationOnCompositor(const Element&, const AnimationPlay
er&, int id); | 58 virtual void cancelAnimationOnCompositor(const Element&, const Animation&, i
nt id); |
| 59 virtual void pauseAnimationForTestingOnCompositor(const Element&, const Anim
ationPlayer&, int id, double pauseTime); | 59 virtual void pauseAnimationForTestingOnCompositor(const Element&, const Anim
ation&, int id, double pauseTime); |
| 60 | 60 |
| 61 virtual bool canAttachCompositedLayers(const Element&, const AnimationPlayer
&); | 61 virtual bool canAttachCompositedLayers(const Element&, const Animation&); |
| 62 virtual void attachCompositedLayers(const Element&, const AnimationPlayer&); | 62 virtual void attachCompositedLayers(const Element&, const Animation&); |
| 63 | 63 |
| 64 virtual bool getAnimatedBoundingBox(FloatBox&, const AnimationEffect&, doubl
e minValue, double maxValue) const; | 64 virtual bool getAnimatedBoundingBox(FloatBox&, const EffectModel&, double mi
nValue, double maxValue) const; |
| 65 protected: | 65 protected: |
| 66 CompositorAnimations() { } | 66 CompositorAnimations() { } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 static CompositorAnimations* instance(CompositorAnimations* newInstance) | 69 static CompositorAnimations* instance(CompositorAnimations* newInstance) |
| 70 { | 70 { |
| 71 static CompositorAnimations* instance = new CompositorAnimations(); | 71 static CompositorAnimations* instance = new CompositorAnimations(); |
| 72 if (newInstance) { | 72 if (newInstance) { |
| 73 instance = newInstance; | 73 instance = newInstance; |
| 74 } | 74 } |
| 75 return instance; | 75 return instance; |
| 76 } | 76 } |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace blink | 79 } // namespace blink |
| 80 | 80 |
| 81 #endif | 81 #endif |
| OLD | NEW |