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

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

Issue 1243313002: Migrate the remaining CSS properties interpolable as Lengths to LengthInterpolationType (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add composition tests Created 5 years, 3 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
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.cpp ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/AngleSVGInterpolation.h" 8 #include "core/animation/AngleSVGInterpolation.h"
9 #include "core/animation/CSSValueInterpolationType.h" 9 #include "core/animation/CSSValueInterpolationType.h"
10 #include "core/animation/ColorStyleInterpolation.h" 10 #include "core/animation/ColorStyleInterpolation.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID property) 151 const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID property)
152 { 152 {
153 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Interpo lationType*>*>; 153 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Interpo lationType*>*>;
154 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); 154 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ());
155 auto entry = applicableTypesMap.find(property); 155 auto entry = applicableTypesMap.find(property);
156 if (entry != applicableTypesMap.end()) 156 if (entry != applicableTypesMap.end())
157 return entry->value; 157 return entry->value;
158 158
159 auto applicableTypes = new Vector<const InterpolationType*>(); 159 auto applicableTypes = new Vector<const InterpolationType*>();
160 switch (property) { 160 switch (property) {
161 case CSSPropertyBaselineShift:
162 case CSSPropertyBorderBottomWidth:
163 case CSSPropertyBorderLeftWidth:
164 case CSSPropertyBorderRightWidth:
165 case CSSPropertyBorderTopWidth:
166 case CSSPropertyBottom:
167 case CSSPropertyCx:
168 case CSSPropertyCy:
169 case CSSPropertyFlexBasis:
170 case CSSPropertyHeight:
161 case CSSPropertyLeft: 171 case CSSPropertyLeft:
172 case CSSPropertyLetterSpacing:
173 case CSSPropertyMarginBottom:
174 case CSSPropertyMarginLeft:
175 case CSSPropertyMarginRight:
176 case CSSPropertyMarginTop:
177 case CSSPropertyMaxHeight:
178 case CSSPropertyMaxWidth:
179 case CSSPropertyMinHeight:
180 case CSSPropertyMinWidth:
181 case CSSPropertyMotionOffset:
182 case CSSPropertyOutlineOffset:
183 case CSSPropertyOutlineWidth:
184 case CSSPropertyPaddingBottom:
185 case CSSPropertyPaddingLeft:
186 case CSSPropertyPaddingRight:
187 case CSSPropertyPaddingTop:
188 case CSSPropertyPerspective:
189 case CSSPropertyR:
190 case CSSPropertyRight:
191 case CSSPropertyRx:
192 case CSSPropertyRy:
193 case CSSPropertyShapeMargin:
194 case CSSPropertyStrokeDashoffset:
195 case CSSPropertyStrokeWidth:
196 case CSSPropertyTop:
197 case CSSPropertyVerticalAlign:
198 case CSSPropertyWebkitBorderHorizontalSpacing:
199 case CSSPropertyWebkitBorderVerticalSpacing:
200 case CSSPropertyWebkitColumnGap:
201 case CSSPropertyWebkitColumnRuleWidth:
202 case CSSPropertyWebkitColumnWidth:
203 case CSSPropertyWebkitPerspectiveOriginX:
204 case CSSPropertyWebkitPerspectiveOriginY:
205 case CSSPropertyWebkitTransformOriginX:
206 case CSSPropertyWebkitTransformOriginY:
207 case CSSPropertyWebkitTransformOriginZ:
208 case CSSPropertyWidth:
209 case CSSPropertyWordSpacing:
210 case CSSPropertyX:
211 case CSSPropertyY:
162 applicableTypes->append(new LengthInterpolationType(property)); 212 applicableTypes->append(new LengthInterpolationType(property));
163 break; 213 break;
164 default: 214 default:
165 // TODO(alancutter): Support all interpolable CSS properties here so we can stop falling back to the old StyleInterpolation implementation. 215 // TODO(alancutter): Support all interpolable CSS properties here so we can stop falling back to the old StyleInterpolation implementation.
166 if (CSSPropertyMetadata::isInterpolableProperty(property)) { 216 if (CSSPropertyMetadata::isInterpolableProperty(property)) {
167 delete applicableTypes; 217 delete applicableTypes;
168 applicableTypesMap.add(property, nullptr); 218 applicableTypesMap.add(property, nullptr);
169 return nullptr; 219 return nullptr;
170 } 220 }
171 break; 221 break;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return nullptr; 273 return nullptr;
224 } 274 }
225 275
226 if (fromCSSValue->isCSSWideKeyword() || toCSSValue->isCSSWideKeyword()) 276 if (fromCSSValue->isCSSWideKeyword() || toCSSValue->isCSSWideKeyword())
227 return createLegacyStyleInterpolation(property, end, element, baseStyle) ; 277 return createLegacyStyleInterpolation(property, end, element, baseStyle) ;
228 278
229 switch (property) { 279 switch (property) {
230 case CSSPropertyLineHeight: 280 case CSSPropertyLineHeight:
231 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) 281 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue))
232 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, RangeNonNegative); 282 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, RangeNonNegative);
233
234 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) 283 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue))
235 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, true, RangeNonNegative); 284 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, true, RangeNonNegative);
236 285
237 break; 286 break;
238 case CSSPropertyBorderBottomWidth: 287
239 case CSSPropertyBorderLeftWidth:
240 case CSSPropertyBorderRightWidth:
241 case CSSPropertyBorderTopWidth:
242 case CSSPropertyFlexBasis:
243 case CSSPropertyFontSize: 288 case CSSPropertyFontSize:
244 case CSSPropertyHeight: 289 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue))
245 case CSSPropertyMaxHeight: 290 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, RangeNonNegative);
246 case CSSPropertyMaxWidth:
247 case CSSPropertyMinHeight:
248 case CSSPropertyMinWidth:
249 case CSSPropertyOutlineWidth:
250 case CSSPropertyPaddingBottom:
251 case CSSPropertyPaddingLeft:
252 case CSSPropertyPaddingRight:
253 case CSSPropertyPaddingTop:
254 case CSSPropertyPerspective:
255 case CSSPropertyR:
256 case CSSPropertyRx:
257 case CSSPropertyRy:
258 case CSSPropertyShapeMargin:
259 case CSSPropertyStrokeWidth:
260 case CSSPropertyWebkitBorderHorizontalSpacing:
261 case CSSPropertyWebkitBorderVerticalSpacing:
262 case CSSPropertyWebkitColumnGap:
263 case CSSPropertyWebkitColumnWidth:
264 case CSSPropertyWidth:
265 range = RangeNonNegative;
266 // Fall through
267 case CSSPropertyBaselineShift:
268 case CSSPropertyBottom:
269 case CSSPropertyCx:
270 case CSSPropertyCy:
271 case CSSPropertyLeft:
272 case CSSPropertyLetterSpacing:
273 case CSSPropertyMarginBottom:
274 case CSSPropertyMarginLeft:
275 case CSSPropertyMarginRight:
276 case CSSPropertyMarginTop:
277 case CSSPropertyMotionOffset:
278 case CSSPropertyOutlineOffset:
279 case CSSPropertyRight:
280 case CSSPropertyStrokeDashoffset:
281 case CSSPropertyTop:
282 case CSSPropertyVerticalAlign:
283 case CSSPropertyWordSpacing:
284 case CSSPropertyWebkitColumnRuleWidth:
285 case CSSPropertyWebkitPerspectiveOriginX:
286 case CSSPropertyWebkitPerspectiveOriginY:
287 case CSSPropertyWebkitTransformOriginX:
288 case CSSPropertyWebkitTransformOriginY:
289 case CSSPropertyWebkitTransformOriginZ:
290 case CSSPropertyX:
291 case CSSPropertyY:
292 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue, property) && LengthStyleInterpolation::canCreateFrom(*toCSSValue, property))
293 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range);
294 291
295 // FIXME: Handle keywords e.g. 'smaller', 'larger'. 292 // FIXME: Handle keywords e.g. 'smaller', 'larger'.
296 if (property == CSSPropertyFontSize) 293 if (property == CSSPropertyFontSize)
297 return createLegacyStyleInterpolation(property, end, element, baseSt yle); 294 return createLegacyStyleInterpolation(property, end, element, baseSt yle);
298 295
299 // FIXME: Handle keywords e.g. 'baseline', 'sub'. 296 // FIXME: Handle keywords e.g. 'baseline', 'sub'.
300 if (property == CSSPropertyBaselineShift) 297 if (property == CSSPropertyBaselineShift)
301 return createLegacyStyleInterpolation(property, end, element, baseSt yle); 298 return createLegacyStyleInterpolation(property, end, element, baseSt yle);
302 299
303 break; 300 break;
301
304 case CSSPropertyOrphans: 302 case CSSPropertyOrphans:
305 case CSSPropertyWidows: 303 case CSSPropertyWidows:
306 case CSSPropertyZIndex: 304 case CSSPropertyZIndex:
307 case CSSPropertyWebkitColumnCount: 305 case CSSPropertyWebkitColumnCount:
308 case CSSPropertyShapeImageThreshold: 306 case CSSPropertyShapeImageThreshold:
309 case CSSPropertyFillOpacity: 307 case CSSPropertyFillOpacity:
310 case CSSPropertyFloodOpacity: 308 case CSSPropertyFloodOpacity:
311 case CSSPropertyFontSizeAdjust: 309 case CSSPropertyFontSizeAdjust:
312 case CSSPropertyOpacity: 310 case CSSPropertyOpacity:
313 case CSSPropertyStopOpacity: 311 case CSSPropertyStopOpacity:
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); 578 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value);
581 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); 579 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value());
582 580
583 if (!fromValue || !toValue) 581 if (!fromValue || !toValue)
584 return nullptr; 582 return nullptr;
585 583
586 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); 584 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( ));
587 } 585 }
588 586
589 } // namespace blink 587 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.cpp ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698