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