| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "wtf/TypeTraits.h" | 60 #include "wtf/TypeTraits.h" |
| 61 | 61 |
| 62 namespace WebCore { | 62 namespace WebCore { |
| 63 | 63 |
| 64 namespace { | 64 namespace { |
| 65 | 65 |
| 66 Length animatableValueToLength(const AnimatableValue* value, const StyleResolver
State& state, NumberRange range = AllValues) | 66 Length animatableValueToLength(const AnimatableValue* value, const StyleResolver
State& state, NumberRange range = AllValues) |
| 67 { | 67 { |
| 68 if (value->isLength()) | 68 if (value->isLength()) |
| 69 return toAnimatableLength(value)->toLength(state.cssToLengthConversionDa
ta(), range); | 69 return toAnimatableLength(value)->toLength(state.cssToLengthConversionDa
ta(), range); |
| 70 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSVal
ue(); | 70 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); |
| 71 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); | 71 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); |
| 72 return cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthCo
nversionData()); | 72 return cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthCo
nversionData()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* valu
e, const StyleResolverState& state) | 75 BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* valu
e, const StyleResolverState& state) |
| 76 { | 76 { |
| 77 if (value->isLength()) | 77 if (value->isLength()) |
| 78 return BorderImageLength(toAnimatableLength(value)->toLength(state.cssTo
LengthConversionData(), NonNegativeValues)); | 78 return BorderImageLength(toAnimatableLength(value)->toLength(state.cssTo
LengthConversionData(), NonNegativeValues)); |
| 79 if (value->isDouble()) | 79 if (value->isDouble()) |
| 80 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo
uble(), 0)); | 80 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo
uble(), 0)); |
| 81 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSVal
ue(); | 81 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); |
| 82 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); | 82 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); |
| 83 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s
tate.cssToLengthConversionData())); | 83 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s
tate.cssToLengthConversionData())); |
| 84 } | 84 } |
| 85 | 85 |
| 86 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value,
T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) | 86 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value,
T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) |
| 87 { | 87 { |
| 88 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV
alues); | 88 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV
alues); |
| 89 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max); | 89 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max); |
| 90 } | 90 } |
| 91 | 91 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 return; | 612 return; |
| 613 case CSSPropertyZoom: | 613 case CSSPropertyZoom: |
| 614 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); | 614 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std
::numeric_limits<float>::denorm_min())); |
| 615 return; | 615 return; |
| 616 default: | 616 default: |
| 617 ASSERT_NOT_REACHED(); | 617 ASSERT_NOT_REACHED(); |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 | 620 |
| 621 } // namespace WebCore | 621 } // namespace WebCore |
| OLD | NEW |