Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: third_party/WebKit/Source/core/animation/LegacyStyleInterpolation.cpp

Issue 2750293003: Delete unused AnimatableValue code (Closed)
Patch Set: Fix unit tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/LegacyStyleInterpolation.h" 5 #include "core/animation/LegacyStyleInterpolation.h"
6 6
7 #include "core/css/resolver/AnimatedStyleBuilder.h"
8 #include "core/css/resolver/StyleResolverState.h"
9
7 #include <memory> 10 #include <memory>
8 11
9 namespace blink { 12 namespace blink {
10 13
11 namespace { 14 namespace {
12 15
13 bool typesMatch(const InterpolableValue* start, const InterpolableValue* end) { 16 bool typesMatch(const InterpolableValue* start, const InterpolableValue* end) {
14 if (start == end) 17 if (start == end)
15 return true; 18 return true;
16 if (start->isNumber()) 19 if (start->isNumber())
(...skipping 24 matching lines...) Expand all
41 : Interpolation(), 44 : Interpolation(),
42 m_start(std::move(start)), 45 m_start(std::move(start)),
43 m_end(std::move(end)), 46 m_end(std::move(end)),
44 m_property(id), 47 m_property(id),
45 m_cachedFraction(0), 48 m_cachedFraction(0),
46 m_cachedIteration(0), 49 m_cachedIteration(0),
47 m_cachedValue(m_start ? m_start->clone() : nullptr) { 50 m_cachedValue(m_start ? m_start->clone() : nullptr) {
48 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); 51 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get()));
49 } 52 }
50 53
54 void LegacyStyleInterpolation::apply(StyleResolverState& state) const {
55 AnimatedStyleBuilder::applyProperty(id(), *state.style(),
56 currentValue().get());
57 }
58
51 void LegacyStyleInterpolation::interpolate(int iteration, double fraction) { 59 void LegacyStyleInterpolation::interpolate(int iteration, double fraction) {
52 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { 60 if (m_cachedFraction != fraction || m_cachedIteration != iteration) {
53 m_start->interpolate(*m_end, fraction, *m_cachedValue); 61 m_start->interpolate(*m_end, fraction, *m_cachedValue);
54 m_cachedIteration = iteration; 62 m_cachedIteration = iteration;
55 m_cachedFraction = fraction; 63 m_cachedFraction = fraction;
56 } 64 }
57 } 65 }
58 66
59 } // namespace blink 67 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698