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

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

Issue 273903002: Web Animations API: Length properties responsive to style changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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/Length.h"
10 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
11 #include "wtf/RefCounted.h" 12 #include "wtf/RefCounted.h"
12 13
13 namespace WebCore { 14 namespace WebCore {
14 15
15 class StyleResolverState; 16 class StyleResolverState;
16 17
17 class Interpolation : public RefCountedWillBeGarbageCollected<Interpolation> { 18 class Interpolation : public RefCountedWillBeGarbageCollected<Interpolation> {
18 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(Interpolation); 19 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(Interpolation);
19 public: 20 public:
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 93
93 private: 94 private:
94 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) 95 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id)
95 : StyleInterpolation(start, end, id) 96 : StyleInterpolation(start, end, id)
96 { 97 {
97 } 98 }
98 }; 99 };
99 100
100 class LengthStyleInterpolation : public StyleInterpolation { 101 class LengthStyleInterpolation : public StyleInterpolation {
101 public: 102 public:
102 static PassRefPtrWillBeRawPtr<LengthStyleInterpolation> create(CSSValue* sta rt, CSSValue* end, CSSPropertyID id) 103 static PassRefPtrWillBeRawPtr<LengthStyleInterpolation> create(CSSValue* sta rt, CSSValue* end, CSSPropertyID id, ValueRange range)
103 { 104 {
104 return adoptRefWillBeNoop(new LengthStyleInterpolation(lengthToInterpola bleValue(start), lengthToInterpolableValue(end), id)); 105 return adoptRefWillBeNoop(new LengthStyleInterpolation(lengthToInterpola bleValue(start), lengthToInterpolableValue(end), id, range));
105 } 106 }
106 107
107 static bool canCreateFrom(const CSSValue&); 108 static bool canCreateFrom(const CSSValue&);
108 109
109 virtual void apply(StyleResolverState&) const OVERRIDE; 110 virtual void apply(StyleResolverState&) const OVERRIDE;
110 111
111 virtual void trace(Visitor*) OVERRIDE; 112 virtual void trace(Visitor*) OVERRIDE;
112 113
113 private: 114 private:
114 LengthStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) 115 LengthStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id, ValueRange range)
115 : StyleInterpolation(start, end, id) 116 : StyleInterpolation(start, end, id)
117 , m_range(range)
116 { } 118 { }
117 119
118 static PassOwnPtrWillBeRawPtr<InterpolableValue> lengthToInterpolableValue(C SSValue*); 120 static PassOwnPtrWillBeRawPtr<InterpolableValue> lengthToInterpolableValue(C SSValue*);
119 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLength(Interpolab leValue*); 121 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLength(Interpolab leValue*, ValueRange);
122
123 ValueRange m_range;
120 124
121 friend class AnimationInterpolationTest; 125 friend class AnimationInterpolationTest;
122 }; 126 };
123 127
124 class DefaultStyleInterpolation : public StyleInterpolation { 128 class DefaultStyleInterpolation : public StyleInterpolation {
125 public: 129 public:
126 static PassRefPtrWillBeRawPtr<DefaultStyleInterpolation> create(CSSValue* st art, CSSValue* end, CSSPropertyID id) 130 static PassRefPtrWillBeRawPtr<DefaultStyleInterpolation> create(CSSValue* st art, CSSValue* end, CSSPropertyID id)
127 { 131 {
128 return adoptRefWillBeNoop(new DefaultStyleInterpolation(start, end, id)) ; 132 return adoptRefWillBeNoop(new DefaultStyleInterpolation(start, end, id)) ;
129 } 133 }
(...skipping 11 matching lines...) Expand all
141 RefPtrWillBeMember<CSSValue> m_startCSSValue; 145 RefPtrWillBeMember<CSSValue> m_startCSSValue;
142 RefPtrWillBeMember<CSSValue> m_endCSSValue; 146 RefPtrWillBeMember<CSSValue> m_endCSSValue;
143 }; 147 };
144 148
145 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp olation(), value.isStyleInterpolation()); 149 DEFINE_TYPE_CASTS(StyleInterpolation, Interpolation, value, value->isStyleInterp olation(), value.isStyleInterpolation());
146 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac yStyleInterpolation(), value.isLegacyStyleInterpolation()); 150 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac yStyleInterpolation(), value.isLegacyStyleInterpolation());
147 151
148 } 152 }
149 153
150 #endif 154 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/Interpolation.cpp » ('j') | Source/core/animation/Interpolation.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698