Chromium Code Reviews| 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/animation/AnimationEffect.h" | |
| 8 #include "core/animation/InterpolableValue.h" | 9 #include "core/animation/InterpolableValue.h" |
| 9 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 class Interpolation : public RefCountedWillBeGarbageCollectedFinalized<Interpola tion> { | 14 class Interpolation : public RefCountedWillBeGarbageCollectedFinalized<Interpola tion> { |
| 14 public: | 15 public: |
| 15 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end) | 16 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end) |
| 16 { | 17 { |
| 17 return adoptRefWillBeNoop(new Interpolation(start, end)); | 18 return adoptRefWillBeNoop(new Interpolation(start, end)); |
| 18 } | 19 } |
| 19 | 20 |
| 20 virtual ~Interpolation(); | 21 virtual ~Interpolation(); |
| 21 | 22 |
| 23 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end, | |
| 24 AnimationEffect::CompositeOperation compositeStart, AnimationEffect::Com positeOperation compositeEnd) | |
| 25 { | |
| 26 return adoptRefWillBeNoop(new Interpolation(start, end, compositeStart, compositeEnd)); | |
| 27 } | |
| 28 | |
| 22 void interpolate(int iteration, double fraction) const; | 29 void interpolate(int iteration, double fraction) const; |
| 23 | 30 |
| 31 const InterpolableValue& cachedValue() const { return *m_cachedValue.get(); } | |
| 32 double cachedUnderlyingFraction() const { return m_cachedUnderlyingFraction; } | |
| 33 | |
| 34 bool isReplaceOnly() const { return m_compositeStart == AnimationEffect::Com positeReplace && m_compositeEnd == AnimationEffect::CompositeReplace; } | |
|
alancutter (OOO until 2018)
2015/02/12 05:55:45
We want to just check for UF == 0. Let's not have
| |
| 35 | |
| 24 virtual bool isStyleInterpolation() const { return false; } | 36 virtual bool isStyleInterpolation() const { return false; } |
| 25 virtual bool isLegacyStyleInterpolation() const { return false; } | 37 virtual bool isLegacyStyleInterpolation() const { return false; } |
| 26 | 38 |
| 27 virtual void trace(Visitor*); | 39 virtual void trace(Visitor*); |
| 28 | 40 |
| 29 protected: | 41 protected: |
| 30 const OwnPtrWillBeMember<InterpolableValue> m_start; | 42 const OwnPtrWillBeMember<InterpolableValue> m_start; |
| 31 const OwnPtrWillBeMember<InterpolableValue> m_end; | 43 const OwnPtrWillBeMember<InterpolableValue> m_end; |
| 44 const AnimationEffect::CompositeOperation m_compositeStart; | |
| 45 const AnimationEffect::CompositeOperation m_compositeEnd; | |
| 32 | 46 |
| 33 mutable double m_cachedFraction; | 47 mutable double m_cachedFraction; |
| 34 mutable int m_cachedIteration; | 48 mutable int m_cachedIteration; |
| 35 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue; | 49 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue; |
| 50 mutable double m_cachedUnderlyingFraction; | |
| 36 | 51 |
| 52 // FIXME: Remove old constructor? | |
| 37 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil lBeRawPtr<InterpolableValue> end); | 53 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil lBeRawPtr<InterpolableValue> end); |
| 54 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil lBeRawPtr<InterpolableValue> end, | |
| 55 AnimationEffect::CompositeOperation compositeStart, AnimationEffect::Com positeOperation compositeEnd); | |
| 38 | 56 |
| 39 private: | 57 private: |
| 40 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g et(); } | 58 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g et(); } |
| 41 | 59 |
| 42 friend class AnimationInterpolableValueTest; | 60 friend class AnimationInterpolableValueTest; |
| 43 friend class AnimationInterpolationEffectTest; | 61 friend class AnimationInterpolationEffectTest; |
| 44 friend class AnimationDoubleStyleInterpolationTest; | 62 friend class AnimationDoubleStyleInterpolationTest; |
| 45 friend class AnimationVisibilityStyleInterpolationTest; | 63 friend class AnimationVisibilityStyleInterpolationTest; |
| 46 friend class AnimationColorStyleInterpolationTest; | 64 friend class AnimationColorStyleInterpolationTest; |
| 47 }; | 65 }; |
| 48 | 66 |
| 49 } // namespace blink | 67 } // namespace blink |
| 50 | 68 |
| 51 #endif // Interpolation_h | 69 #endif // Interpolation_h |
| OLD | NEW |