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 23 matching lines...) Expand all Loading... |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/animation/EffectModel.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/Allocator.h" | 38 #include "wtf/Allocator.h" |
39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class Animation; | 43 class Animation; |
| 44 class CompositorAnimation; |
44 class Element; | 45 class Element; |
45 class FloatBox; | 46 class FloatBox; |
| 47 class KeyframeEffectModelBase; |
46 | 48 |
47 class CORE_EXPORT CompositorAnimations { | 49 class CORE_EXPORT CompositorAnimations { |
48 USING_FAST_MALLOC(CompositorAnimations); | 50 STATIC_ONLY(CompositorAnimations); |
49 WTF_MAKE_NONCOPYABLE(CompositorAnimations); | |
50 public: | 51 public: |
51 static CompositorAnimations* instance() { return instance(0); } | |
52 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta
nce(newInstance); } | |
53 static bool isCompositableProperty(CSSPropertyID); | 52 static bool isCompositableProperty(CSSPropertyID); |
54 static const CSSPropertyID compositableProperties[7]; | 53 static const CSSPropertyID compositableProperties[7]; |
55 | 54 |
56 virtual bool isCandidateForAnimationOnCompositor(const Timing&, const Elemen
t&, const Animation*, const EffectModel&, double animationPlaybackRate); | 55 static bool isCandidateForAnimationOnCompositor(const Timing&, const Element
&, const Animation*, const EffectModel&, double animationPlaybackRate); |
57 virtual void cancelIncompatibleAnimationsOnCompositor(const Element&, const
Animation&, const EffectModel&); | 56 static void cancelIncompatibleAnimationsOnCompositor(const Element&, const A
nimation&, const EffectModel&); |
58 virtual bool canStartAnimationOnCompositor(const Element&); | 57 static bool canStartAnimationOnCompositor(const Element&); |
59 virtual void startAnimationOnCompositor(const Element&, int group, double st
artTime, double timeOffset, const Timing&, const Animation&, const EffectModel&,
Vector<int>& startedAnimationIds, double animationPlaybackRate); | 58 static void startAnimationOnCompositor(const Element&, int group, double sta
rtTime, double timeOffset, const Timing&, const Animation&, const EffectModel&,
Vector<int>& startedAnimationIds, double animationPlaybackRate); |
60 virtual void cancelAnimationOnCompositor(const Element&, const Animation&, i
nt id); | 59 static void cancelAnimationOnCompositor(const Element&, const Animation&, in
t id); |
61 virtual void pauseAnimationForTestingOnCompositor(const Element&, const Anim
ation&, int id, double pauseTime); | 60 static void pauseAnimationForTestingOnCompositor(const Element&, const Anima
tion&, int id, double pauseTime); |
62 | 61 |
63 virtual bool canAttachCompositedLayers(const Element&, const Animation&); | 62 static bool canAttachCompositedLayers(const Element&, const Animation&); |
64 virtual void attachCompositedLayers(const Element&, const Animation&); | 63 static void attachCompositedLayers(const Element&, const Animation&); |
65 | 64 |
66 virtual bool getAnimatedBoundingBox(FloatBox&, const EffectModel&, double mi
nValue, double maxValue) const; | 65 static bool getAnimatedBoundingBox(FloatBox&, const EffectModel&, double min
Value, double maxValue); |
67 | 66 |
68 protected: | 67 struct CompositorTiming { |
69 CompositorAnimations(); | 68 Timing::PlaybackDirection direction; |
| 69 double scaledDuration; |
| 70 double scaledTimeOffset; |
| 71 double adjustedIterationCount; |
| 72 double playbackRate; |
| 73 Timing::FillMode fillMode; |
| 74 double iterationStart; |
| 75 }; |
70 | 76 |
71 private: | 77 static bool convertTimingForCompositor(const Timing&, double timeOffset, Com
positorTiming& out, double animationPlaybackRate); |
72 static CompositorAnimations* instance(CompositorAnimations* newInstance); | 78 |
| 79 static void getAnimationOnCompositor(const Timing&, int group, double startT
ime, double timeOffset, const KeyframeEffectModelBase&, Vector<OwnPtr<Compositor
Animation>>& animations, double animationPlaybackRate); |
73 }; | 80 }; |
74 | 81 |
75 } // namespace blink | 82 } // namespace blink |
76 | 83 |
77 #endif | 84 #endif |
OLD | NEW |