OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/CSSBorderImageLengthBoxInterpolationType.h" | 5 #include "core/animation/CSSBorderImageLengthBoxInterpolationType.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/animation/BorderImageLengthBoxPropertyFunctions.h" | 8 #include "core/animation/BorderImageLengthBoxPropertyFunctions.h" |
9 #include "core/animation/LengthInterpolationFunctions.h" | 9 #include "core/animation/LengthInterpolationFunctions.h" |
10 #include "core/css/CSSQuadValue.h" | 10 #include "core/css/CSSQuadValue.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 InterpolationValue convertedSide = | 169 InterpolationValue convertedSide = |
170 LengthInterpolationFunctions::maybeConvertLength(side.length(), zoom); | 170 LengthInterpolationFunctions::maybeConvertLength(side.length(), zoom); |
171 if (!convertedSide) | 171 if (!convertedSide) |
172 return nullptr; | 172 return nullptr; |
173 list->set(i, std::move(convertedSide.interpolableValue)); | 173 list->set(i, std::move(convertedSide.interpolableValue)); |
174 nonInterpolableValues[i] = std::move(convertedSide.nonInterpolableValue); | 174 nonInterpolableValues[i] = std::move(convertedSide.nonInterpolableValue); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 return InterpolationValue( | 178 return InterpolationValue( |
179 std::move(list), CSSBorderImageLengthBoxNonInterpolableValue::create( | 179 std::move(list), |
180 SideNumbers(box), std::move(nonInterpolableValues))); | 180 CSSBorderImageLengthBoxNonInterpolableValue::create( |
| 181 SideNumbers(box), std::move(nonInterpolableValues))); |
181 } | 182 } |
182 | 183 |
183 } // namespace | 184 } // namespace |
184 | 185 |
185 InterpolationValue | 186 InterpolationValue |
186 CSSBorderImageLengthBoxInterpolationType::maybeConvertNeutral( | 187 CSSBorderImageLengthBoxInterpolationType::maybeConvertNeutral( |
187 const InterpolationValue& underlying, | 188 const InterpolationValue& underlying, |
188 ConversionCheckers& conversionCheckers) const { | 189 ConversionCheckers& conversionCheckers) const { |
189 SideNumbers underlyingSideNumbers = | 190 SideNumbers underlyingSideNumbers = |
190 UnderlyingSideNumbersChecker::getUnderlyingSideNumbers(underlying); | 191 UnderlyingSideNumbersChecker::getUnderlyingSideNumbers(underlying); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(SideIndexCount); | 237 Vector<RefPtr<NonInterpolableValue>> nonInterpolableValues(SideIndexCount); |
237 const CSSValue* sides[SideIndexCount] = {}; | 238 const CSSValue* sides[SideIndexCount] = {}; |
238 sides[SideTop] = quad.top(); | 239 sides[SideTop] = quad.top(); |
239 sides[SideRight] = quad.right(); | 240 sides[SideRight] = quad.right(); |
240 sides[SideBottom] = quad.bottom(); | 241 sides[SideBottom] = quad.bottom(); |
241 sides[SideLeft] = quad.left(); | 242 sides[SideLeft] = quad.left(); |
242 | 243 |
243 for (size_t i = 0; i < SideIndexCount; i++) { | 244 for (size_t i = 0; i < SideIndexCount; i++) { |
244 const CSSValue& side = *sides[i]; | 245 const CSSValue& side = *sides[i]; |
245 if (side.isPrimitiveValue() && toCSSPrimitiveValue(side).isNumber()) { | 246 if (side.isPrimitiveValue() && toCSSPrimitiveValue(side).isNumber()) { |
246 list->set(i, InterpolableNumber::create( | 247 list->set(i, |
247 toCSSPrimitiveValue(side).getDoubleValue())); | 248 InterpolableNumber::create( |
| 249 toCSSPrimitiveValue(side).getDoubleValue())); |
248 } else { | 250 } else { |
249 InterpolationValue convertedSide = | 251 InterpolationValue convertedSide = |
250 LengthInterpolationFunctions::maybeConvertCSSValue(side); | 252 LengthInterpolationFunctions::maybeConvertCSSValue(side); |
251 if (!convertedSide) | 253 if (!convertedSide) |
252 return nullptr; | 254 return nullptr; |
253 list->set(i, std::move(convertedSide.interpolableValue)); | 255 list->set(i, std::move(convertedSide.interpolableValue)); |
254 nonInterpolableValues[i] = std::move(convertedSide.nonInterpolableValue); | 256 nonInterpolableValues[i] = std::move(convertedSide.nonInterpolableValue); |
255 } | 257 } |
256 } | 258 } |
257 | 259 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 *list.get(index), nonInterpolableValues[index].get(), | 352 *list.get(index), nonInterpolableValues[index].get(), |
351 state.cssToLengthConversionData(), ValueRangeNonNegative); | 353 state.cssToLengthConversionData(), ValueRangeNonNegative); |
352 }; | 354 }; |
353 BorderImageLengthBox box(convertSide(SideTop), convertSide(SideRight), | 355 BorderImageLengthBox box(convertSide(SideTop), convertSide(SideRight), |
354 convertSide(SideBottom), convertSide(SideLeft)); | 356 convertSide(SideBottom), convertSide(SideLeft)); |
355 BorderImageLengthBoxPropertyFunctions::setBorderImageLengthBox( | 357 BorderImageLengthBoxPropertyFunctions::setBorderImageLengthBox( |
356 cssProperty(), *state.style(), box); | 358 cssProperty(), *state.style(), box); |
357 } | 359 } |
358 | 360 |
359 } // namespace blink | 361 } // namespace blink |
OLD | NEW |