Index: Source/core/animation/css/CSSAnimatableValueFactory.cpp |
diff --git a/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/Source/core/animation/css/CSSAnimatableValueFactory.cpp |
index b3113f113c8a7a3d01dd86effaea2c22891f6716..6068a1b6c67bb4403473531221b8a99b46df7c40 100644 |
--- a/Source/core/animation/css/CSSAnimatableValueFactory.cpp |
+++ b/Source/core/animation/css/CSSAnimatableValueFactory.cpp |
@@ -230,6 +230,38 @@ inline static PassRefPtr<AnimatableValue> createFromShapeValue(ShapeValue* value |
return AnimatableUnknown::create(CSSValueAuto); |
} |
+static double fontWeightToDouble(FontWeight fontWeight) |
+{ |
+ switch (fontWeight) { |
+ case FontWeight100: |
+ return 100; |
+ case FontWeight200: |
+ return 200; |
+ case FontWeight300: |
+ return 300; |
+ case FontWeight400: |
+ return 400; |
+ case FontWeight500: |
+ return 500; |
+ case FontWeight600: |
+ return 600; |
+ case FontWeight700: |
+ return 700; |
+ case FontWeight800: |
+ return 800; |
+ case FontWeight900: |
+ return 900; |
+ } |
+ |
+ ASSERT_NOT_REACHED(); |
+ return 400; |
+} |
+ |
+static PassRefPtr<AnimatableValue> createFromFontWeight(FontWeight fontWeight) |
+{ |
+ return createFromDouble(fontWeightToDouble(fontWeight)); |
+} |
+ |
// FIXME: Generate this function. |
PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style) |
{ |
@@ -311,6 +343,8 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop |
// FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to |
// enable text zoom rather than Text Autosizing? See http://crbug.com/227545. |
return createFromDouble(style.specifiedFontSize()); |
+ case CSSPropertyFontWeight: |
+ return createFromFontWeight(style.fontWeight()); |
case CSSPropertyHeight: |
return createFromLength(style.height(), style); |
case CSSPropertyKerning: |