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

Side by Side Diff: Source/core/animation/StringKeyframe.cpp

Issue 811993002: Animation: Implement DoubleStyleInterpolation in StringKeyframe (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add length Prtoperty Created 5 years, 11 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 #include "config.h" 5 #include "config.h"
6 #include "core/animation/StringKeyframe.h" 6 #include "core/animation/StringKeyframe.h"
7 7
8 #include "core/animation/ColorStyleInterpolation.h" 8 #include "core/animation/ColorStyleInterpolation.h"
9 #include "core/animation/DefaultStyleInterpolation.h" 9 #include "core/animation/DefaultStyleInterpolation.h"
10 #include "core/animation/DeferredLegacyStyleInterpolation.h" 10 #include "core/animation/DeferredLegacyStyleInterpolation.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 , m_value(value) 69 , m_value(value)
70 { 70 {
71 ASSERT(!isNull(m_offset)); 71 ASSERT(!isNull(m_offset));
72 } 72 }
73 73
74 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const 74 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const
75 { 75 {
76 CSSValue* fromCSSValue = m_value.get(); 76 CSSValue* fromCSSValue = m_value.get();
77 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); 77 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value();
78 ValueRange range = ValueRangeAll; 78 ValueRange range = ValueRangeAll;
79 ClampRange clamp = NoClamp;
79 80
80 if (!CSSPropertyMetadata::isAnimatableProperty(property)) 81 if (!CSSPropertyMetadata::isAnimatableProperty(property))
81 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); 82 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty);
82 83
83 bool useDefaultStyleInterpolation = true; 84 bool useDefaultStyleInterpolation = true;
84 85
85 switch (property) { 86 switch (property) {
86 case CSSPropertyLineHeight: 87 case CSSPropertyLineHeight:
87 // FIXME: Handle numbers. 88 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue))
88 useDefaultStyleInterpolation = false; 89 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, ClampZero);
Eric Willigers 2015/01/14 01:43:36 Do we need a break?
jadeg 2015/01/18 22:59:41 No if it's not a double then it will be a length
Eric Willigers 2015/01/18 23:16:14 OK, then we need // Fall through
89 // Fall through
90 case CSSPropertyBorderBottomWidth: 90 case CSSPropertyBorderBottomWidth:
91 case CSSPropertyBorderLeftWidth: 91 case CSSPropertyBorderLeftWidth:
92 case CSSPropertyBorderRightWidth: 92 case CSSPropertyBorderRightWidth:
93 case CSSPropertyBorderTopWidth: 93 case CSSPropertyBorderTopWidth:
94 case CSSPropertyFlexBasis:
94 case CSSPropertyFontSize: 95 case CSSPropertyFontSize:
95 case CSSPropertyHeight: 96 case CSSPropertyHeight:
96 case CSSPropertyMaxHeight: 97 case CSSPropertyMaxHeight:
97 case CSSPropertyMaxWidth: 98 case CSSPropertyMaxWidth:
98 case CSSPropertyMinHeight: 99 case CSSPropertyMinHeight:
99 case CSSPropertyMinWidth: 100 case CSSPropertyMinWidth:
100 case CSSPropertyMotionPosition: 101 case CSSPropertyMotionPosition:
101 case CSSPropertyOutlineWidth: 102 case CSSPropertyOutlineWidth:
102 case CSSPropertyPaddingBottom: 103 case CSSPropertyPaddingBottom:
103 case CSSPropertyPaddingLeft: 104 case CSSPropertyPaddingLeft:
104 case CSSPropertyPaddingRight: 105 case CSSPropertyPaddingRight:
105 case CSSPropertyPaddingTop: 106 case CSSPropertyPaddingTop:
106 case CSSPropertyPerspective: 107 case CSSPropertyPerspective:
107 case CSSPropertyShapeMargin: 108 case CSSPropertyShapeMargin:
109 case CSSPropertyWebkitBorderHorizontalSpacing:
110 case CSSPropertyWebkitBorderVerticalSpacing:
111 case CSSPropertyWebkitColumnGap:
112 case CSSPropertyWebkitColumnWidth:
108 case CSSPropertyWidth: 113 case CSSPropertyWidth:
109 range = ValueRangeNonNegative; 114 range = ValueRangeNonNegative;
110 // Fall through 115 // Fall through
111 case CSSPropertyBottom: 116 case CSSPropertyBottom:
112 case CSSPropertyLeft: 117 case CSSPropertyLeft:
113 case CSSPropertyLetterSpacing: 118 case CSSPropertyLetterSpacing:
114 case CSSPropertyMarginBottom: 119 case CSSPropertyMarginBottom:
115 case CSSPropertyMarginLeft: 120 case CSSPropertyMarginLeft:
116 case CSSPropertyMarginRight: 121 case CSSPropertyMarginRight:
117 case CSSPropertyMarginTop: 122 case CSSPropertyMarginTop:
118 case CSSPropertyOutlineOffset: 123 case CSSPropertyOutlineOffset:
119 case CSSPropertyRight: 124 case CSSPropertyRight:
120 case CSSPropertyTop: 125 case CSSPropertyTop:
121 case CSSPropertyVerticalAlign: 126 case CSSPropertyVerticalAlign:
122 case CSSPropertyWordSpacing: 127 case CSSPropertyWordSpacing:
123 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) 128 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue))
124 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range); 129 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range);
125 // FIXME: Handle keywords e.g. 'none'. 130 // FIXME: Handle keywords e.g. 'none'.
126 if (property == CSSPropertyPerspective) 131 if (property == CSSPropertyPerspective)
127 useDefaultStyleInterpolation = false; 132 useDefaultStyleInterpolation = false;
128 break; 133 break;
134
135 case CSSPropertyOrphans:
136 if (clamp == NoClamp)
137 clamp = ClampOrphans;
Eric Willigers 2015/01/14 01:43:36 // Fall through
jadeg 2015/01/18 22:59:41 Done.
138 case CSSPropertyWebkitColumnCount:
139 case CSSPropertyZIndex:
140 if (clamp == NoClamp)
141 clamp = ClampInteger;
142 case CSSPropertyFillOpacity:
143 case CSSPropertyFloodOpacity:
144 case CSSPropertyOpacity:
145 case CSSPropertyShapeImageThreshold:
146 case CSSPropertyStopOpacity:
147 case CSSPropertyStrokeOpacity:
148 if (clamp == NoClamp)
149 clamp = ClampOpacity;
150 case CSSPropertyStrokeMiterlimit:
151 case CSSPropertyWidows:
152 if (clamp == NoClamp)
153 clamp = ClampOne;
154 case CSSPropertyZoom:
155 if (clamp == NoClamp)
156 clamp = ClampZoom;
Eric Willigers 2015/01/14 01:43:36 // Fall through
jadeg 2015/01/18 22:59:41 Done.
157 case CSSPropertyFlexGrow:
158 case CSSPropertyFlexShrink:
159 case CSSPropertyWebkitColumnRuleWidth:
160 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue))
161 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, clamp);
162 break;
163
129 case CSSPropertyMotionRotation: { 164 case CSSPropertyMotionRotation: {
130 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); 165 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property);
131 if (interpolation) 166 if (interpolation)
132 return interpolation.release(); 167 return interpolation.release();
133 break; 168 break;
134 } 169 }
135 case CSSPropertyVisibility: 170 case CSSPropertyVisibility:
136 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) { 171 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) {
137 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property); 172 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property);
138 } 173 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 255 }
221 256
222 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) 257 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor)
223 { 258 {
224 visitor->trace(m_value); 259 visitor->trace(m_value);
225 visitor->trace(m_animatableValueCache); 260 visitor->trace(m_animatableValueCache);
226 Keyframe::PropertySpecificKeyframe::trace(visitor); 261 Keyframe::PropertySpecificKeyframe::trace(visitor);
227 } 262 }
228 263
229 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698