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

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

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Correct equality operators and remove dependencies on size() in parser Created 5 years, 6 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)
262 {
263 TransformOperations operation;
264 operation.operations().append(transform);
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 case CSSPropertyShapeOutside: 519 case CSSPropertyShapeOutside:
513 return createFromShapeValue(style.shapeOutside()); 520 return createFromShapeValue(style.shapeOutside());
514 case CSSPropertyShapeMargin: 521 case CSSPropertyShapeMargin:
515 return createFromLength(style.shapeMargin(), style); 522 return createFromLength(style.shapeMargin(), style);
516 case CSSPropertyShapeImageThreshold: 523 case CSSPropertyShapeImageThreshold:
517 return createFromDouble(style.shapeImageThreshold()); 524 return createFromDouble(style.shapeImageThreshold());
518 case CSSPropertyWebkitTextStrokeColor: 525 case CSSPropertyWebkitTextStrokeColor:
519 return createFromColor(property, style); 526 return createFromColor(property, style);
520 case CSSPropertyTransform: 527 case CSSPropertyTransform:
521 return AnimatableTransform::create(style.transform()); 528 return AnimatableTransform::create(style.transform());
529 case CSSPropertyTranslate:
530 return createFromTransformProperties(style.translate());
531 case CSSPropertyRotate:
532 return createFromTransformProperties(style.rotate());
533 case CSSPropertyScale:
534 return createFromTransformProperties(style.scale());
522 case CSSPropertyTransformOrigin: 535 case CSSPropertyTransformOrigin:
523 return createFromTransformOrigin(style.transformOrigin(), style); 536 return createFromTransformOrigin(style.transformOrigin(), style);
524 case CSSPropertyMotionOffset: 537 case CSSPropertyMotionOffset:
525 return createFromLength(style.motionOffset(), style); 538 return createFromLength(style.motionOffset(), style);
526 case CSSPropertyMotionRotation: 539 case CSSPropertyMotionRotation:
527 return createFromDoubleAndBool(style.motionRotation(), style.motionRotat ionType() == MotionRotationAuto, style); 540 return createFromDoubleAndBool(style.motionRotation(), style.motionRotat ionType() == MotionRotationAuto, style);
528 case CSSPropertyWebkitPerspectiveOriginX: 541 case CSSPropertyWebkitPerspectiveOriginX:
529 return createFromLength(style.perspectiveOriginX(), style); 542 return createFromLength(style.perspectiveOriginX(), style);
530 case CSSPropertyWebkitPerspectiveOriginY: 543 case CSSPropertyWebkitPerspectiveOriginY:
531 return createFromLength(style.perspectiveOriginY(), style); 544 return createFromLength(style.perspectiveOriginY(), style);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 return createFromLength(style.svgStyle().ry(), style); 576 return createFromLength(style.svgStyle().ry(), style);
564 case CSSPropertyZIndex: 577 case CSSPropertyZIndex:
565 return createFromDouble(style.zIndex()); 578 return createFromDouble(style.zIndex());
566 default: 579 default:
567 ASSERT_NOT_REACHED(); 580 ASSERT_NOT_REACHED();
568 return nullptr; 581 return nullptr;
569 } 582 }
570 } 583 }
571 584
572 } // namespace blink 585 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698