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 "core/animation/LengthStyleInterpolation.h" | 5 #include "core/animation/LengthStyleInterpolation.h" |
6 | 6 |
7 #include "core/animation/LengthPropertyFunctions.h" | 7 #include "core/animation/LengthPropertyFunctions.h" |
8 #include "core/animation/css/CSSAnimatableValueFactory.h" | 8 #include "core/animation/css/CSSAnimatableValueFactory.h" |
9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
10 #include "core/css/resolver/StyleBuilder.h" | 10 #include "core/css/resolver/StyleBuilder.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (hasPixels && hasPercent) | 113 if (hasPixels && hasPercent) |
114 return Length(CalculationValue::create(pixelsAndPercent, range)); | 114 return Length(CalculationValue::create(pixelsAndPercent, range)); |
115 if (hasPixels) | 115 if (hasPixels) |
116 return Length(CSSPrimitiveValue::clampToCSSLengthRange(clampToRange(pixe
lsAndPercent.pixels, range)), Fixed); | 116 return Length(CSSPrimitiveValue::clampToCSSLengthRange(clampToRange(pixe
lsAndPercent.pixels, range)), Fixed); |
117 if (hasPercent) | 117 if (hasPercent) |
118 return Length(clampToRange(pixelsAndPercent.percent, range), Percent); | 118 return Length(clampToRange(pixelsAndPercent.percent, range), Percent); |
119 ASSERT_NOT_REACHED(); | 119 ASSERT_NOT_REACHED(); |
120 return Length(0, Fixed); | 120 return Length(0, Fixed); |
121 } | 121 } |
122 | 122 |
123 } | 123 } // namespace |
124 | 124 |
125 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> LengthStyleInterpolation::fromInterpol
ableValue(const InterpolableValue& value, InterpolationRange range) | 125 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> LengthStyleInterpolation::fromInterpol
ableValue(const InterpolableValue& value, InterpolationRange range) |
126 { | 126 { |
127 const InterpolableList* listOfValuesAndTypes = toInterpolableList(&value); | 127 const InterpolableList* listOfValuesAndTypes = toInterpolableList(&value); |
128 const InterpolableList* listOfValues = toInterpolableList(listOfValuesAndTyp
es->get(0)); | 128 const InterpolableList* listOfValues = toInterpolableList(listOfValuesAndTyp
es->get(0)); |
129 const InterpolableList* listOfTypes = toInterpolableList(listOfValuesAndType
s->get(1)); | 129 const InterpolableList* listOfTypes = toInterpolableList(listOfValuesAndType
s->get(1)); |
130 unsigned unitTypeCount = 0; | 130 unsigned unitTypeCount = 0; |
131 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { | 131 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { |
132 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge
t(i)); | 132 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge
t(i)); |
133 if (subType->value()) { | 133 if (subType->value()) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 } | 173 } |
174 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value, ra
nge).get()); | 174 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value, ra
nge).get()); |
175 } | 175 } |
176 | 176 |
177 void LengthStyleInterpolation::apply(StyleResolverState& state) const | 177 void LengthStyleInterpolation::apply(StyleResolverState& state) const |
178 { | 178 { |
179 applyInterpolableValue(m_id, *m_cachedValue, m_range, state); | 179 applyInterpolableValue(m_id, *m_cachedValue, m_range, state); |
180 } | 180 } |
181 | 181 |
182 } | 182 } // namespace blink |
OLD | NEW |