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

Side by Side Diff: Source/core/animation/Interpolation.h

Issue 273683005: Web Animations API: Deferred computation of interpolated values (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add missing test file Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "CSSPropertyNames.h" 8 #include "CSSPropertyNames.h"
9 #include "core/animation/InterpolableValue.h" 9 #include "core/animation/InterpolableValue.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 protected: 65 protected:
66 CSSPropertyID m_id; 66 CSSPropertyID m_id;
67 67
68 StyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnP trWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) 68 StyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnP trWillBeRawPtr<InterpolableValue> end, CSSPropertyID id)
69 : Interpolation(start, end) 69 : Interpolation(start, end)
70 , m_id(id) 70 , m_id(id)
71 { 71 {
72 } 72 }
73 }; 73 };
74 74
75 class LegacyStyleInterpolation : public StyleInterpolation {
76 public:
77 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWil lBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, C SSPropertyID id)
78 {
79 return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnima tableValue::create(start), InterpolableAnimatableValue::create(end), id));
80 }
81
82 virtual void apply(StyleResolverState&) const OVERRIDE;
83
84 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true ; }
85 PassRefPtrWillBeRawPtr<AnimatableValue> currentValue() const
86 {
87 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableV alue*>(m_cachedValue.get());
88 return value->value();
89 }
90
91 virtual void trace(Visitor*) OVERRIDE;
92
93 private:
94 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id)
95 : StyleInterpolation(start, end, id)
96 {
97 }
98 };
99
100 class LengthStyleInterpolation : public StyleInterpolation { 75 class LengthStyleInterpolation : public StyleInterpolation {
101 public: 76 public:
102 static PassRefPtrWillBeRawPtr<LengthStyleInterpolation> create(CSSValue* sta rt, CSSValue* end, CSSPropertyID id) 77 static PassRefPtrWillBeRawPtr<LengthStyleInterpolation> create(CSSValue* sta rt, CSSValue* end, CSSPropertyID id)
103 { 78 {
104 return adoptRefWillBeNoop(new LengthStyleInterpolation(lengthToInterpola bleValue(start), lengthToInterpolableValue(end), id)); 79 return adoptRefWillBeNoop(new LengthStyleInterpolation(lengthToInterpola bleValue(start), lengthToInterpolableValue(end), id));
105 } 80 }
106 81
107 static bool canCreateFrom(const CSSValue&); 82 static bool canCreateFrom(const CSSValue&);
108 83
109 virtual void apply(StyleResolverState&) const OVERRIDE; 84 virtual void apply(StyleResolverState&) const OVERRIDE;
(...skipping 26 matching lines...) Expand all
136 , m_startCSSValue(start) 111 , m_startCSSValue(start)
137 , m_endCSSValue(end) 112 , m_endCSSValue(end)
138 { 113 {
139 } 114 }
140 115
141 RefPtrWillBeMember<CSSValue> m_startCSSValue; 116 RefPtrWillBeMember<CSSValue> m_startCSSValue;
142 RefPtrWillBeMember<CSSValue> m_endCSSValue; 117 RefPtrWillBeMember<CSSValue> m_endCSSValue;
143 }; 118 };
144 119
145 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp olation(), value.isStyleInterpolation()); 120 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp olation(), value.isStyleInterpolation());
146 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac yStyleInterpolation(), value.isLegacyStyleInterpolation());
147 121
148 } 122 }
149 123
150 #endif 124 #endif
OLDNEW
« no previous file with comments | « Source/core/animation/InterpolableValuePromiseTest.cpp ('k') | Source/core/animation/Interpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698