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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 { | 77 { |
78 if (value->isLength()) | 78 if (value->isLength()) |
79 return BorderImageLength(toAnimatableLength(value)->length(state.style()
->effectiveZoom(), ValueRangeNonNegative)); | 79 return BorderImageLength(toAnimatableLength(value)->length(state.style()
->effectiveZoom(), ValueRangeNonNegative)); |
80 if (value->isDouble()) | 80 if (value->isDouble()) |
81 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo
uble(), 0)); | 81 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo
uble(), 0)); |
82 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSVal
ue(); | 82 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSVal
ue(); |
83 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); | 83 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); |
84 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s
tate.cssToLengthConversionData())); | 84 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s
tate.cssToLengthConversionData())); |
85 } | 85 } |
86 | 86 |
87 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value,
T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) | 87 template<typename T, typename... Args> T animatableValueRoundClampTo(const Anima
tableValue* value, Args... args) |
88 { | 88 { |
89 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV
alues); | 89 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV
alues); |
90 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max); | 90 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), args...); |
91 } | 91 } |
92 | 92 |
93 LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleRe
solverState& state, ValueRange range = ValueRangeAll) | 93 LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleRe
solverState& state, ValueRange range = ValueRangeAll) |
94 { | 94 { |
95 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value
); | 95 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value
); |
96 return LengthBox( | 96 return LengthBox( |
97 animatableValueToLength(animatableLengthBox->top(), state, range), | 97 animatableValueToLength(animatableLengthBox->top(), state, range), |
98 animatableValueToLength(animatableLengthBox->right(), state, range), | 98 animatableValueToLength(animatableLengthBox->right(), state, range), |
99 animatableValueToLength(animatableLengthBox->bottom(), state, range), | 99 animatableValueToLength(animatableLengthBox->bottom(), state, range), |
100 animatableValueToLength(animatableLengthBox->left(), state, range)); | 100 animatableValueToLength(animatableLengthBox->left(), state, range)); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 return; | 615 return; |
616 case CSSPropertyZoom: | 616 case CSSPropertyZoom: |
617 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())); |
618 return; | 618 return; |
619 default: | 619 default: |
620 ASSERT_NOT_REACHED(); | 620 ASSERT_NOT_REACHED(); |
621 } | 621 } |
622 } | 622 } |
623 | 623 |
624 } // namespace blink | 624 } // namespace blink |
OLD | NEW |