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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/animation/css/CSSAnimatableValueFactory.h" | 31 #include "core/animation/css/CSSAnimatableValueFactory.h" |
32 | 32 |
33 #include "core/CSSValueKeywords.h" | 33 #include "core/CSSValueKeywords.h" |
| 34 #include "core/animation/FontWeightConversion.h" |
34 #include "core/animation/LengthPropertyFunctions.h" | 35 #include "core/animation/LengthPropertyFunctions.h" |
35 #include "core/animation/PropertyHandle.h" | 36 #include "core/animation/PropertyHandle.h" |
36 #include "core/animation/animatable/AnimatableClipPathOperation.h" | 37 #include "core/animation/animatable/AnimatableClipPathOperation.h" |
37 #include "core/animation/animatable/AnimatableColor.h" | 38 #include "core/animation/animatable/AnimatableColor.h" |
38 #include "core/animation/animatable/AnimatableDouble.h" | 39 #include "core/animation/animatable/AnimatableDouble.h" |
39 #include "core/animation/animatable/AnimatableDoubleAndBool.h" | 40 #include "core/animation/animatable/AnimatableDoubleAndBool.h" |
40 #include "core/animation/animatable/AnimatableFilterOperations.h" | 41 #include "core/animation/animatable/AnimatableFilterOperations.h" |
41 #include "core/animation/animatable/AnimatableImage.h" | 42 #include "core/animation/animatable/AnimatableImage.h" |
42 #include "core/animation/animatable/AnimatableLength.h" | 43 #include "core/animation/animatable/AnimatableLength.h" |
43 #include "core/animation/animatable/AnimatableLengthBox.h" | 44 #include "core/animation/animatable/AnimatableLengthBox.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 static PassRefPtr<AnimatableValue> createFromTransformProperties( | 303 static PassRefPtr<AnimatableValue> createFromTransformProperties( |
303 PassRefPtr<TransformOperation> transform, | 304 PassRefPtr<TransformOperation> transform, |
304 double zoom, | 305 double zoom, |
305 PassRefPtr<TransformOperation> initialTransform) { | 306 PassRefPtr<TransformOperation> initialTransform) { |
306 TransformOperations operation; | 307 TransformOperations operation; |
307 if (transform || initialTransform) | 308 if (transform || initialTransform) |
308 operation.operations().push_back(transform ? transform : initialTransform); | 309 operation.operations().push_back(transform ? transform : initialTransform); |
309 return AnimatableTransform::create(operation, transform ? zoom : 1); | 310 return AnimatableTransform::create(operation, transform ? zoom : 1); |
310 } | 311 } |
311 | 312 |
312 static double fontWeightToDouble(FontWeight fontWeight) { | |
313 switch (fontWeight) { | |
314 case FontWeight100: | |
315 return 100; | |
316 case FontWeight200: | |
317 return 200; | |
318 case FontWeight300: | |
319 return 300; | |
320 case FontWeight400: | |
321 return 400; | |
322 case FontWeight500: | |
323 return 500; | |
324 case FontWeight600: | |
325 return 600; | |
326 case FontWeight700: | |
327 return 700; | |
328 case FontWeight800: | |
329 return 800; | |
330 case FontWeight900: | |
331 return 900; | |
332 } | |
333 | |
334 NOTREACHED(); | |
335 return 400; | |
336 } | |
337 | |
338 static PassRefPtr<AnimatableValue> createFromFontWeight(FontWeight fontWeight) { | 313 static PassRefPtr<AnimatableValue> createFromFontWeight(FontWeight fontWeight) { |
339 return createFromDouble(fontWeightToDouble(fontWeight)); | 314 return createFromDouble(fontWeightToDouble(fontWeight)); |
340 } | 315 } |
341 | 316 |
342 static SVGPaintType normalizeSVGPaintType(SVGPaintType paintType) { | 317 static SVGPaintType normalizeSVGPaintType(SVGPaintType paintType) { |
343 // If the <paint> is 'currentColor', then create an AnimatableSVGPaint with | 318 // If the <paint> is 'currentColor', then create an AnimatableSVGPaint with |
344 // a <rgbcolor> type. This is similar in vein to the handling of colors. | 319 // a <rgbcolor> type. This is similar in vein to the handling of colors. |
345 return paintType == SVG_PAINTTYPE_CURRENTCOLOR ? SVG_PAINTTYPE_RGBCOLOR | 320 return paintType == SVG_PAINTTYPE_CURRENTCOLOR ? SVG_PAINTTYPE_RGBCOLOR |
346 : paintType; | 321 : paintType; |
347 } | 322 } |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 if (style.hasAutoZIndex()) | 661 if (style.hasAutoZIndex()) |
687 return AnimatableUnknown::create(CSSValueAuto); | 662 return AnimatableUnknown::create(CSSValueAuto); |
688 return createFromDouble(style.zIndex()); | 663 return createFromDouble(style.zIndex()); |
689 default: | 664 default: |
690 NOTREACHED(); | 665 NOTREACHED(); |
691 return nullptr; | 666 return nullptr; |
692 } | 667 } |
693 } | 668 } |
694 | 669 |
695 } // namespace blink | 670 } // namespace blink |
OLD | NEW |