Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/LengthStyleInterpolation.h" | 6 #include "core/animation/LengthStyleInterpolation.h" |
| 7 | 7 |
| 8 #include "core/css/CSSCalculationValue.h" | 8 #include "core/css/CSSCalculationValue.h" |
| 9 #include "core/css/resolver/StyleBuilder.h" | 9 #include "core/css/resolver/StyleBuilder.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 bool LengthStyleInterpolation::canCreateFrom(const CSSValue& value) | 13 bool LengthStyleInterpolation::canCreateFrom(const CSSValue& value) |
| 14 { | 14 { |
| 15 if (value.isPrimitiveValue()) { | 15 if (value.isPrimitiveValue()) { |
| 16 const CSSPrimitiveValue& primitiveValue = blink::toCSSPrimitiveValue(val ue); | 16 const CSSPrimitiveValue& primitiveValue = blink::toCSSPrimitiveValue(val ue); |
| 17 if (primitiveValue.cssCalcValue()) | 17 if (primitiveValue.cssCalcValue()) |
| 18 return true; | 18 return true; |
| 19 | 19 |
| 20 CSSPrimitiveValue::LengthUnitType type; | 20 CSSPrimitiveValue::LengthUnitType type; |
| 21 // Only returns true if the type is a primitive length unit. | 21 // Only returns true if the type is a primitive length unit. |
| 22 return CSSPrimitiveValue::unitTypeToLengthUnitType(primitiveValue.primit iveType(), type); | 22 return CSSPrimitiveValue::unitTypeToLengthUnitType(primitiveValue.primit iveType(), type); |
| 23 } | 23 } |
| 24 return value.isCalcValue(); | 24 return value.isCalcValue(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthStyleInterpolation::lengthToInte rpolableValue(const CSSValue& value) | 27 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthStyleInterpolation::lengthToInte rpolableValue(const CSSValue& value) |
| 28 { | 28 { |
| 29 ASSERT(canCreateFrom(value)); | |
|
alancutter (OOO until 2018)
2015/02/04 20:24:37
Leave this assert in.
jadeg
2015/02/05 23:37:02
Done.
| |
| 30 OwnPtrWillBeRawPtr<InterpolableList> listOfValuesAndTypes = InterpolableList ::create(2); | 29 OwnPtrWillBeRawPtr<InterpolableList> listOfValuesAndTypes = InterpolableList ::create(2); |
| 31 OwnPtrWillBeRawPtr<InterpolableList> listOfValues = InterpolableList::create (CSSPrimitiveValue::LengthUnitTypeCount); | 30 OwnPtrWillBeRawPtr<InterpolableList> listOfValues = InterpolableList::create (CSSPrimitiveValue::LengthUnitTypeCount); |
| 32 OwnPtrWillBeRawPtr<InterpolableList> listOfTypes = InterpolableList::create( CSSPrimitiveValue::LengthUnitTypeCount); | 31 OwnPtrWillBeRawPtr<InterpolableList> listOfTypes = InterpolableList::create( CSSPrimitiveValue::LengthUnitTypeCount); |
| 33 | 32 |
| 34 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value); | 33 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value); |
| 35 | 34 |
| 36 CSSLengthArray arrayOfValues; | 35 CSSLengthArray arrayOfValues; |
| 37 CSSPrimitiveValue::CSSLengthTypeArray arrayOfTypes; | 36 CSSPrimitiveValue::CSSLengthTypeArray arrayOfTypes; |
| 38 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) | 37 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) |
| 39 arrayOfValues.append(0); | 38 arrayOfValues.append(0); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 { | 118 { |
| 120 StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(m_cachedV alue.get(), m_range).get()); | 119 StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(m_cachedV alue.get(), m_range).get()); |
| 121 } | 120 } |
| 122 | 121 |
| 123 void LengthStyleInterpolation::trace(Visitor* visitor) | 122 void LengthStyleInterpolation::trace(Visitor* visitor) |
| 124 { | 123 { |
| 125 StyleInterpolation::trace(visitor); | 124 StyleInterpolation::trace(visitor); |
| 126 } | 125 } |
| 127 | 126 |
| 128 } | 127 } |
| OLD | NEW |