Index: Source/core/css/resolver/AnimatedStyleBuilder.cpp |
diff --git a/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
index c19384955f6f3ca4fb3c1ddd50b694c3fdb5f145..ded0ce312face37e5404a4cbdd862fd268569ab0 100644 |
--- a/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
+++ b/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
@@ -225,6 +225,28 @@ void setOnFillLayers(FillLayer* fillLayer, const AnimatableValue* value, StyleRe |
} |
} |
+FontWeight animatableValueToFontWeight(const AnimatableValue* value) |
+{ |
+ int index = round(toAnimatableDouble(value)->toDouble() / 100) - 1; |
+ |
+ if (index < 0 || index > 8) |
alancutter (OOO until 2018)
2014/02/23 23:01:08
Better to use WTF_ARRAY_LENGTH(weights) here inste
|
+ return FontWeightNormal; |
+ |
+ static const FontWeight weights[9] = { |
alancutter (OOO until 2018)
2014/02/23 23:01:08
No need to declare array size.
|
+ FontWeight100, |
+ FontWeight200, |
+ FontWeight300, |
+ FontWeight400, |
+ FontWeight500, |
+ FontWeight600, |
+ FontWeight700, |
+ FontWeight800, |
+ FontWeight900 |
+ }; |
+ |
+ return weights[index]; |
+} |
+ |
} // namespace |
// FIXME: Generate this function. |
@@ -351,6 +373,9 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
case CSSPropertyFontSize: |
style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0)); |
return; |
+ case CSSPropertyFontWeight: |
+ style->setFontWeight(animatableValueToFontWeight(value)); |
+ return; |
case CSSPropertyHeight: |
style->setHeight(animatableValueToLength(value, state, NonNegativeValues)); |
return; |