Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 1196913005: Implement animations for Independent CSS Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix rotate-interpolation test Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 operation.operations().append(transform ? transform : initialTransform);
265 return AnimatableTransform::create(operation);
266 }
267
261 static double fontWeightToDouble(FontWeight fontWeight) 268 static double fontWeightToDouble(FontWeight fontWeight)
262 { 269 {
263 switch (fontWeight) { 270 switch (fontWeight) {
264 case FontWeight100: 271 case FontWeight100:
265 return 100; 272 return 100;
266 case FontWeight200: 273 case FontWeight200:
267 return 200; 274 return 200;
268 case FontWeight300: 275 case FontWeight300:
269 return 300; 276 return 300;
270 case FontWeight400: 277 case FontWeight400:
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 case CSSPropertyShapeOutside: 523 case CSSPropertyShapeOutside:
517 return createFromShapeValue(style.shapeOutside()); 524 return createFromShapeValue(style.shapeOutside());
518 case CSSPropertyShapeMargin: 525 case CSSPropertyShapeMargin:
519 return createFromLength(style.shapeMargin(), style); 526 return createFromLength(style.shapeMargin(), style);
520 case CSSPropertyShapeImageThreshold: 527 case CSSPropertyShapeImageThreshold:
521 return createFromDouble(style.shapeImageThreshold()); 528 return createFromDouble(style.shapeImageThreshold());
522 case CSSPropertyWebkitTextStrokeColor: 529 case CSSPropertyWebkitTextStrokeColor:
523 return createFromColor(property, style); 530 return createFromColor(property, style);
524 case CSSPropertyTransform: 531 case CSSPropertyTransform:
525 return AnimatableTransform::create(style.transform()); 532 return AnimatableTransform::create(style.transform());
533 case CSSPropertyTranslate:
534 return createFromTransformProperties(style.translate(), style.initialTra nslate());
535 case CSSPropertyRotate:
536 return createFromTransformProperties(style.rotate(), style.initialRotate ());
537 case CSSPropertyScale:
538 return createFromTransformProperties(style.scale(), style.initialScale() );
526 case CSSPropertyTransformOrigin: 539 case CSSPropertyTransformOrigin:
527 return createFromTransformOrigin(style.transformOrigin(), style); 540 return createFromTransformOrigin(style.transformOrigin(), style);
528 case CSSPropertyMotionOffset: 541 case CSSPropertyMotionOffset:
529 return createFromLength(style.motionOffset(), style); 542 return createFromLength(style.motionOffset(), style);
530 case CSSPropertyMotionRotation: 543 case CSSPropertyMotionRotation:
531 return createFromDoubleAndBool(style.motionRotation(), style.motionRotat ionType() == MotionRotationAuto, style); 544 return createFromDoubleAndBool(style.motionRotation(), style.motionRotat ionType() == MotionRotationAuto, style);
532 case CSSPropertyWebkitPerspectiveOriginX: 545 case CSSPropertyWebkitPerspectiveOriginX:
533 return createFromLength(style.perspectiveOriginX(), style); 546 return createFromLength(style.perspectiveOriginX(), style);
534 case CSSPropertyWebkitPerspectiveOriginY: 547 case CSSPropertyWebkitPerspectiveOriginY:
535 return createFromLength(style.perspectiveOriginY(), style); 548 return createFromLength(style.perspectiveOriginY(), style);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (style.hasAutoZIndex()) 582 if (style.hasAutoZIndex())
570 return AnimatableUnknown::create(CSSValueAuto); 583 return AnimatableUnknown::create(CSSValueAuto);
571 return createFromDouble(style.zIndex()); 584 return createFromDouble(style.zIndex());
572 default: 585 default:
573 ASSERT_NOT_REACHED(); 586 ASSERT_NOT_REACHED();
574 return nullptr; 587 return nullptr;
575 } 588 }
576 } 589 }
577 590
578 } // namespace blink 591 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/StringKeyframe.cpp ('k') | Source/core/animation/css/CSSPropertyEquality.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698