| 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 #ifndef CSSLengthPairInterpolationType_h | 5 #ifndef CSSLengthPairInterpolationType_h |
| 6 #define CSSLengthPairInterpolationType_h | 6 #define CSSLengthPairInterpolationType_h |
| 7 | 7 |
| 8 #include "core/animation/CSSLengthInterpolationType.h" | |
| 9 #include "core/animation/CSSLengthListInterpolationType.h" | 8 #include "core/animation/CSSLengthListInterpolationType.h" |
| 9 #include "core/animation/LengthInterpolationFunctions.h" |
| 10 #include "core/animation/ListInterpolationFunctions.h" | 10 #include "core/animation/ListInterpolationFunctions.h" |
| 11 #include "core/css/CSSValuePair.h" | 11 #include "core/css/CSSValuePair.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class CSSLengthPairInterpolationType : public CSSLengthListInterpolationType { | 15 class CSSLengthPairInterpolationType : public CSSLengthListInterpolationType { |
| 16 public: | 16 public: |
| 17 CSSLengthPairInterpolationType(CSSPropertyID property) | 17 CSSLengthPairInterpolationType(CSSPropertyID property) |
| 18 : CSSLengthListInterpolationType(property) | 18 : CSSLengthListInterpolationType(property) |
| 19 { } | 19 { } |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 InterpolationValue maybeConvertValue(const CSSValue& value, const StyleResol
verState&, ConversionCheckers&) const final | 22 InterpolationValue maybeConvertValue(const CSSValue& value, const StyleResol
verState&, ConversionCheckers&) const final |
| 23 { | 23 { |
| 24 const CSSValuePair& pair = toCSSValuePair(value); | 24 const CSSValuePair& pair = toCSSValuePair(value); |
| 25 return ListInterpolationFunctions::createList(2, [&pair](size_t index) { | 25 return ListInterpolationFunctions::createList(2, [&pair](size_t index) { |
| 26 return CSSLengthInterpolationType::maybeConvertCSSValue(index == 0 ?
pair.first() : pair.second()); | 26 const CSSValue& item = index == 0 ? pair.first() : pair.second(); |
| 27 return LengthInterpolationFunctions::maybeConvertCSSValue(item); |
| 27 }); | 28 }); |
| 28 } | 29 } |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 } // namespace blink | 32 } // namespace blink |
| 32 | 33 |
| 33 #endif // CSSLengthPairInterpolationType_h | 34 #endif // CSSLengthPairInterpolationType_h |
| OLD | NEW |