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 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 unsigned unitTypeCount = 0; | 88 unsigned unitTypeCount = 0; |
| 89 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { | 89 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { |
| 90 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i)); | 90 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i)); |
| 91 if (subType->value()) { | 91 if (subType->value()) { |
| 92 unitTypeCount++; | 92 unitTypeCount++; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 switch (unitTypeCount) { | 96 switch (unitTypeCount) { |
| 97 case 0: | 97 case 0: |
| 98 ASSERT_NOT_REACHED(); | 98 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX); |
|
dstockwell
2015/01/04 23:54:16
Shouldn't we leave the ASSERT_NOT_REACHED here?
dstockwell
2015/01/04 23:54:16
Shouldn't we leave the ASSERT_NOT_REACHED here?
evemj (not active)
2015/01/05 02:28:47
Done.
evemj (not active)
2015/01/05 02:28:48
Done.
Eric Willigers
2015/01/05 02:32:22
Doug may have intended the following:-
ASSERT_N
evemj (not active)
2015/01/05 04:36:57
Done.
| |
| 99 case 1: | 99 case 1: |
| 100 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { | 100 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { |
| 101 const InterpolableNumber *subValueType = toInterpolableNumber(listOf Types->get(i)); | 101 const InterpolableNumber *subValueType = toInterpolableNumber(listOf Types->get(i)); |
| 102 if (subValueType->value()) { | 102 if (subValueType->value()) { |
| 103 double value = toInterpolableNumber(listOfValues->get(i))->value (); | 103 double value = toInterpolableNumber(listOfValues->get(i))->value (); |
| 104 if (range == ValueRangeNonNegative && value < 0) | 104 if (range == ValueRangeNonNegative && value < 0) |
| 105 value = 0; | 105 value = 0; |
| 106 return CSSPrimitiveValue::create(value, toUnitType(i)); | 106 return CSSPrimitiveValue::create(value, toUnitType(i)); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 ASSERT_NOT_REACHED(); | 109 ASSERT_NOT_REACHED(); |
| 110 default: | 110 default: |
| 111 return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpre ssion(nullptr, listOfValuesAndTypes, 0), range)); | 111 return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpre ssion(nullptr, listOfValuesAndTypes, 0), range)); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 void LengthStyleInterpolation::apply(StyleResolverState& state) const | 115 void LengthStyleInterpolation::apply(StyleResolverState& state) const |
| 116 { | 116 { |
| 117 StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(m_cachedV alue.get(), m_range).get()); | 117 StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(m_cachedV alue.get(), m_range).get()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void LengthStyleInterpolation::trace(Visitor* visitor) | 120 void LengthStyleInterpolation::trace(Visitor* visitor) |
| 121 { | 121 { |
| 122 StyleInterpolation::trace(visitor); | 122 StyleInterpolation::trace(visitor); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } | 125 } |
| OLD | NEW |