| 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/LengthPairStyleInterpolation.h" | 5 #include "core/animation/LengthPairStyleInterpolation.h" |
| 6 | 6 |
| 7 #include "core/animation/LengthStyleInterpolation.h" | 7 #include "core/animation/LengthStyleInterpolation.h" |
| 8 #include "core/css/CSSValuePair.h" | 8 #include "core/css/CSSValuePair.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 LengthPairStyleInterpolation::canCreateFrom(const CSSValue& value) | 13 bool LengthPairStyleInterpolation::canCreateFrom(const CSSValue& value) |
| 14 { | 14 { |
| 15 return value.isValuePair(); | 15 return value.isValuePair(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 PassOwnPtr<InterpolableValue> LengthPairStyleInterpolation::lengthPairToInterpol
ableValue(const CSSValue& value) | 18 PassOwnPtr<InterpolableValue> LengthPairStyleInterpolation::lengthPairToInterpol
ableValue(const CSSValue& value) |
| 19 { | 19 { |
| 20 OwnPtr<InterpolableList> result = InterpolableList::create(2); | 20 OwnPtr<InterpolableList> result = InterpolableList::create(2); |
| 21 const CSSValuePair& pair = toCSSValuePair(value); | 21 const CSSValuePair& pair = toCSSValuePair(value); |
| 22 | 22 |
| 23 result->set(0, LengthStyleInterpolation::toInterpolableValue(pair.first())); | 23 result->set(0, LengthStyleInterpolation::toInterpolableValue(pair.first())); |
| 24 result->set(1, LengthStyleInterpolation::toInterpolableValue(pair.second()))
; | 24 result->set(1, LengthStyleInterpolation::toInterpolableValue(pair.second()))
; |
| 25 return result.release(); | 25 return result.release(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 PassRefPtrWillBeRawPtr<CSSValue> LengthPairStyleInterpolation::interpolableValue
ToLengthPair(InterpolableValue* value, InterpolationRange range) | 28 RawPtr<CSSValue> LengthPairStyleInterpolation::interpolableValueToLengthPair(Int
erpolableValue* value, InterpolationRange range) |
| 29 { | 29 { |
| 30 InterpolableList* lengthPair = toInterpolableList(value); | 30 InterpolableList* lengthPair = toInterpolableList(value); |
| 31 RefPtrWillBeRawPtr<CSSPrimitiveValue> first = LengthStyleInterpolation::from
InterpolableValue(*lengthPair->get(0), range); | 31 RawPtr<CSSPrimitiveValue> first = LengthStyleInterpolation::fromInterpolable
Value(*lengthPair->get(0), range); |
| 32 RefPtrWillBeRawPtr<CSSPrimitiveValue> second = LengthStyleInterpolation::fro
mInterpolableValue(*lengthPair->get(1), range); | 32 RawPtr<CSSPrimitiveValue> second = LengthStyleInterpolation::fromInterpolabl
eValue(*lengthPair->get(1), range); |
| 33 return CSSValuePair::create(first.release(), second.release(), CSSValuePair:
:KeepIdenticalValues); | 33 return CSSValuePair::create(first.release(), second.release(), CSSValuePair:
:KeepIdenticalValues); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void LengthPairStyleInterpolation::apply(StyleResolverState& state) const | 36 void LengthPairStyleInterpolation::apply(StyleResolverState& state) const |
| 37 { | 37 { |
| 38 StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthPair(m_cac
hedValue.get(), m_range).get()); | 38 StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthPair(m_cac
hedValue.get(), m_range).get()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace blink | 41 } // namespace blink |
| OLD | NEW |