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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 static double fontStretchToDouble(FontStretch fontStretch) | 251 static double fontStretchToDouble(FontStretch fontStretch) |
252 { | 252 { |
253 return static_cast<unsigned>(fontStretch); | 253 return static_cast<unsigned>(fontStretch); |
254 } | 254 } |
255 | 255 |
256 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFontStretch(FontStretch fontStretch) | 256 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFontStretch(FontStretch fontStretch) |
257 { | 257 { |
258 return createFromDouble(fontStretchToDouble(fontStretch)); | 258 return createFromDouble(fontStretchToDouble(fontStretch)); |
259 } | 259 } |
260 | 260 |
261 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromTransformProperties(Pas sRefPtr<TransformOperation> transform, PassRefPtr<TransformOperation> initialTra nsform) | |
262 { | |
263 TransformOperations operation; | |
264 if (transform) { | |
265 operation.operations().append(transform); | |
266 } else { | |
267 operation.operations().append(initialTransform); | |
268 } | |
alancutter (OOO until 2018)
2015/06/24 01:17:09
This could use a ternary.
soonm
2015/06/24 02:53:19
Done - Changed to use ternary operation
| |
269 return AnimatableTransform::create(operation); | |
270 } | |
271 | |
261 static double fontWeightToDouble(FontWeight fontWeight) | 272 static double fontWeightToDouble(FontWeight fontWeight) |
262 { | 273 { |
263 switch (fontWeight) { | 274 switch (fontWeight) { |
264 case FontWeight100: | 275 case FontWeight100: |
265 return 100; | 276 return 100; |
266 case FontWeight200: | 277 case FontWeight200: |
267 return 200; | 278 return 200; |
268 case FontWeight300: | 279 case FontWeight300: |
269 return 300; | 280 return 300; |
270 case FontWeight400: | 281 case FontWeight400: |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 case CSSPropertyShapeOutside: | 527 case CSSPropertyShapeOutside: |
517 return createFromShapeValue(style.shapeOutside()); | 528 return createFromShapeValue(style.shapeOutside()); |
518 case CSSPropertyShapeMargin: | 529 case CSSPropertyShapeMargin: |
519 return createFromLength(style.shapeMargin(), style); | 530 return createFromLength(style.shapeMargin(), style); |
520 case CSSPropertyShapeImageThreshold: | 531 case CSSPropertyShapeImageThreshold: |
521 return createFromDouble(style.shapeImageThreshold()); | 532 return createFromDouble(style.shapeImageThreshold()); |
522 case CSSPropertyWebkitTextStrokeColor: | 533 case CSSPropertyWebkitTextStrokeColor: |
523 return createFromColor(property, style); | 534 return createFromColor(property, style); |
524 case CSSPropertyTransform: | 535 case CSSPropertyTransform: |
525 return AnimatableTransform::create(style.transform()); | 536 return AnimatableTransform::create(style.transform()); |
537 case CSSPropertyTranslate: | |
538 return createFromTransformProperties(style.translate(), style.initialTra nslate()); | |
539 case CSSPropertyRotate: | |
540 return createFromTransformProperties(style.rotate(), style.initialRotate ()); | |
541 case CSSPropertyScale: | |
542 return createFromTransformProperties(style.scale(), style.initialScale() ); | |
526 case CSSPropertyTransformOrigin: | 543 case CSSPropertyTransformOrigin: |
527 return createFromTransformOrigin(style.transformOrigin(), style); | 544 return createFromTransformOrigin(style.transformOrigin(), style); |
528 case CSSPropertyMotionOffset: | 545 case CSSPropertyMotionOffset: |
529 return createFromLength(style.motionOffset(), style); | 546 return createFromLength(style.motionOffset(), style); |
530 case CSSPropertyMotionRotation: | 547 case CSSPropertyMotionRotation: |
531 return createFromDoubleAndBool(style.motionRotation(), style.motionRotat ionType() == MotionRotationAuto, style); | 548 return createFromDoubleAndBool(style.motionRotation(), style.motionRotat ionType() == MotionRotationAuto, style); |
532 case CSSPropertyWebkitPerspectiveOriginX: | 549 case CSSPropertyWebkitPerspectiveOriginX: |
533 return createFromLength(style.perspectiveOriginX(), style); | 550 return createFromLength(style.perspectiveOriginX(), style); |
534 case CSSPropertyWebkitPerspectiveOriginY: | 551 case CSSPropertyWebkitPerspectiveOriginY: |
535 return createFromLength(style.perspectiveOriginY(), style); | 552 return createFromLength(style.perspectiveOriginY(), style); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 if (style.hasAutoZIndex()) | 586 if (style.hasAutoZIndex()) |
570 return AnimatableUnknown::create(CSSValueAuto); | 587 return AnimatableUnknown::create(CSSValueAuto); |
571 return createFromDouble(style.zIndex()); | 588 return createFromDouble(style.zIndex()); |
572 default: | 589 default: |
573 ASSERT_NOT_REACHED(); | 590 ASSERT_NOT_REACHED(); |
574 return nullptr; | 591 return nullptr; |
575 } | 592 } |
576 } | 593 } |
577 | 594 |
578 } // namespace blink | 595 } // namespace blink |
OLD | NEW |