OLD | NEW |
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 Loading... |
218 case CSSPropertyWebkitMaskSize: | 218 case CSSPropertyWebkitMaskSize: |
219 fillLayer->clearSize(); | 219 fillLayer->clearSize(); |
220 break; | 220 break; |
221 default: | 221 default: |
222 ASSERT_NOT_REACHED(); | 222 ASSERT_NOT_REACHED(); |
223 } | 223 } |
224 fillLayer = fillLayer->next(); | 224 fillLayer = fillLayer->next(); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
| 228 FontWeight animatableValueToFontWeight(const AnimatableValue* value) |
| 229 { |
| 230 int index = round(toAnimatableDouble(value)->toDouble() / 100) - 1; |
| 231 |
| 232 static const FontWeight weights[] = { |
| 233 FontWeight100, |
| 234 FontWeight200, |
| 235 FontWeight300, |
| 236 FontWeight400, |
| 237 FontWeight500, |
| 238 FontWeight600, |
| 239 FontWeight700, |
| 240 FontWeight800, |
| 241 FontWeight900 |
| 242 }; |
| 243 |
| 244 index = clampTo<int>(index, 0, WTF_ARRAY_LENGTH(weights) - 1); |
| 245 |
| 246 return weights[index]; |
| 247 } |
| 248 |
228 } // namespace | 249 } // namespace |
229 | 250 |
230 // FIXME: Generate this function. | 251 // FIXME: Generate this function. |
231 void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
ate& state, const AnimatableValue* value) | 252 void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
ate& state, const AnimatableValue* value) |
232 { | 253 { |
233 ASSERT(CSSAnimations::isAnimatableProperty(property)); | 254 ASSERT(CSSAnimations::isAnimatableProperty(property)); |
234 if (value->isUnknown()) { | 255 if (value->isUnknown()) { |
235 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)-
>toCSSValue().get()); | 256 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)-
>toCSSValue().get()); |
236 return; | 257 return; |
237 } | 258 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 return; | 365 return; |
345 case CSSPropertyFloodColor: | 366 case CSSPropertyFloodColor: |
346 style->setFloodColor(toAnimatableColor(value)->color()); | 367 style->setFloodColor(toAnimatableColor(value)->color()); |
347 return; | 368 return; |
348 case CSSPropertyFloodOpacity: | 369 case CSSPropertyFloodOpacity: |
349 style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDoubl
e(), 0, 1)); | 370 style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDoubl
e(), 0, 1)); |
350 return; | 371 return; |
351 case CSSPropertyFontSize: | 372 case CSSPropertyFontSize: |
352 style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(),
0)); | 373 style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(),
0)); |
353 return; | 374 return; |
| 375 case CSSPropertyFontWeight: |
| 376 style->setFontWeight(animatableValueToFontWeight(value)); |
| 377 return; |
354 case CSSPropertyHeight: | 378 case CSSPropertyHeight: |
355 style->setHeight(animatableValueToLength(value, state, NonNegativeValues
)); | 379 style->setHeight(animatableValueToLength(value, state, NonNegativeValues
)); |
356 return; | 380 return; |
357 case CSSPropertyKerning: | 381 case CSSPropertyKerning: |
358 style->setKerning(toAnimatableSVGLength(value)->toSVGLength()); | 382 style->setKerning(toAnimatableSVGLength(value)->toSVGLength()); |
359 return; | 383 return; |
360 case CSSPropertyLeft: | 384 case CSSPropertyLeft: |
361 style->setLeft(animatableValueToLength(value, state)); | 385 style->setLeft(animatableValueToLength(value, state)); |
362 return; | 386 return; |
363 case CSSPropertyLightingColor: | 387 case CSSPropertyLightingColor: |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 return; | 612 return; |
589 case CSSPropertyZoom: | 613 case CSSPropertyZoom: |
590 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); | 614 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); |
591 return; | 615 return; |
592 default: | 616 default: |
593 ASSERT_NOT_REACHED(); | 617 ASSERT_NOT_REACHED(); |
594 } | 618 } |
595 } | 619 } |
596 | 620 |
597 } // namespace WebCore | 621 } // namespace WebCore |
OLD | NEW |