| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return primitiveUnitToNumberType(primitiveValue->primitiveType(), unitTy
pe); | 72 return primitiveUnitToNumberType(primitiveValue->primitiveType(), unitTy
pe); |
| 73 } | 73 } |
| 74 return value->isCalcValue(); | 74 return value->isCalcValue(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 PassRefPtr<CSSValue> AnimatableLength::toCSSValue(NumberRange range) const | 77 PassRefPtr<CSSValue> AnimatableLength::toCSSValue(NumberRange range) const |
| 78 { | 78 { |
| 79 return toCSSPrimitiveValue(range); | 79 return toCSSPrimitiveValue(range); |
| 80 } | 80 } |
| 81 | 81 |
| 82 Length AnimatableLength::toLength(const RenderStyle* style, const RenderStyle* r
ootStyle, double zoom, NumberRange range) const | 82 Length AnimatableLength::toLength(const CSSToLengthConversionData& conversionDat
a, NumberRange range) const |
| 83 { | 83 { |
| 84 // Avoid creating a CSSValue in the common cases | 84 // Avoid creating a CSSValue in the common cases |
| 85 if (m_unitType == UnitTypePixels) | 85 if (m_unitType == UnitTypePixels) |
| 86 return Length(clampedNumber(range) * zoom, Fixed); | 86 return Length(clampedNumber(range) * conversionData.zoom(), Fixed); |
| 87 if (m_unitType == UnitTypePercentage) | 87 if (m_unitType == UnitTypePercentage) |
| 88 return Length(clampedNumber(range), Percent); | 88 return Length(clampedNumber(range), Percent); |
| 89 | 89 |
| 90 return toCSSPrimitiveValue(range)->convertToLength<AnyConversion>(style, roo
tStyle, zoom); | 90 return toCSSPrimitiveValue(range)->convertToLength<AnyConversion>(conversion
Data); |
| 91 } | 91 } |
| 92 | 92 |
| 93 PassRefPtr<AnimatableValue> AnimatableLength::interpolateTo(const AnimatableValu
e* value, double fraction) const | 93 PassRefPtr<AnimatableValue> AnimatableLength::interpolateTo(const AnimatableValu
e* value, double fraction) const |
| 94 { | 94 { |
| 95 const AnimatableLength* length = toAnimatableLength(value); | 95 const AnimatableLength* length = toAnimatableLength(value); |
| 96 NumberUnitType type = commonUnitType(length); | 96 NumberUnitType type = commonUnitType(length); |
| 97 if (type != UnitTypeCalc) | 97 if (type != UnitTypeCalc) |
| 98 return AnimatableLength::create(blend(m_number, length->m_number, fracti
on), type); | 98 return AnimatableLength::create(blend(m_number, length->m_number, fracti
on), type); |
| 99 | 99 |
| 100 return AnimatableLength::create(scale(1 - fraction).get(), length->scale(fra
ction).get()); | 100 return AnimatableLength::create(scale(1 - fraction).get(), length->scale(fra
ction).get()); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 case UnitTypeViewportMax: | 228 case UnitTypeViewportMax: |
| 229 return CSSPrimitiveValue::CSS_VMAX; | 229 return CSSPrimitiveValue::CSS_VMAX; |
| 230 case UnitTypeCalc: | 230 case UnitTypeCalc: |
| 231 return CSSPrimitiveValue::CSS_UNKNOWN; | 231 return CSSPrimitiveValue::CSS_UNKNOWN; |
| 232 } | 232 } |
| 233 ASSERT_NOT_REACHED(); | 233 ASSERT_NOT_REACHED(); |
| 234 return CSSPrimitiveValue::CSS_UNKNOWN; | 234 return CSSPrimitiveValue::CSS_UNKNOWN; |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace WebCore | 237 } // namespace WebCore |
| OLD | NEW |