Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: third_party/WebKit/Source/core/animation/InvalidatableInterpolation.h

Issue 2567453002: Revert of Make InvalidatableInterpolation's InterpolationTypes decided at effect application time (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/InterpolationTypesMap.h"
10 #include "core/animation/PrimitiveInterpolation.h" 9 #include "core/animation/PrimitiveInterpolation.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 #include <memory>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 // TODO(alancutter): This class will replace *StyleInterpolation and 17 // TODO(alancutter): This class will replace *StyleInterpolation and
18 // Interpolation. For now it needs to distinguish itself during the refactor and 18 // Interpolation. For now it needs to distinguish itself during the refactor and
19 // temporarily has an ugly name. 19 // temporarily has an ugly name.
20 class CORE_EXPORT InvalidatableInterpolation : public Interpolation { 20 class CORE_EXPORT InvalidatableInterpolation : public Interpolation {
21 public: 21 public:
22 static PassRefPtr<InvalidatableInterpolation> create( 22 static PassRefPtr<InvalidatableInterpolation> create(
23 PropertyHandle property, 23 PropertyHandle property,
24 const InterpolationTypes& interpolationTypes,
24 PassRefPtr<PropertySpecificKeyframe> startKeyframe, 25 PassRefPtr<PropertySpecificKeyframe> startKeyframe,
25 PassRefPtr<PropertySpecificKeyframe> endKeyframe) { 26 PassRefPtr<PropertySpecificKeyframe> endKeyframe) {
26 return adoptRef(new InvalidatableInterpolation( 27 return adoptRef(new InvalidatableInterpolation(property, interpolationTypes,
27 property, std::move(startKeyframe), std::move(endKeyframe))); 28 std::move(startKeyframe),
29 std::move(endKeyframe)));
28 } 30 }
29 31
30 PropertyHandle getProperty() const final { return m_property; } 32 PropertyHandle getProperty() const final { return m_property; }
31 virtual void interpolate(int iteration, double fraction); 33 virtual void interpolate(int iteration, double fraction);
32 bool dependsOnUnderlyingValue() const final; 34 bool dependsOnUnderlyingValue() const final;
33 virtual void apply(InterpolationEnvironment&) const { NOTREACHED(); } 35 virtual void apply(InterpolationEnvironment&) const { NOTREACHED(); }
34 static void applyStack(const ActiveInterpolations&, 36 static void applyStack(const ActiveInterpolations&,
35 InterpolationEnvironment&); 37 InterpolationEnvironment&);
36 38
37 virtual bool isInvalidatableInterpolation() const { return true; } 39 virtual bool isInvalidatableInterpolation() const { return true; }
38 40
39 private: 41 private:
40 InvalidatableInterpolation(PropertyHandle property, 42 InvalidatableInterpolation(PropertyHandle property,
43 const InterpolationTypes& interpolationTypes,
41 PassRefPtr<PropertySpecificKeyframe> startKeyframe, 44 PassRefPtr<PropertySpecificKeyframe> startKeyframe,
42 PassRefPtr<PropertySpecificKeyframe> endKeyframe) 45 PassRefPtr<PropertySpecificKeyframe> endKeyframe)
43 : Interpolation(nullptr, nullptr), 46 : Interpolation(nullptr, nullptr),
44 m_property(property), 47 m_property(property),
45 m_interpolationTypes(nullptr), 48 m_interpolationTypes(interpolationTypes),
46 m_interpolationTypesVersion(0),
47 m_startKeyframe(startKeyframe), 49 m_startKeyframe(startKeyframe),
48 m_endKeyframe(endKeyframe), 50 m_endKeyframe(endKeyframe),
49 m_currentFraction(std::numeric_limits<double>::quiet_NaN()), 51 m_currentFraction(std::numeric_limits<double>::quiet_NaN()),
50 m_isConversionCached(false) {} 52 m_isConversionCached(false) {}
51 53
52 using ConversionCheckers = InterpolationType::ConversionCheckers; 54 using ConversionCheckers = InterpolationType::ConversionCheckers;
53 55
54 std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue( 56 std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue(
55 const InterpolationEnvironment&) const; 57 const InterpolationEnvironment&) const;
56 const TypedInterpolationValue* ensureValidConversion( 58 const TypedInterpolationValue* ensureValidConversion(
57 const InterpolationEnvironment&, 59 const InterpolationEnvironment&,
58 const UnderlyingValueOwner&) const; 60 const UnderlyingValueOwner&) const;
59 void ensureValidInterpolationTypes(const InterpolationEnvironment&) const;
60 void clearConversionCache() const; 61 void clearConversionCache() const;
61 bool isConversionCacheValid(const InterpolationEnvironment&, 62 bool isConversionCacheValid(const InterpolationEnvironment&,
62 const UnderlyingValueOwner&) const; 63 const UnderlyingValueOwner&) const;
63 bool isNeutralKeyframeActive() const; 64 bool isNeutralKeyframeActive() const;
64 std::unique_ptr<PairwisePrimitiveInterpolation> maybeConvertPairwise( 65 std::unique_ptr<PairwisePrimitiveInterpolation> maybeConvertPairwise(
65 const InterpolationEnvironment&, 66 const InterpolationEnvironment&,
66 const UnderlyingValueOwner&) const; 67 const UnderlyingValueOwner&) const;
67 std::unique_ptr<TypedInterpolationValue> convertSingleKeyframe( 68 std::unique_ptr<TypedInterpolationValue> convertSingleKeyframe(
68 const PropertySpecificKeyframe&, 69 const PropertySpecificKeyframe&,
69 const InterpolationEnvironment&, 70 const InterpolationEnvironment&,
70 const UnderlyingValueOwner&) const; 71 const UnderlyingValueOwner&) const;
71 void addConversionCheckers(const InterpolationType&, 72 void addConversionCheckers(const InterpolationType&,
72 ConversionCheckers&) const; 73 ConversionCheckers&) const;
73 void setFlagIfInheritUsed(InterpolationEnvironment&) const; 74 void setFlagIfInheritUsed(InterpolationEnvironment&) const;
74 double underlyingFraction() const; 75 double underlyingFraction() const;
75 76
76 const PropertyHandle m_property; 77 const PropertyHandle m_property;
77 mutable const InterpolationTypes* m_interpolationTypes; 78 const InterpolationTypes& m_interpolationTypes;
78 mutable size_t m_interpolationTypesVersion;
79 RefPtr<PropertySpecificKeyframe> m_startKeyframe; 79 RefPtr<PropertySpecificKeyframe> m_startKeyframe;
80 RefPtr<PropertySpecificKeyframe> m_endKeyframe; 80 RefPtr<PropertySpecificKeyframe> m_endKeyframe;
81 double m_currentFraction; 81 double m_currentFraction;
82 mutable bool m_isConversionCached; 82 mutable bool m_isConversionCached;
83 mutable std::unique_ptr<PrimitiveInterpolation> m_cachedPairConversion; 83 mutable std::unique_ptr<PrimitiveInterpolation> m_cachedPairConversion;
84 mutable ConversionCheckers m_conversionCheckers; 84 mutable ConversionCheckers m_conversionCheckers;
85 mutable std::unique_ptr<TypedInterpolationValue> m_cachedValue; 85 mutable std::unique_ptr<TypedInterpolationValue> m_cachedValue;
86 }; 86 };
87 87
88 DEFINE_TYPE_CASTS(InvalidatableInterpolation, 88 DEFINE_TYPE_CASTS(InvalidatableInterpolation,
89 Interpolation, 89 Interpolation,
90 value, 90 value,
91 value->isInvalidatableInterpolation(), 91 value->isInvalidatableInterpolation(),
92 value.isInvalidatableInterpolation()); 92 value.isInvalidatableInterpolation());
93 93
94 } // namespace blink 94 } // namespace blink
95 95
96 #endif // InvalidatableInterpolation_h 96 #endif // InvalidatableInterpolation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698