| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return toCSSPrimitiveValue(range)->convertToLength<AnyConversion>(conversion
Data); | 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 // FIXME(crbug.com/168840): Support for viewport units in calc needs to be a
dded before we can blend them with other units. |
| 101 if (isViewportUnit() || length->isViewportUnit()) |
| 102 return defaultInterpolateTo(this, value, fraction); |
| 103 |
| 100 return AnimatableLength::create(scale(1 - fraction).get(), length->scale(fra
ction).get()); | 104 return AnimatableLength::create(scale(1 - fraction).get(), length->scale(fra
ction).get()); |
| 101 } | 105 } |
| 102 | 106 |
| 103 PassRefPtr<AnimatableValue> AnimatableLength::addWith(const AnimatableValue* val
ue) const | 107 PassRefPtr<AnimatableValue> AnimatableLength::addWith(const AnimatableValue* val
ue) const |
| 104 { | 108 { |
| 105 // Optimization for adding with 0. | 109 // Optimization for adding with 0. |
| 106 if (isUnitlessZero()) | 110 if (isUnitlessZero()) |
| 107 return takeConstRef(value); | 111 return takeConstRef(value); |
| 108 | 112 |
| 109 const AnimatableLength* length = toAnimatableLength(value); | 113 const AnimatableLength* length = toAnimatableLength(value); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 case UnitTypeViewportMax: | 232 case UnitTypeViewportMax: |
| 229 return CSSPrimitiveValue::CSS_VMAX; | 233 return CSSPrimitiveValue::CSS_VMAX; |
| 230 case UnitTypeCalc: | 234 case UnitTypeCalc: |
| 231 return CSSPrimitiveValue::CSS_UNKNOWN; | 235 return CSSPrimitiveValue::CSS_UNKNOWN; |
| 232 } | 236 } |
| 233 ASSERT_NOT_REACHED(); | 237 ASSERT_NOT_REACHED(); |
| 234 return CSSPrimitiveValue::CSS_UNKNOWN; | 238 return CSSPrimitiveValue::CSS_UNKNOWN; |
| 235 } | 239 } |
| 236 | 240 |
| 237 } // namespace WebCore | 241 } // namespace WebCore |
| OLD | NEW |