| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "wtf/MathExtras.h" | 56 #include "wtf/MathExtras.h" |
| 57 #include "wtf/TypeTraits.h" | 57 #include "wtf/TypeTraits.h" |
| 58 | 58 |
| 59 namespace blink { | 59 namespace blink { |
| 60 | 60 |
| 61 namespace { | 61 namespace { |
| 62 | 62 |
| 63 Length animatableValueToLength(const AnimatableValue* value, const StyleResolver
State& state, ValueRange range = ValueRangeAll) | 63 Length animatableValueToLength(const AnimatableValue* value, const StyleResolver
State& state, ValueRange range = ValueRangeAll) |
| 64 { | 64 { |
| 65 if (value->isLength()) | 65 if (value->isLength()) |
| 66 return toAnimatableLength(value)->length(state.style()->effectiveZoom(),
range); | 66 return toAnimatableLength(value)->length(range); |
| 67 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); | 67 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); |
| 68 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); | 68 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); |
| 69 return cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthCo
nversionData()); | 69 return cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthCo
nversionData()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* valu
e, const StyleResolverState& state) | 72 BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* valu
e, const StyleResolverState& state) |
| 73 { | 73 { |
| 74 if (value->isLength()) | 74 if (value->isLength()) |
| 75 return BorderImageLength(toAnimatableLength(value)->length(state.style()
->effectiveZoom(), ValueRangeNonNegative)); | 75 return BorderImageLength(toAnimatableLength(value)->length(ValueRangeNon
Negative)); |
| 76 if (value->isDouble()) | 76 if (value->isDouble()) |
| 77 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo
uble(), 0)); | 77 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDo
uble(), 0)); |
| 78 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); | 78 RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue(); |
| 79 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); | 79 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get()); |
| 80 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s
tate.cssToLengthConversionData())); | 80 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(s
tate.cssToLengthConversionData())); |
| 81 } | 81 } |
| 82 | 82 |
| 83 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value,
T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) | 83 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value,
T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) |
| 84 { | 84 { |
| 85 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV
alues); | 85 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingV
alues); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 return; | 510 return; |
| 511 case CSSPropertyZIndex: | 511 case CSSPropertyZIndex: |
| 512 style->setZIndex(animatableValueRoundClampTo<int>(value)); | 512 style->setZIndex(animatableValueRoundClampTo<int>(value)); |
| 513 return; | 513 return; |
| 514 default: | 514 default: |
| 515 ASSERT_NOT_REACHED(); | 515 ASSERT_NOT_REACHED(); |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| 519 } // namespace blink | 519 } // namespace blink |
| OLD | NEW |