| 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> | 12 #include <memory> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class PropertyHandle; | 16 class PropertyHandle; |
| 17 | 17 |
| 18 // Represents an animation's effect between an adjacent pair of | 18 // Represents an animation's effect between an adjacent pair of |
| 19 // PropertySpecificKeyframes. | 19 // PropertySpecificKeyframes. |
| 20 class CORE_EXPORT Interpolation : public RefCounted<Interpolation> { | 20 class CORE_EXPORT Interpolation : public RefCounted<Interpolation> { |
| 21 WTF_MAKE_NONCOPYABLE(Interpolation); | 21 WTF_MAKE_NONCOPYABLE(Interpolation); |
| 22 | 22 |
| 23 public: | 23 public: |
| 24 virtual ~Interpolation(); | 24 virtual ~Interpolation() {} |
| 25 | 25 |
| 26 virtual void interpolate(int iteration, double fraction); | 26 virtual void interpolate(int iteration, double fraction) = 0; |
| 27 | 27 |
| 28 virtual bool isInvalidatableInterpolation() const { return false; } | 28 virtual bool isInvalidatableInterpolation() const { return false; } |
| 29 virtual bool isLegacyStyleInterpolation() const { return false; } | 29 virtual bool isLegacyStyleInterpolation() const { return false; } |
| 30 | 30 |
| 31 virtual PropertyHandle getProperty() const = 0; | 31 virtual PropertyHandle getProperty() const = 0; |
| 32 virtual bool dependsOnUnderlyingValue() const { return false; } | 32 virtual bool dependsOnUnderlyingValue() const { return false; } |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 const std::unique_ptr<InterpolableValue> m_start; | 35 Interpolation() {} |
| 36 const std::unique_ptr<InterpolableValue> m_end; | |
| 37 | 36 |
| 38 mutable double m_cachedFraction; | 37 virtual InterpolableValue* getCachedValueForTesting() const = 0; |
| 39 mutable int m_cachedIteration; | |
| 40 mutable std::unique_ptr<InterpolableValue> m_cachedValue; | |
| 41 | |
| 42 Interpolation(std::unique_ptr<InterpolableValue> start, | |
| 43 std::unique_ptr<InterpolableValue> end); | |
| 44 | |
| 45 private: | |
| 46 InterpolableValue* getCachedValueForTesting() const { | |
| 47 return m_cachedValue.get(); | |
| 48 } | |
| 49 | 38 |
| 50 friend class AnimationInterpolableValueTest; | 39 friend class AnimationInterpolableValueTest; |
| 51 friend class AnimationInterpolationEffectTest; | 40 friend class AnimationInterpolationEffectTest; |
| 52 friend class AnimationDoubleStyleInterpolationTest; | 41 friend class AnimationDoubleStyleInterpolationTest; |
| 53 friend class AnimationVisibilityStyleInterpolationTest; | 42 friend class AnimationVisibilityStyleInterpolationTest; |
| 54 }; | 43 }; |
| 55 | 44 |
| 56 using ActiveInterpolations = Vector<RefPtr<Interpolation>, 1>; | 45 using ActiveInterpolations = Vector<RefPtr<Interpolation>, 1>; |
| 57 | 46 |
| 58 } // namespace blink | 47 } // namespace blink |
| 59 | 48 |
| 60 #endif // Interpolation_h | 49 #endif // Interpolation_h |
| OLD | NEW |