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

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

Issue 1300323003: Make flex-grow and flex-shrink interpolation continuous with 0 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update test Created 5 years, 4 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 | Annotate | Revision Log
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (length.type() == Percent) { 105 if (length.type() == Percent) {
106 double value = length.value(); 106 double value = length.value();
107 // -100% is used to represent "normal" line height. 107 // -100% is used to represent "normal" line height.
108 if (value == -100) 108 if (value == -100)
109 return AnimatableUnknown::create(CSSValueNormal); 109 return AnimatableUnknown::create(CSSValueNormal);
110 return AnimatableDouble::create(value); 110 return AnimatableDouble::create(value);
111 } 111 }
112 return createFromLength(length, style); 112 return createFromLength(length, style);
113 } 113 }
114 114
115 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromDouble(double va lue, AnimatableDouble::Constraint constraint = AnimatableDouble::Unconstrained) 115 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromDouble(double va lue)
116 { 116 {
117 return AnimatableDouble::create(value, constraint); 117 return AnimatableDouble::create(value);
118 } 118 }
119 119
120 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const ComputedStyle& style) 120 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const ComputedStyle& style)
121 { 121 {
122 return AnimatableLengthBox::create( 122 return AnimatableLengthBox::create(
123 createFromLength(lengthBox.left(), style), 123 createFromLength(lengthBox.left(), style),
124 createFromLength(lengthBox.right(), style), 124 createFromLength(lengthBox.right(), style),
125 createFromLength(lengthBox.top(), style), 125 createFromLength(lengthBox.top(), style),
126 createFromLength(lengthBox.bottom(), style)); 126 createFromLength(lengthBox.bottom(), style));
127 } 127 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 case CSSPropertyColor: 372 case CSSPropertyColor:
373 return createFromColor(property, style); 373 return createFromColor(property, style);
374 case CSSPropertyFillOpacity: 374 case CSSPropertyFillOpacity:
375 return createFromDouble(style.fillOpacity()); 375 return createFromDouble(style.fillOpacity());
376 case CSSPropertyFill: 376 case CSSPropertyFill:
377 return AnimatableSVGPaint::create( 377 return AnimatableSVGPaint::create(
378 normalizeSVGPaintType(style.svgStyle().fillPaintType()), normalizeSV GPaintType(style.svgStyle().visitedLinkFillPaintType()), 378 normalizeSVGPaintType(style.svgStyle().fillPaintType()), normalizeSV GPaintType(style.svgStyle().visitedLinkFillPaintType()),
379 style.svgStyle().fillPaintColor(), style.svgStyle().visitedLinkFillP aintColor(), 379 style.svgStyle().fillPaintColor(), style.svgStyle().visitedLinkFillP aintColor(),
380 style.svgStyle().fillPaintUri(), style.svgStyle().visitedLinkFillPai ntUri()); 380 style.svgStyle().fillPaintUri(), style.svgStyle().visitedLinkFillPai ntUri());
381 case CSSPropertyFlexGrow: 381 case CSSPropertyFlexGrow:
382 return createFromDouble(style.flexGrow(), AnimatableDouble::Interpolatio nIsNonContinuousWithZero); 382 return createFromDouble(style.flexGrow());
383 case CSSPropertyFlexShrink: 383 case CSSPropertyFlexShrink:
384 return createFromDouble(style.flexShrink(), AnimatableDouble::Interpolat ionIsNonContinuousWithZero); 384 return createFromDouble(style.flexShrink());
385 case CSSPropertyFlexBasis: 385 case CSSPropertyFlexBasis:
386 return createFromLength(style.flexBasis(), style); 386 return createFromLength(style.flexBasis(), style);
387 case CSSPropertyFloodColor: 387 case CSSPropertyFloodColor:
388 return createFromColor(property, style); 388 return createFromColor(property, style);
389 case CSSPropertyFloodOpacity: 389 case CSSPropertyFloodOpacity:
390 return createFromDouble(style.floodOpacity()); 390 return createFromDouble(style.floodOpacity());
391 case CSSPropertyFontSize: 391 case CSSPropertyFontSize:
392 // Must pass a specified size to setFontSize if Text Autosizing is enabl ed, but a computed size 392 // Must pass a specified size to setFontSize if Text Autosizing is enabl ed, but a computed size
393 // if text zoom is enabled (if neither is enabled it's irrelevant as the y're probably the same). 393 // if text zoom is enabled (if neither is enabled it's irrelevant as the y're probably the same).
394 // FIXME: Should we introduce an option to pass the computed font size h ere, allowing consumers to 394 // FIXME: Should we introduce an option to pass the computed font size h ere, allowing consumers to
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 return createFromBorderImageLengthBox(style.maskBoxImageWidth(), style); 511 return createFromBorderImageLengthBox(style.maskBoxImageWidth(), style);
512 case CSSPropertyWebkitMaskImage: 512 case CSSPropertyWebkitMaskImage:
513 return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers (), style); 513 return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers (), style);
514 case CSSPropertyWebkitMaskPositionX: 514 case CSSPropertyWebkitMaskPositionX:
515 return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLa yers(), style); 515 return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLa yers(), style);
516 case CSSPropertyWebkitMaskPositionY: 516 case CSSPropertyWebkitMaskPositionY:
517 return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLa yers(), style); 517 return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLa yers(), style);
518 case CSSPropertyWebkitMaskSize: 518 case CSSPropertyWebkitMaskSize:
519 return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers( ), style); 519 return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers( ), style);
520 case CSSPropertyPerspective: 520 case CSSPropertyPerspective:
521 return createFromDouble(style.perspective(), AnimatableDouble::Interpola tionIsNonContinuousWithZero); 521 if (style.perspective() == 0)
522 return AnimatableUnknown::create(CSSPrimitiveValue::createIdentifier (CSSValueNone));
523 return createFromDouble(style.perspective());
522 case CSSPropertyPerspectiveOrigin: 524 case CSSPropertyPerspectiveOrigin:
523 return createFromLengthPoint(style.perspectiveOrigin(), style); 525 return createFromLengthPoint(style.perspectiveOrigin(), style);
524 case CSSPropertyShapeOutside: 526 case CSSPropertyShapeOutside:
525 return createFromShapeValue(style.shapeOutside()); 527 return createFromShapeValue(style.shapeOutside());
526 case CSSPropertyShapeMargin: 528 case CSSPropertyShapeMargin:
527 return createFromLength(style.shapeMargin(), style); 529 return createFromLength(style.shapeMargin(), style);
528 case CSSPropertyShapeImageThreshold: 530 case CSSPropertyShapeImageThreshold:
529 return createFromDouble(style.shapeImageThreshold()); 531 return createFromDouble(style.shapeImageThreshold());
530 case CSSPropertyWebkitTextStrokeColor: 532 case CSSPropertyWebkitTextStrokeColor:
531 return createFromColor(property, style); 533 return createFromColor(property, style);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 if (style.hasAutoZIndex()) 591 if (style.hasAutoZIndex())
590 return AnimatableUnknown::create(CSSValueAuto); 592 return AnimatableUnknown::create(CSSValueAuto);
591 return createFromDouble(style.zIndex()); 593 return createFromDouble(style.zIndex());
592 default: 594 default:
593 ASSERT_NOT_REACHED(); 595 ASSERT_NOT_REACHED();
594 return nullptr; 596 return nullptr;
595 } 597 }
596 } 598 }
597 599
598 } // namespace blink 600 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/animatable/AnimatableDouble.cpp ('k') | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698