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

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

Issue 2562773002: Migrate WTF::Vector::append() to ::push_back() [part 2 of N] (Closed)
Patch Set: rebase Created 4 years 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 DCHECK(!fromValues.isEmpty() && !toValues.isEmpty()); 64 DCHECK(!fromValues.isEmpty() && !toValues.isEmpty());
65 size_t size = lowestCommonMultiple(fromValues.size(), toValues.size()); 65 size_t size = lowestCommonMultiple(fromValues.size(), toValues.size());
66 DCHECK_GT(size, 0U); 66 DCHECK_GT(size, 0U);
67 for (size_t i = 0; i < size; ++i) { 67 for (size_t i = 0; i < size; ++i) {
68 const AnimatableValue* from = fromValues[i % fromValues.size()].get(); 68 const AnimatableValue* from = fromValues[i % fromValues.size()].get();
69 const AnimatableValue* to = toValues[i % toValues.size()].get(); 69 const AnimatableValue* to = toValues[i % toValues.size()].get();
70 // Spec: If a pair of values cannot be interpolated, then the lists are not 70 // Spec: If a pair of values cannot be interpolated, then the lists are not
71 // interpolable. 71 // interpolable.
72 if (AnimatableValue::usesDefaultInterpolation(from, to)) 72 if (AnimatableValue::usesDefaultInterpolation(from, to))
73 return false; 73 return false;
74 interpolatedValues.append(interpolate(from, to, fraction)); 74 interpolatedValues.push_back(interpolate(from, to, fraction));
75 } 75 }
76 return true; 76 return true;
77 } 77 }
78 78
79 PassRefPtr<AnimatableValue> AnimatableRepeatable::interpolateTo( 79 PassRefPtr<AnimatableValue> AnimatableRepeatable::interpolateTo(
80 const AnimatableValue* value, 80 const AnimatableValue* value,
81 double fraction) const { 81 double fraction) const {
82 Vector<RefPtr<AnimatableValue>> interpolatedValues; 82 Vector<RefPtr<AnimatableValue>> interpolatedValues;
83 bool success = 83 bool success =
84 interpolateLists(m_values, toAnimatableRepeatable(value)->m_values, 84 interpolateLists(m_values, toAnimatableRepeatable(value)->m_values,
85 fraction, interpolatedValues); 85 fraction, interpolatedValues);
86 if (success) 86 if (success)
87 return create(interpolatedValues); 87 return create(interpolatedValues);
88 return defaultInterpolateTo(this, value, fraction); 88 return defaultInterpolateTo(this, value, fraction);
89 } 89 }
90 90
91 bool AnimatableRepeatable::equalTo(const AnimatableValue* value) const { 91 bool AnimatableRepeatable::equalTo(const AnimatableValue* value) const {
92 const Vector<RefPtr<AnimatableValue>>& otherValues = 92 const Vector<RefPtr<AnimatableValue>>& otherValues =
93 toAnimatableRepeatable(value)->m_values; 93 toAnimatableRepeatable(value)->m_values;
94 if (m_values.size() != otherValues.size()) 94 if (m_values.size() != otherValues.size())
95 return false; 95 return false;
96 for (size_t i = 0; i < m_values.size(); ++i) { 96 for (size_t i = 0; i < m_values.size(); ++i) {
97 if (!m_values[i]->equals(otherValues[i].get())) 97 if (!m_values[i]->equals(otherValues[i].get()))
98 return false; 98 return false;
99 } 99 }
100 return true; 100 return true;
101 } 101 }
102 102
103 } // namespace blink 103 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698