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