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