OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef Interpolation_h | 5 #ifndef Interpolation_h |
6 #define Interpolation_h | 6 #define Interpolation_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/InterpolableValue.h" | 9 #include "core/animation/InterpolableValue.h" |
10 #include "wtf/Forward.h" | 10 #include "wtf/Forward.h" |
11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
12 #include <memory> | |
13 | 12 |
14 namespace blink { | 13 namespace blink { |
15 | 14 |
16 class PropertyHandle; | 15 class PropertyHandle; |
17 | 16 |
18 // Represents an animation's effect between an adjacent pair of PropertySpecific
Keyframes. | 17 // Represents an animation's effect between an adjacent pair of PropertySpecific
Keyframes. |
19 class CORE_EXPORT Interpolation : public RefCounted<Interpolation> { | 18 class CORE_EXPORT Interpolation : public RefCounted<Interpolation> { |
20 WTF_MAKE_NONCOPYABLE(Interpolation); | 19 WTF_MAKE_NONCOPYABLE(Interpolation); |
21 public: | 20 public: |
22 virtual ~Interpolation(); | 21 virtual ~Interpolation(); |
23 | 22 |
24 virtual void interpolate(int iteration, double fraction); | 23 virtual void interpolate(int iteration, double fraction); |
25 | 24 |
26 virtual bool isStyleInterpolation() const { return false; } | 25 virtual bool isStyleInterpolation() const { return false; } |
27 virtual bool isInvalidatableInterpolation() const { return false; } | 26 virtual bool isInvalidatableInterpolation() const { return false; } |
28 virtual bool isLegacyStyleInterpolation() const { return false; } | 27 virtual bool isLegacyStyleInterpolation() const { return false; } |
29 | 28 |
30 virtual PropertyHandle getProperty() const = 0; | 29 virtual PropertyHandle getProperty() const = 0; |
31 virtual bool dependsOnUnderlyingValue() const { return false; } | 30 virtual bool dependsOnUnderlyingValue() const { return false; } |
32 | 31 |
33 protected: | 32 protected: |
34 const std::unique_ptr<InterpolableValue> m_start; | 33 const OwnPtr<InterpolableValue> m_start; |
35 const std::unique_ptr<InterpolableValue> m_end; | 34 const OwnPtr<InterpolableValue> m_end; |
36 | 35 |
37 mutable double m_cachedFraction; | 36 mutable double m_cachedFraction; |
38 mutable int m_cachedIteration; | 37 mutable int m_cachedIteration; |
39 mutable std::unique_ptr<InterpolableValue> m_cachedValue; | 38 mutable OwnPtr<InterpolableValue> m_cachedValue; |
40 | 39 |
41 Interpolation(std::unique_ptr<InterpolableValue> start, std::unique_ptr<Inte
rpolableValue> end); | 40 Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableVa
lue> end); |
42 | 41 |
43 private: | 42 private: |
44 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } | 43 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } |
45 | 44 |
46 friend class AnimationInterpolableValueTest; | 45 friend class AnimationInterpolableValueTest; |
47 friend class AnimationInterpolationEffectTest; | 46 friend class AnimationInterpolationEffectTest; |
48 friend class AnimationDoubleStyleInterpolationTest; | 47 friend class AnimationDoubleStyleInterpolationTest; |
49 friend class AnimationVisibilityStyleInterpolationTest; | 48 friend class AnimationVisibilityStyleInterpolationTest; |
50 }; | 49 }; |
51 | 50 |
52 using ActiveInterpolations = Vector<RefPtr<Interpolation>, 1>; | 51 using ActiveInterpolations = Vector<RefPtr<Interpolation>, 1>; |
53 | 52 |
54 } // namespace blink | 53 } // namespace blink |
55 | 54 |
56 #endif // Interpolation_h | 55 #endif // Interpolation_h |
OLD | NEW |