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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 LengthPoint animatableValueToLengthPoint(const AnimatableValue* value, const Sty
leResolverState& state, ValueRange range = ValueRangeAll) | 113 LengthPoint animatableValueToLengthPoint(const AnimatableValue* value, const Sty
leResolverState& state, ValueRange range = ValueRangeAll) |
114 { | 114 { |
115 const AnimatableLengthPoint* animatableLengthPoint = toAnimatableLengthPoint
(value); | 115 const AnimatableLengthPoint* animatableLengthPoint = toAnimatableLengthPoint
(value); |
116 return LengthPoint( | 116 return LengthPoint( |
117 animatableValueToLength(animatableLengthPoint->x(), state, range), | 117 animatableValueToLength(animatableLengthPoint->x(), state, range), |
118 animatableValueToLength(animatableLengthPoint->y(), state, range)); | 118 animatableValueToLength(animatableLengthPoint->y(), state, range)); |
119 } | 119 } |
120 | 120 |
| 121 TransformOrigin animatableValueToTransformOrigin(const AnimatableValue* value, c
onst StyleResolverState& state, ValueRange range = ValueRangeAll) |
| 122 { |
| 123 const AnimatableLengthPoint3D* animatableLengthPoint3D = toAnimatableLengthP
oint3D(value); |
| 124 return TransformOrigin( |
| 125 animatableValueToLength(animatableLengthPoint3D->x(), state), |
| 126 animatableValueToLength(animatableLengthPoint3D->y(), state), |
| 127 clampTo<float>(toAnimatableDouble(animatableLengthPoint3D->z())->toDoubl
e()) |
| 128 ); |
| 129 } |
| 130 |
121 LengthSize animatableValueToLengthSize(const AnimatableValue* value, const Style
ResolverState& state, ValueRange range) | 131 LengthSize animatableValueToLengthSize(const AnimatableValue* value, const Style
ResolverState& state, ValueRange range) |
122 { | 132 { |
123 const AnimatableLengthSize* animatableLengthSize = toAnimatableLengthSize(va
lue); | 133 const AnimatableLengthSize* animatableLengthSize = toAnimatableLengthSize(va
lue); |
124 return LengthSize( | 134 return LengthSize( |
125 animatableValueToLength(animatableLengthSize->width(), state, range), | 135 animatableValueToLength(animatableLengthSize->width(), state, range), |
126 animatableValueToLength(animatableLengthSize->height(), state, range)); | 136 animatableValueToLength(animatableLengthSize->height(), state, range)); |
127 } | 137 } |
128 | 138 |
129 void setFillSize(FillLayer* fillLayer, const AnimatableValue* value, const Style
ResolverState& state) | 139 void setFillSize(FillLayer* fillLayer, const AnimatableValue* value, const Style
ResolverState& state) |
130 { | 140 { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 case CSSPropertyWebkitTextStrokeColor: | 585 case CSSPropertyWebkitTextStrokeColor: |
576 style->setTextStrokeColor(toAnimatableColor(value)->color()); | 586 style->setTextStrokeColor(toAnimatableColor(value)->color()); |
577 style->setVisitedLinkTextStrokeColor(toAnimatableColor(value)->visitedLi
nkColor()); | 587 style->setVisitedLinkTextStrokeColor(toAnimatableColor(value)->visitedLi
nkColor()); |
578 return; | 588 return; |
579 case CSSPropertyTransform: { | 589 case CSSPropertyTransform: { |
580 const TransformOperations& operations = toAnimatableTransform(value)->tr
ansformOperations(); | 590 const TransformOperations& operations = toAnimatableTransform(value)->tr
ansformOperations(); |
581 // FIXME: This normalization (handling of 'none') should be performed at
input in AnimatableValueFactory. | 591 // FIXME: This normalization (handling of 'none') should be performed at
input in AnimatableValueFactory. |
582 style->setTransform(operations.size() ? operations : TransformOperations
(true)); | 592 style->setTransform(operations.size() ? operations : TransformOperations
(true)); |
583 return; | 593 return; |
584 } | 594 } |
585 case CSSPropertyTransformOrigin: { | 595 case CSSPropertyTransformOrigin: |
586 const AnimatableLengthPoint3D* animatableLengthPoint3D = toAnimatableLen
gthPoint3D(value); | 596 style->setTransformOrigin(animatableValueToTransformOrigin(value, state)
); |
587 style->setTransformOriginX(animatableValueToLength(animatableLengthPoint
3D->x(), state)); | |
588 style->setTransformOriginY(animatableValueToLength(animatableLengthPoint
3D->y(), state)); | |
589 style->setTransformOriginZ(clampTo<float>(toAnimatableDouble(animatableL
engthPoint3D->z())->toDouble())); | |
590 return; | 597 return; |
591 } | |
592 case CSSPropertyWidows: | 598 case CSSPropertyWidows: |
593 style->setWidows(animatableValueRoundClampTo<unsigned short>(value, 1)); | 599 style->setWidows(animatableValueRoundClampTo<unsigned short>(value, 1)); |
594 return; | 600 return; |
595 case CSSPropertyWidth: | 601 case CSSPropertyWidth: |
596 style->setWidth(animatableValueToLength(value, state, ValueRangeNonNegat
ive)); | 602 style->setWidth(animatableValueToLength(value, state, ValueRangeNonNegat
ive)); |
597 return; | 603 return; |
598 case CSSPropertyWordSpacing: | 604 case CSSPropertyWordSpacing: |
599 style->setWordSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble
())); | 605 style->setWordSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble
())); |
600 return; | 606 return; |
601 case CSSPropertyVerticalAlign: | 607 case CSSPropertyVerticalAlign: |
602 style->setVerticalAlignLength(animatableValueToLength(value, state)); | 608 style->setVerticalAlignLength(animatableValueToLength(value, state)); |
603 return; | 609 return; |
604 case CSSPropertyVisibility: | 610 case CSSPropertyVisibility: |
605 style->setVisibility(toAnimatableVisibility(value)->visibility()); | 611 style->setVisibility(toAnimatableVisibility(value)->visibility()); |
606 return; | 612 return; |
607 case CSSPropertyZIndex: | 613 case CSSPropertyZIndex: |
608 style->setZIndex(animatableValueRoundClampTo<int>(value)); | 614 style->setZIndex(animatableValueRoundClampTo<int>(value)); |
609 return; | 615 return; |
610 case CSSPropertyZoom: | 616 case CSSPropertyZoom: |
611 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); | 617 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); |
612 return; | 618 return; |
613 default: | 619 default: |
614 ASSERT_NOT_REACHED(); | 620 ASSERT_NOT_REACHED(); |
615 } | 621 } |
616 } | 622 } |
617 | 623 |
618 } // namespace blink | 624 } // namespace blink |
OLD | NEW |