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

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

Issue 2236193002: WIP: Implement CSS transitions on top of InterpolationTypes instead of AnimatableValues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_environmentStyle
Patch Set: Created 4 years, 4 months 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 KeyframeInterpolation_h
6 #define InvalidatableInterpolation_h 6 #define KeyframeInterpolation_h
7 7
8 #include "core/animation/InterpolationType.h" 8 #include "core/animation/InterpolationType.h"
9 #include "core/animation/Keyframe.h"
9 #include "core/animation/PrimitiveInterpolation.h" 10 #include "core/animation/PrimitiveInterpolation.h"
10 #include "core/animation/PropertyInterpolationTypesMapping.h" 11 #include "core/animation/PropertyInterpolationTypesMapping.h"
11 #include "core/animation/StyleInterpolation.h" 12 #include "core/animation/StackableInterpolation.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 Interpolati on. 17 // TODO(alancutter): This class will replace *StyleInterpolation and Interpolati on.
18 // 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.
19 class CORE_EXPORT InvalidatableInterpolation : public Interpolation { 19 class KeyframeInterpolation : public StackableInterpolation {
20 public: 20 public:
21 static PassRefPtr<InvalidatableInterpolation> create( 21 static PassRefPtr<KeyframeInterpolation> create(
22 PropertyHandle property, 22 PropertyHandle property,
23 const InterpolationTypes& interpolationTypes, 23 const InterpolationTypes& interpolationTypes,
24 PassRefPtr<PropertySpecificKeyframe> startKeyframe, 24 PassRefPtr<PropertySpecificKeyframe> startKeyframe,
25 PassRefPtr<PropertySpecificKeyframe> endKeyframe) 25 PassRefPtr<PropertySpecificKeyframe> endKeyframe)
26 { 26 {
27 return adoptRef(new InvalidatableInterpolation(property, interpolationTy pes, startKeyframe, endKeyframe)); 27 return adoptRef(new KeyframeInterpolation(property, interpolationTypes, startKeyframe, endKeyframe));
28 } 28 }
29 29
30 PropertyHandle getProperty() const final { return m_property; } 30 PropertyHandle getProperty() const final { return m_property; }
31 virtual void interpolate(int iteration, double fraction);
32 bool dependsOnUnderlyingValue() const final; 31 bool dependsOnUnderlyingValue() const final;
33 virtual void apply(InterpolationEnvironment&) const { NOTREACHED(); }
34 static void applyStack(const ActiveInterpolations&, InterpolationEnvironment &); 32 static void applyStack(const ActiveInterpolations&, InterpolationEnvironment &);
35 33
36 virtual bool isInvalidatableInterpolation() const { return true; } 34 virtual bool isKeyframeInterpolation() const { return true; }
37 35
38 private: 36 private:
39 InvalidatableInterpolation( 37 KeyframeInterpolation(
40 PropertyHandle property, 38 PropertyHandle property,
41 const InterpolationTypes& interpolationTypes, 39 const InterpolationTypes& interpolationTypes,
42 PassRefPtr<PropertySpecificKeyframe> startKeyframe, 40 PassRefPtr<PropertySpecificKeyframe> startKeyframe,
43 PassRefPtr<PropertySpecificKeyframe> endKeyframe) 41 PassRefPtr<PropertySpecificKeyframe> endKeyframe)
44 : Interpolation(nullptr, nullptr) 42 : m_property(property)
45 , m_property(property)
46 , m_interpolationTypes(interpolationTypes) 43 , m_interpolationTypes(interpolationTypes)
47 , m_startKeyframe(startKeyframe) 44 , m_startKeyframe(startKeyframe)
48 , m_endKeyframe(endKeyframe) 45 , m_endKeyframe(endKeyframe)
49 , m_currentFraction(std::numeric_limits<double>::quiet_NaN()) 46 , m_previousFraction(std::numeric_limits<double>::quiet_NaN())
50 , m_isCached(false) 47 , m_isCached(false)
51 { } 48 { }
52 49
53 using ConversionCheckers = InterpolationType::ConversionCheckers; 50 using ConversionCheckers = InterpolationType::ConversionCheckers;
54 51
55 std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue(const I nterpolationEnvironment&) const; 52 void interpolateImpl() final;
56 const TypedInterpolationValue* ensureValidInterpolation(const InterpolationE nvironment&, const UnderlyingValueOwner&) const; 53 std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue(const I nterpolationEnvironment&) const final;
54 const TypedInterpolationValue* ensureValidInterpolation(const InterpolationE nvironment&, const UnderlyingValueOwner&) const final;
55 void setFlagIfInheritUsed(InterpolationEnvironment&) const final;
56 double underlyingFraction() const final;
57
57 void clearCache() const; 58 void clearCache() const;
58 bool isCacheValid(const InterpolationEnvironment&, const UnderlyingValueOwne r&) const; 59 bool isCacheValid(const InterpolationEnvironment&, const UnderlyingValueOwne r&) const;
59 bool isNeutralKeyframeActive() const; 60 bool isNeutralKeyframeActive() const;
60 std::unique_ptr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const I nterpolationEnvironment&, const UnderlyingValueOwner&) const; 61 std::unique_ptr<PairwisePrimitiveInterpolation> maybeConvertPairwise(const I nterpolationEnvironment&, const UnderlyingValueOwner&) const;
61 std::unique_ptr<TypedInterpolationValue> convertSingleKeyframe(const Propert ySpecificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner& ) const; 62 std::unique_ptr<TypedInterpolationValue> convertSingleKeyframe(const Propert ySpecificKeyframe&, const InterpolationEnvironment&, const UnderlyingValueOwner& ) const;
62 void addConversionCheckers(const InterpolationType&, ConversionCheckers&) co nst; 63 void addConversionCheckers(const InterpolationType&, ConversionCheckers&) co nst;
63 void setFlagIfInheritUsed(InterpolationEnvironment&) const;
64 double underlyingFraction() const;
65 64
66 const PropertyHandle m_property; 65 const PropertyHandle m_property;
67 const InterpolationTypes& m_interpolationTypes; 66 const InterpolationTypes& m_interpolationTypes;
68 RefPtr<PropertySpecificKeyframe> m_startKeyframe; 67 RefPtr<PropertySpecificKeyframe> m_startKeyframe;
69 RefPtr<PropertySpecificKeyframe> m_endKeyframe; 68 RefPtr<PropertySpecificKeyframe> m_endKeyframe;
70 double m_currentFraction; 69 double m_previousFraction;
71 mutable bool m_isCached; 70 mutable bool m_isCached;
72 mutable std::unique_ptr<PrimitiveInterpolation> m_cachedPairConversion; 71 mutable std::unique_ptr<PrimitiveInterpolation> m_cachedPairConversion;
73 mutable ConversionCheckers m_conversionCheckers; 72 mutable ConversionCheckers m_conversionCheckers;
74 mutable std::unique_ptr<TypedInterpolationValue> m_cachedValue; 73 mutable std::unique_ptr<TypedInterpolationValue> m_cachedValue;
75 }; 74 };
76 75
77 DEFINE_TYPE_CASTS(InvalidatableInterpolation, Interpolation, value, value->isInv alidatableInterpolation(), value.isInvalidatableInterpolation()); 76 DEFINE_TYPE_CASTS(KeyframeInterpolation, Interpolation, value, value->isKeyframe Interpolation(), value.isKeyframeInterpolation());
78 77
79 } // namespace blink 78 } // namespace blink
80 79
81 #endif // InvalidatableInterpolation_h 80 #endif // KeyframeInterpolation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698