| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 InvalidatableInterpolation_h | 5 #ifndef InvalidatableInterpolation_h |
| 6 #define InvalidatableInterpolation_h | 6 #define InvalidatableInterpolation_h |
| 7 | 7 |
| 8 #include "core/animation/InterpolationType.h" | 8 #include "core/animation/InterpolationType.h" |
| 9 #include "core/animation/PrimitiveInterpolation.h" | 9 #include "core/animation/PrimitiveInterpolation.h" |
| 10 #include "core/animation/PropertyInterpolationTypesMapping.h" | 10 #include "core/animation/PropertyInterpolationTypesMapping.h" |
| 11 #include "core/animation/StyleInterpolation.h" | 11 #include "core/animation/StyleInterpolation.h" |
| 12 #include "core/animation/TypedInterpolationValue.h" | 12 #include "core/animation/TypedInterpolationValue.h" |
| 13 #include <memory> |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 // TODO(alancutter): This class will replace *StyleInterpolation and Interpolati
on. | 17 // TODO(alancutter): This class will replace *StyleInterpolation and Interpolati
on. |
| 17 // For now it needs to distinguish itself during the refactor and temporarily ha
s an ugly name. | 18 // For now it needs to distinguish itself during the refactor and temporarily ha
s an ugly name. |
| 18 class CORE_EXPORT InvalidatableInterpolation : public Interpolation { | 19 class CORE_EXPORT InvalidatableInterpolation : public Interpolation { |
| 19 public: | 20 public: |
| 20 static PassRefPtr<InvalidatableInterpolation> create( | 21 static PassRefPtr<InvalidatableInterpolation> create( |
| 21 PropertyHandle property, | 22 PropertyHandle property, |
| 22 const InterpolationTypes& interpolationTypes, | 23 const InterpolationTypes& interpolationTypes, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 , m_property(property) | 45 , m_property(property) |
| 45 , m_interpolationTypes(interpolationTypes) | 46 , m_interpolationTypes(interpolationTypes) |
| 46 , m_startKeyframe(startKeyframe) | 47 , m_startKeyframe(startKeyframe) |
| 47 , m_endKeyframe(endKeyframe) | 48 , m_endKeyframe(endKeyframe) |
| 48 , m_currentFraction(std::numeric_limits<double>::quiet_NaN()) | 49 , m_currentFraction(std::numeric_limits<double>::quiet_NaN()) |
| 49 , m_isCached(false) | 50 , m_isCached(false) |
| 50 { } | 51 { } |
| 51 | 52 |
| 52 using ConversionCheckers = InterpolationType::ConversionCheckers; | 53 using ConversionCheckers = InterpolationType::ConversionCheckers; |
| 53 | 54 |
| 54 PassOwnPtr<TypedInterpolationValue> maybeConvertUnderlyingValue(const Interp
olationEnvironment&) const; | 55 std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue(const I
nterpolationEnvironment&) const; |
| 55 const TypedInterpolationValue* ensureValidInterpolation(const InterpolationE
nvironment&, const UnderlyingValueOwner&) const; | 56 const TypedInterpolationValue* ensureValidInterpolation(const InterpolationE
nvironment&, const UnderlyingValueOwner&) const; |
| 56 void clearCache() const; | 57 void clearCache() const; |
| 57 bool isCacheValid(const InterpolationEnvironment&, const UnderlyingValueOwne
r&) const; | 58 bool isCacheValid(const InterpolationEnvironment&, const UnderlyingValueOwne
r&) const; |
| 58 bool isNeutralKeyframeActive() const; | 59 bool isNeutralKeyframeActive() const; |
| 59 PassOwnPtr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const Interp
olationEnvironment&, const UnderlyingValueOwner&) const; | 60 std::unique_ptr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const I
nterpolationEnvironment&, const UnderlyingValueOwner&) const; |
| 60 PassOwnPtr<TypedInterpolationValue> convertSingleKeyframe(const PropertySpec
ificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner&) con
st; | 61 std::unique_ptr<TypedInterpolationValue> convertSingleKeyframe(const Propert
ySpecificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner&
) const; |
| 61 void addConversionCheckers(const InterpolationType&, ConversionCheckers&) co
nst; | 62 void addConversionCheckers(const InterpolationType&, ConversionCheckers&) co
nst; |
| 62 void setFlagIfInheritUsed(InterpolationEnvironment&) const; | 63 void setFlagIfInheritUsed(InterpolationEnvironment&) const; |
| 63 double underlyingFraction() const; | 64 double underlyingFraction() const; |
| 64 | 65 |
| 65 const PropertyHandle m_property; | 66 const PropertyHandle m_property; |
| 66 const InterpolationTypes& m_interpolationTypes; | 67 const InterpolationTypes& m_interpolationTypes; |
| 67 RefPtr<PropertySpecificKeyframe> m_startKeyframe; | 68 RefPtr<PropertySpecificKeyframe> m_startKeyframe; |
| 68 RefPtr<PropertySpecificKeyframe> m_endKeyframe; | 69 RefPtr<PropertySpecificKeyframe> m_endKeyframe; |
| 69 double m_currentFraction; | 70 double m_currentFraction; |
| 70 mutable bool m_isCached; | 71 mutable bool m_isCached; |
| 71 mutable OwnPtr<PrimitiveInterpolation> m_cachedPairConversion; | 72 mutable std::unique_ptr<PrimitiveInterpolation> m_cachedPairConversion; |
| 72 mutable ConversionCheckers m_conversionCheckers; | 73 mutable ConversionCheckers m_conversionCheckers; |
| 73 mutable OwnPtr<TypedInterpolationValue> m_cachedValue; | 74 mutable std::unique_ptr<TypedInterpolationValue> m_cachedValue; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 DEFINE_TYPE_CASTS(InvalidatableInterpolation, Interpolation, value, value->isInv
alidatableInterpolation(), value.isInvalidatableInterpolation()); | 77 DEFINE_TYPE_CASTS(InvalidatableInterpolation, Interpolation, value, value->isInv
alidatableInterpolation(), value.isInvalidatableInterpolation()); |
| 77 | 78 |
| 78 } // namespace blink | 79 } // namespace blink |
| 79 | 80 |
| 80 #endif // InvalidatableInterpolation_h | 81 #endif // InvalidatableInterpolation_h |
| OLD | NEW |