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" | 8 #include "core/css/resolver/AnimatedStyleBuilder.h" |
9 #include "core/css/resolver/StyleResolverState.h" | 9 #include "core/css/resolver/StyleResolverState.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 return false; | 28 return false; |
29 for (size_t i = 0; i < startList->length(); ++i) { | 29 for (size_t i = 0; i < startList->length(); ++i) { |
30 if (!typesMatch(startList->get(i), endList->get(i))) | 30 if (!typesMatch(startList->get(i), endList->get(i))) |
31 return false; | 31 return false; |
32 } | 32 } |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 } | 36 } |
37 | 37 |
38 Interpolation::Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end) | 38 Interpolation::Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end) |
39 : m_start(start) | 39 : m_start(start) |
40 , m_end(end) | 40 , m_end(end) |
41 , m_cachedFraction(0) | 41 , m_cachedFraction(0) |
42 , m_cachedIteration(0) | 42 , m_cachedIteration(0) |
43 , m_cachedValue(m_start->clone()) | 43 , m_cachedValue(m_start->clone()) |
44 { | 44 { |
45 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); | 45 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); |
46 } | 46 } |
47 | 47 |
48 void Interpolation::interpolate(int iteration, double fraction) const | 48 void Interpolation::interpolate(int iteration, double fraction) const |
49 { | 49 { |
50 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { | 50 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { |
51 m_cachedValue = m_start->interpolate(*m_end, fraction); | 51 m_cachedValue = m_start->interpolate(*m_end, fraction); |
52 m_cachedIteration = iteration; | 52 m_cachedIteration = iteration; |
53 m_cachedFraction = fraction; | 53 m_cachedFraction = fraction; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
| 57 void Interpolation::trace(Visitor* visitor) |
| 58 { |
| 59 visitor->trace(m_start); |
| 60 visitor->trace(m_end); |
| 61 visitor->trace(m_cachedValue); |
| 62 } |
| 63 |
57 void StyleInterpolation::trace(Visitor* visitor) | 64 void StyleInterpolation::trace(Visitor* visitor) |
58 { | 65 { |
59 Interpolation::trace(visitor); | 66 Interpolation::trace(visitor); |
60 } | 67 } |
61 | 68 |
62 void LegacyStyleInterpolation::apply(StyleResolverState& state) const | 69 void LegacyStyleInterpolation::apply(StyleResolverState& state) const |
63 { | 70 { |
64 AnimatableValue* value = currentValue(); | 71 AnimatableValue* value = currentValue(); |
65 AnimatedStyleBuilder::applyProperty(m_id, state, value); | 72 AnimatedStyleBuilder::applyProperty(m_id, state, value); |
66 } | 73 } |
67 | 74 |
68 void LegacyStyleInterpolation::trace(Visitor* visitor) | 75 void LegacyStyleInterpolation::trace(Visitor* visitor) |
69 { | 76 { |
70 StyleInterpolation::trace(visitor); | 77 StyleInterpolation::trace(visitor); |
71 } | 78 } |
72 | 79 |
73 } | 80 } |
OLD | NEW |