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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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> T animatableValueRoundClampTo(const AnimatableValue* value,
T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) |
88 { | 88 { |
89 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV
alues); | 89 static_assert(WTF::IsInteger<T>::value, "should use integral type T when rou
nding values"); |
90 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max); | 90 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max); |
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), |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 return; | 624 return; |
625 case CSSPropertyZoom: | 625 case CSSPropertyZoom: |
626 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); | 626 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); |
627 return; | 627 return; |
628 default: | 628 default: |
629 ASSERT_NOT_REACHED(); | 629 ASSERT_NOT_REACHED(); |
630 } | 630 } |
631 } | 631 } |
632 | 632 |
633 } // namespace blink | 633 } // namespace blink |
OLD | NEW |