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/Interpolation.h" | 6 #include "core/animation/Interpolation.h" |
7 | 7 |
| 8 #include "core/css/resolver/AnimatedStyleBuilder.h" |
| 9 #include "core/css/resolver/StyleResolverState.h" |
| 10 |
8 namespace WebCore { | 11 namespace WebCore { |
9 | 12 |
10 namespace { | 13 namespace { |
11 | 14 |
12 bool typesMatch(const InterpolableValue* start, const InterpolableValue* end) | 15 bool typesMatch(const InterpolableValue* start, const InterpolableValue* end) |
13 { | 16 { |
14 if (start->isNumber()) | 17 if (start->isNumber()) |
15 return end->isNumber(); | 18 return end->isNumber(); |
16 if (start->isBool()) | 19 if (start->isBool()) |
17 return end->isBool(); | 20 return end->isBool(); |
| 21 if (start->isAnimatableValue()) |
| 22 return end->isAnimatableValue(); |
18 if (!(start->isList() && end->isList())) | 23 if (!(start->isList() && end->isList())) |
19 return false; | 24 return false; |
20 const InterpolableList* startList = toInterpolableList(start); | 25 const InterpolableList* startList = toInterpolableList(start); |
21 const InterpolableList* endList = toInterpolableList(end); | 26 const InterpolableList* endList = toInterpolableList(end); |
22 if (startList->length() != endList->length()) | 27 if (startList->length() != endList->length()) |
23 return false; | 28 return false; |
24 for (size_t i = 0; i < startList->length(); ++i) { | 29 for (size_t i = 0; i < startList->length(); ++i) { |
25 if (!typesMatch(startList->get(i), endList->get(i))) | 30 if (!typesMatch(startList->get(i), endList->get(i))) |
26 return false; | 31 return false; |
27 } | 32 } |
(...skipping 14 matching lines...) Expand all Loading... |
42 | 47 |
43 void Interpolation::interpolate(int iteration, double fraction) const | 48 void Interpolation::interpolate(int iteration, double fraction) const |
44 { | 49 { |
45 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { | 50 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { |
46 m_cachedValue = m_start->interpolate(*m_end, fraction); | 51 m_cachedValue = m_start->interpolate(*m_end, fraction); |
47 m_cachedIteration = iteration; | 52 m_cachedIteration = iteration; |
48 m_cachedFraction = fraction; | 53 m_cachedFraction = fraction; |
49 } | 54 } |
50 } | 55 } |
51 | 56 |
| 57 void LegacyStyleInterpolation::apply(StyleResolverState& state) const |
| 58 { |
| 59 AnimatableValue* value = currentValue(); |
| 60 AnimatedStyleBuilder::applyProperty(m_id, state, value); |
52 } | 61 } |
| 62 |
| 63 } |
OLD | NEW |