Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: Source/core/animation/CompositorAnimations.h

Issue 68173013: Web Animations CSS: More cleaning of new CompositorAnimation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/animation/AnimationEffect.h" 34 #include "core/animation/AnimationEffect.h"
35 #include "core/animation/KeyframeAnimationEffect.h"
36 #include "core/animation/Timing.h" 35 #include "core/animation/Timing.h"
37 #include "core/platform/animation/TimingFunction.h" 36 #include "core/platform/animation/TimingFunction.h"
38 #include "public/platform/WebAnimation.h"
39 #include "public/platform/WebAnimationCurve.h"
40 #include "public/platform/WebCompositorSupport.h"
41 #include "public/platform/WebFilterAnimationCurve.h"
42 #include "public/platform/WebFilterKeyframe.h"
43 #include "public/platform/WebFilterOperations.h"
44 #include "public/platform/WebFloatAnimationCurve.h"
45 #include "public/platform/WebFloatKeyframe.h"
46 #include "public/platform/WebTransformAnimationCurve.h"
47 #include "public/platform/WebTransformKeyframe.h"
48 #include "public/platform/WebTransformOperations.h"
49 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
50 38
51 namespace WebCore { 39 namespace WebCore {
52 40
53 class Element; 41 class Element;
54 class AnimationEffect;
55 42
56 // Given an input timing function between keyframe at 0 and keyframe at 1.0, we 43 // Given an input timing function between keyframe at 0 and keyframe at 1.0, we
57 // need a timing function such that the behavior with the keyframes swapped is 44 // need a timing function such that the behavior with the keyframes swapped is
58 // equivalent to reversing time with the input timing function and keyframes. 45 // equivalent to reversing time with the input timing function and keyframes.
59 // This means flipping the timing function about x=0.5 and about y=0.5. 46 // This means flipping the timing function about x=0.5 and about y=0.5.
60 // FIXME: Remove once the Compositor natively understands reversing time. 47 // FIXME: Remove once the Compositor natively understands reversing time.
61 class CompositorAnimationsTimingFunctionReverser { 48 class CompositorAnimationsTimingFunctionReverser {
62 public: 49 public:
63 static PassRefPtr<TimingFunction> reverse(const LinearTimingFunction* timefu nc); 50 static PassRefPtr<TimingFunction> reverse(const LinearTimingFunction* timefu nc);
64 static PassRefPtr<TimingFunction> reverse(const CubicBezierTimingFunction* t imefunc); 51 static PassRefPtr<TimingFunction> reverse(const CubicBezierTimingFunction* t imefunc);
65 static PassRefPtr<TimingFunction> reverse(const ChainedTimingFunction* timef unc); 52 static PassRefPtr<TimingFunction> reverse(const ChainedTimingFunction* timef unc);
66 static PassRefPtr<TimingFunction> reverse(const TimingFunction* timefunc); 53 static PassRefPtr<TimingFunction> reverse(const TimingFunction* timefunc);
67 }; 54 };
68 55
69 class CompositorAnimations { 56 class CompositorAnimations {
70 public: 57 public:
71 static CompositorAnimations* instance() { return instance(0); } 58 static CompositorAnimations* instance() { return instance(0); }
72 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta nce(newInstance); } 59 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta nce(newInstance); }
73 60
74 virtual bool isCandidateForCompositorAnimation(const Timing&, const Animatio nEffect&); 61 virtual bool isCandidateForCompositorAnimation(const Timing&, const Animatio nEffect&);
75 virtual bool canStartCompositorAnimation(const Element&); 62 virtual bool canStartCompositorAnimation(const Element&);
76 virtual void startCompositorAnimation(const Element&, const Timing&, const A nimationEffect&, Vector<int>& startedAnimationIds); 63 virtual void startCompositorAnimation(const Element&, const Timing&, const A nimationEffect&, Vector<int>& startedAnimationIds);
77 virtual void cancelCompositorAnimation(const Element&, int id); 64 virtual void cancelCompositorAnimation(const Element&, int id);
78 65
79 protected: 66 protected:
80 CompositorAnimations() { } 67 CompositorAnimations() { }
68
69 private:
81 static CompositorAnimations* instance(CompositorAnimations* newInstance) 70 static CompositorAnimations* instance(CompositorAnimations* newInstance)
82 { 71 {
83 static CompositorAnimations* instance = new CompositorAnimations(); 72 static CompositorAnimations* instance = new CompositorAnimations();
84 if (newInstance) { 73 if (newInstance) {
85 instance = newInstance; 74 instance = newInstance;
86 } 75 }
87 return instance; 76 return instance;
88 } 77 }
89 }; 78 };
90 79
91 } // namespace WebCore 80 } // namespace WebCore
92 81
93 #endif 82 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/CompositorAnimations.cpp » ('j') | Source/core/animation/CompositorAnimations.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698