| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 return weights[index]; | 257 return weights[index]; |
| 258 } | 258 } |
| 259 | 259 |
| 260 FontDescription::Size animatableValueToFontSize(const AnimatableValue* value) | 260 FontDescription::Size animatableValueToFontSize(const AnimatableValue* value) |
| 261 { | 261 { |
| 262 float size = clampTo<float>(toAnimatableDouble(value)->toDouble(), 0); | 262 float size = clampTo<float>(toAnimatableDouble(value)->toDouble(), 0); |
| 263 return FontDescription::Size(0, size, true); | 263 return FontDescription::Size(0, size, true); |
| 264 } | 264 } |
| 265 | 265 |
| 266 TransformOperation* animatableValueToTransformOperation(const AnimatableValue* v
alue, TransformOperation::OperationType type) |
| 267 { |
| 268 const TransformOperations& transformList = toAnimatableTransform(value)->tra
nsformOperations(); |
| 269 ASSERT(transformList.size() == 1); |
| 270 ASSERT(transformList.operations()[0]->type() == type); |
| 271 return transformList.operations()[0].get(); |
| 272 } |
| 273 |
| 266 } // namespace | 274 } // namespace |
| 267 | 275 |
| 268 // FIXME: Generate this function. | 276 // FIXME: Generate this function. |
| 269 void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
ate& state, const AnimatableValue* value) | 277 void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
ate& state, const AnimatableValue* value) |
| 270 { | 278 { |
| 271 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property)); | 279 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property)); |
| 272 if (value->isUnknown()) { | 280 if (value->isUnknown()) { |
| 273 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)-
>toCSSValue().get()); | 281 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)-
>toCSSValue().get()); |
| 274 return; | 282 return; |
| 275 } | 283 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 case CSSPropertyWebkitTextStrokeColor: | 598 case CSSPropertyWebkitTextStrokeColor: |
| 591 style->setTextStrokeColor(toAnimatableColor(value)->color()); | 599 style->setTextStrokeColor(toAnimatableColor(value)->color()); |
| 592 style->setVisitedLinkTextStrokeColor(toAnimatableColor(value)->visitedLi
nkColor()); | 600 style->setVisitedLinkTextStrokeColor(toAnimatableColor(value)->visitedLi
nkColor()); |
| 593 return; | 601 return; |
| 594 case CSSPropertyTransform: { | 602 case CSSPropertyTransform: { |
| 595 const TransformOperations& operations = toAnimatableTransform(value)->tr
ansformOperations(); | 603 const TransformOperations& operations = toAnimatableTransform(value)->tr
ansformOperations(); |
| 596 // FIXME: This normalization (handling of 'none') should be performed at
input in AnimatableValueFactory. | 604 // FIXME: This normalization (handling of 'none') should be performed at
input in AnimatableValueFactory. |
| 597 style->setTransform(operations.size() ? operations : TransformOperations
(true)); | 605 style->setTransform(operations.size() ? operations : TransformOperations
(true)); |
| 598 return; | 606 return; |
| 599 } | 607 } |
| 608 case CSSPropertyTranslate: { |
| 609 style->setTranslate(toTranslateTransformOperation(animatableValueToTrans
formOperation(value, TransformOperation::Translate3D))); |
| 610 return; |
| 611 } |
| 612 case CSSPropertyRotate: { |
| 613 style->setRotate(toRotateTransformOperation(animatableValueToTransformOp
eration(value, TransformOperation::Rotate3D))); |
| 614 return; |
| 615 } |
| 616 case CSSPropertyScale: { |
| 617 style->setScale(toScaleTransformOperation(animatableValueToTransformOper
ation(value, TransformOperation::Scale3D))); |
| 618 return; |
| 619 } |
| 600 case CSSPropertyTransformOrigin: | 620 case CSSPropertyTransformOrigin: |
| 601 style->setTransformOrigin(animatableValueToTransformOrigin(value, state)
); | 621 style->setTransformOrigin(animatableValueToTransformOrigin(value, state)
); |
| 602 return; | 622 return; |
| 603 case CSSPropertyMotionOffset: | 623 case CSSPropertyMotionOffset: |
| 604 style->setMotionOffset(animatableValueToLength(value, state)); | 624 style->setMotionOffset(animatableValueToLength(value, state)); |
| 605 return; | 625 return; |
| 606 case CSSPropertyMotionRotation: | 626 case CSSPropertyMotionRotation: |
| 607 style->setMotionRotation(toAnimatableDoubleAndBool(value)->toDouble()); | 627 style->setMotionRotation(toAnimatableDoubleAndBool(value)->toDouble()); |
| 608 style->setMotionRotationType(toAnimatableDoubleAndBool(value)->flag() ?
MotionRotationAuto : MotionRotationFixed); | 628 style->setMotionRotationType(toAnimatableDoubleAndBool(value)->flag() ?
MotionRotationAuto : MotionRotationFixed); |
| 609 return; | 629 return; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 case CSSPropertyRy: | 681 case CSSPropertyRy: |
| 662 style->setRy(animatableValueToLength(value, state, ValueRangeNonNegative
)); | 682 style->setRy(animatableValueToLength(value, state, ValueRangeNonNegative
)); |
| 663 return; | 683 return; |
| 664 | 684 |
| 665 default: | 685 default: |
| 666 ASSERT_NOT_REACHED(); | 686 ASSERT_NOT_REACHED(); |
| 667 } | 687 } |
| 668 } | 688 } |
| 669 | 689 |
| 670 } // namespace blink | 690 } // namespace blink |
| OLD | NEW |