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 21 matching lines...) Expand all Loading... |
32 #define CompositorAnimations_h | 32 #define CompositorAnimations_h |
33 | 33 |
34 #include "core/animation/Timing.h" | 34 #include "core/animation/Timing.h" |
35 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 class Element; | 39 class Element; |
40 class AnimationEffect; | 40 class AnimationEffect; |
41 | 41 |
| 42 // Given an input timing function between keyframe at 0 and keyframe at 1.0, we |
| 43 // need a timing function such that the behavior with the keyframes swapped is |
| 44 // equivalent to reversing time with the input timing function and keyframes. |
| 45 // This means flipping the timing function about x=0.5 and about y=0.5. |
| 46 // FIXME: Remove once the Compositor natively understands reversing time. |
| 47 class CompositorAnimationsTimingFunctionReverser { |
| 48 public: |
| 49 static PassRefPtr<TimingFunction> reverse(const LinearTimingFunction* timefu
nc); |
| 50 static PassRefPtr<TimingFunction> reverse(const CubicBezierTimingFunction* t
imefunc); |
| 51 static PassRefPtr<TimingFunction> reverse(const ChainedTimingFunction* timef
unc); |
| 52 static PassRefPtr<TimingFunction> reverse(const TimingFunction* timefunc); |
| 53 }; |
| 54 |
42 class CompositorAnimations { | 55 class CompositorAnimations { |
43 | 56 |
44 public: | 57 public: |
45 static CompositorAnimations* instance() { return instance(0); } | 58 static CompositorAnimations* instance() { return instance(0); } |
46 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta
nce(newInstance); } | 59 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta
nce(newInstance); } |
47 | 60 |
48 virtual bool isCandidateForCompositorAnimation(const Timing&, const Animatio
nEffect*); | 61 virtual bool isCandidateForCompositorAnimation(const Timing&, const Animatio
nEffect*); |
49 virtual bool canStartCompositorAnimation(const Element*); | 62 virtual bool canStartCompositorAnimation(const Element*); |
50 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); |
51 virtual void cancelCompositorAnimation(const Element*, int id); | 64 virtual void cancelCompositorAnimation(const Element*, int id); |
52 | 65 |
53 protected: | 66 protected: |
54 CompositorAnimations() { } | 67 CompositorAnimations() { } |
55 | 68 |
56 private: | 69 private: |
57 static CompositorAnimations* instance(CompositorAnimations* newInstance = 0) | 70 static CompositorAnimations* instance(CompositorAnimations* newInstance = 0) |
58 { | 71 { |
59 static CompositorAnimations* instance = new CompositorAnimations(); | 72 static CompositorAnimations* instance = new CompositorAnimations(); |
60 if (newInstance) { | 73 if (newInstance) { |
61 instance = newInstance; | 74 instance = newInstance; |
62 } | 75 } |
63 return instance; | 76 return instance; |
64 } | 77 } |
65 }; | 78 }; |
66 | 79 |
67 } // namespace WebCore | 80 } // namespace WebCore |
68 | 81 |
69 #endif | 82 #endif |
OLD | NEW |