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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 ASSERT_NOT_REACHED(); | 269 ASSERT_NOT_REACHED(); |
270 return 400; | 270 return 400; |
271 } | 271 } |
272 | 272 |
273 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFontWeight(FontWeight f
ontWeight) | 273 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFontWeight(FontWeight f
ontWeight) |
274 { | 274 { |
275 return createFromDouble(fontWeightToDouble(fontWeight)); | 275 return createFromDouble(fontWeightToDouble(fontWeight)); |
276 } | 276 } |
277 | 277 |
| 278 static SVGPaintType normalizeSVGPaintType(SVGPaintType paintType) |
| 279 { |
| 280 // If the <paint> is 'currentColor', then create an AnimatableSVGPaint with |
| 281 // a <rgbcolor> type. This is similar in vein to the handling of colors. |
| 282 return paintType == SVG_PAINTTYPE_CURRENTCOLOR ? SVG_PAINTTYPE_RGBCOLOR : pa
intType; |
| 283 } |
| 284 |
278 // FIXME: Generate this function. | 285 // FIXME: Generate this function. |
279 PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPro
pertyID property, const RenderStyle& style) | 286 PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPro
pertyID property, const RenderStyle& style) |
280 { | 287 { |
281 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property)); | 288 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property)); |
282 switch (property) { | 289 switch (property) { |
283 case CSSPropertyBackgroundColor: | 290 case CSSPropertyBackgroundColor: |
284 return createFromColor(property, style); | 291 return createFromColor(property, style); |
285 case CSSPropertyBackgroundImage: | 292 case CSSPropertyBackgroundImage: |
286 return createFromFillLayers<CSSPropertyBackgroundImage>(style.background
Layers(), style); | 293 return createFromFillLayers<CSSPropertyBackgroundImage>(style.background
Layers(), style); |
287 case CSSPropertyBackgroundPositionX: | 294 case CSSPropertyBackgroundPositionX: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 case CSSPropertyClip: | 340 case CSSPropertyClip: |
334 if (style.hasAutoClip()) | 341 if (style.hasAutoClip()) |
335 return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueA
uto)); | 342 return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueA
uto)); |
336 return createFromLengthBox(style.clip(), style); | 343 return createFromLengthBox(style.clip(), style); |
337 case CSSPropertyColor: | 344 case CSSPropertyColor: |
338 return createFromColor(property, style); | 345 return createFromColor(property, style); |
339 case CSSPropertyFillOpacity: | 346 case CSSPropertyFillOpacity: |
340 return createFromDouble(style.fillOpacity()); | 347 return createFromDouble(style.fillOpacity()); |
341 case CSSPropertyFill: | 348 case CSSPropertyFill: |
342 return AnimatableSVGPaint::create( | 349 return AnimatableSVGPaint::create( |
343 style.svgStyle().fillPaintType(), style.svgStyle().visitedLinkFillPa
intType(), | 350 normalizeSVGPaintType(style.svgStyle().fillPaintType()), normalizeSV
GPaintType(style.svgStyle().visitedLinkFillPaintType()), |
344 style.svgStyle().fillPaintColor(), style.svgStyle().visitedLinkFillP
aintColor(), | 351 style.svgStyle().fillPaintColor(), style.svgStyle().visitedLinkFillP
aintColor(), |
345 style.svgStyle().fillPaintUri(), style.svgStyle().visitedLinkFillPai
ntUri()); | 352 style.svgStyle().fillPaintUri(), style.svgStyle().visitedLinkFillPai
ntUri()); |
346 case CSSPropertyFlexGrow: | 353 case CSSPropertyFlexGrow: |
347 return createFromDouble(style.flexGrow(), AnimatableDouble::Interpolatio
nIsNonContinuousWithZero); | 354 return createFromDouble(style.flexGrow(), AnimatableDouble::Interpolatio
nIsNonContinuousWithZero); |
348 case CSSPropertyFlexShrink: | 355 case CSSPropertyFlexShrink: |
349 return createFromDouble(style.flexShrink(), AnimatableDouble::Interpolat
ionIsNonContinuousWithZero); | 356 return createFromDouble(style.flexShrink(), AnimatableDouble::Interpolat
ionIsNonContinuousWithZero); |
350 case CSSPropertyFlexBasis: | 357 case CSSPropertyFlexBasis: |
351 return createFromLength(style.flexBasis(), style); | 358 return createFromLength(style.flexBasis(), style); |
352 case CSSPropertyFloodColor: | 359 case CSSPropertyFloodColor: |
353 return createFromColor(property, style); | 360 return createFromColor(property, style); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 case CSSPropertyStrokeDasharray: | 429 case CSSPropertyStrokeDasharray: |
423 return AnimatableStrokeDasharrayList::create(style.strokeDashArray()); | 430 return AnimatableStrokeDasharrayList::create(style.strokeDashArray()); |
424 case CSSPropertyStrokeDashoffset: | 431 case CSSPropertyStrokeDashoffset: |
425 return AnimatableSVGLength::create(style.strokeDashOffset()); | 432 return AnimatableSVGLength::create(style.strokeDashOffset()); |
426 case CSSPropertyStrokeMiterlimit: | 433 case CSSPropertyStrokeMiterlimit: |
427 return createFromDouble(style.strokeMiterLimit()); | 434 return createFromDouble(style.strokeMiterLimit()); |
428 case CSSPropertyStrokeOpacity: | 435 case CSSPropertyStrokeOpacity: |
429 return createFromDouble(style.strokeOpacity()); | 436 return createFromDouble(style.strokeOpacity()); |
430 case CSSPropertyStroke: | 437 case CSSPropertyStroke: |
431 return AnimatableSVGPaint::create( | 438 return AnimatableSVGPaint::create( |
432 style.svgStyle().strokePaintType(), style.svgStyle().visitedLinkStro
kePaintType(), | 439 normalizeSVGPaintType(style.svgStyle().strokePaintType()), normalize
SVGPaintType(style.svgStyle().visitedLinkStrokePaintType()), |
433 style.svgStyle().strokePaintColor(), style.svgStyle().visitedLinkStr
okePaintColor(), | 440 style.svgStyle().strokePaintColor(), style.svgStyle().visitedLinkStr
okePaintColor(), |
434 style.svgStyle().strokePaintUri(), style.svgStyle().visitedLinkStrok
ePaintUri()); | 441 style.svgStyle().strokePaintUri(), style.svgStyle().visitedLinkStrok
ePaintUri()); |
435 case CSSPropertyTextDecorationColor: | 442 case CSSPropertyTextDecorationColor: |
436 return createFromColor(property, style); | 443 return createFromColor(property, style); |
437 case CSSPropertyTextIndent: | 444 case CSSPropertyTextIndent: |
438 return createFromLength(style.textIndent(), style); | 445 return createFromLength(style.textIndent(), style); |
439 case CSSPropertyTextShadow: | 446 case CSSPropertyTextShadow: |
440 return AnimatableShadow::create(style.textShadow()); | 447 return AnimatableShadow::create(style.textShadow()); |
441 case CSSPropertyTop: | 448 case CSSPropertyTop: |
442 return createFromLength(style.top(), style); | 449 return createFromLength(style.top(), style); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 case CSSPropertyZoom: | 516 case CSSPropertyZoom: |
510 return createFromDouble(style.zoom()); | 517 return createFromDouble(style.zoom()); |
511 default: | 518 default: |
512 ASSERT_NOT_REACHED(); | 519 ASSERT_NOT_REACHED(); |
513 // This return value is to avoid a release crash if possible. | 520 // This return value is to avoid a release crash if possible. |
514 return AnimatableUnknown::create(nullptr); | 521 return AnimatableUnknown::create(nullptr); |
515 } | 522 } |
516 } | 523 } |
517 | 524 |
518 } // namespace blink | 525 } // namespace blink |
OLD | NEW |