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

Side by Side Diff: Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 203523002: Reland "Add plumbing for font-stretch" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: w/fix for ASSERT Created 6 years, 5 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return AnimatableColor::create(color, visitedLinkColor); 218 return AnimatableColor::create(color, visitedLinkColor);
219 } 219 }
220 220
221 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromShapeValue(Shape Value* value) 221 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromShapeValue(Shape Value* value)
222 { 222 {
223 if (value) 223 if (value)
224 return AnimatableShapeValue::create(value); 224 return AnimatableShapeValue::create(value);
225 return AnimatableUnknown::create(CSSValueNone); 225 return AnimatableUnknown::create(CSSValueNone);
226 } 226 }
227 227
228 static double fontStretchToDouble(FontStretch fontStretch)
229 {
230 return static_cast<unsigned>(fontStretch);
231 }
232
233 static PassRefPtr<AnimatableValue> createFromFontStretch(FontStretch fontStretch )
234 {
235 return createFromDouble(fontStretchToDouble(fontStretch));
236 }
237
228 static double fontWeightToDouble(FontWeight fontWeight) 238 static double fontWeightToDouble(FontWeight fontWeight)
229 { 239 {
230 switch (fontWeight) { 240 switch (fontWeight) {
231 case FontWeight100: 241 case FontWeight100:
232 return 100; 242 return 100;
233 case FontWeight200: 243 case FontWeight200:
234 return 200; 244 return 200;
235 case FontWeight300: 245 case FontWeight300:
236 return 300; 246 return 300;
237 case FontWeight400: 247 case FontWeight400:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 case CSSPropertyFloodColor: 344 case CSSPropertyFloodColor:
335 return createFromColor(property, style); 345 return createFromColor(property, style);
336 case CSSPropertyFloodOpacity: 346 case CSSPropertyFloodOpacity:
337 return createFromDouble(style.floodOpacity()); 347 return createFromDouble(style.floodOpacity());
338 case CSSPropertyFontSize: 348 case CSSPropertyFontSize:
339 // Must pass a specified size to setFontSize if Text Autosizing is enabl ed, but a computed size 349 // Must pass a specified size to setFontSize if Text Autosizing is enabl ed, but a computed size
340 // if text zoom is enabled (if neither is enabled it's irrelevant as the y're probably the same). 350 // if text zoom is enabled (if neither is enabled it's irrelevant as the y're probably the same).
341 // FIXME: Should we introduce an option to pass the computed font size h ere, allowing consumers to 351 // FIXME: Should we introduce an option to pass the computed font size h ere, allowing consumers to
342 // enable text zoom rather than Text Autosizing? See http://crbug.com/22 7545. 352 // enable text zoom rather than Text Autosizing? See http://crbug.com/22 7545.
343 return createFromDouble(style.specifiedFontSize()); 353 return createFromDouble(style.specifiedFontSize());
354 case CSSPropertyFontStretch:
355 return createFromFontStretch(style.fontStretch());
344 case CSSPropertyFontWeight: 356 case CSSPropertyFontWeight:
345 return createFromFontWeight(style.fontWeight()); 357 return createFromFontWeight(style.fontWeight());
346 case CSSPropertyHeight: 358 case CSSPropertyHeight:
347 return createFromLength(style.height(), style); 359 return createFromLength(style.height(), style);
348 case CSSPropertyLightingColor: 360 case CSSPropertyLightingColor:
349 return createFromColor(property, style); 361 return createFromColor(property, style);
350 case CSSPropertyListStyleImage: 362 case CSSPropertyListStyleImage:
351 return createFromStyleImage(style.listStyleImage()); 363 return createFromStyleImage(style.listStyleImage());
352 case CSSPropertyLeft: 364 case CSSPropertyLeft:
353 return createFromLength(style.left(), style); 365 return createFromLength(style.left(), style);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 case CSSPropertyZoom: 506 case CSSPropertyZoom:
495 return createFromDouble(style.zoom()); 507 return createFromDouble(style.zoom());
496 default: 508 default:
497 ASSERT_NOT_REACHED(); 509 ASSERT_NOT_REACHED();
498 // This return value is to avoid a release crash if possible. 510 // This return value is to avoid a release crash if possible.
499 return AnimatableUnknown::create(nullptr); 511 return AnimatableUnknown::create(nullptr);
500 } 512 }
501 } 513 }
502 514
503 } // namespace blink 515 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698