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

Unified Diff: third_party/WebKit/Source/core/animation/InterpolableValue.cpp

Issue 2273233002: Remove redundant size member from InterpolableList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/InterpolableValue.cpp
diff --git a/third_party/WebKit/Source/core/animation/InterpolableValue.cpp b/third_party/WebKit/Source/core/animation/InterpolableValue.cpp
index ffd508ec94d3fb415a4d43f8e821bf47ac06faf1..d7fbbcfc6161cb5796c58e7c115a2d2ca148080f 100644
--- a/third_party/WebKit/Source/core/animation/InterpolableValue.cpp
+++ b/third_party/WebKit/Source/core/animation/InterpolableValue.cpp
@@ -16,9 +16,9 @@ bool InterpolableNumber::equals(const InterpolableValue& other) const
bool InterpolableList::equals(const InterpolableValue& other) const
{
const InterpolableList& otherList = toInterpolableList(other);
- if (m_size != otherList.m_size)
+ if (length() != otherList.length())
return false;
- for (size_t i = 0; i < m_size; i++) {
+ for (size_t i = 0; i < length(); i++) {
if (!m_values[i]->equals(*otherList.m_values[i]))
return false;
}
@@ -54,10 +54,10 @@ void InterpolableList::interpolate(const InterpolableValue& to, const double pro
const InterpolableList& toList = toInterpolableList(to);
InterpolableList& resultList = toInterpolableList(result);
- DCHECK_EQ(toList.m_size, m_size);
- DCHECK_EQ(resultList.m_size, m_size);
+ DCHECK_EQ(toList.length(), length());
+ DCHECK_EQ(resultList.length(), length());
- for (size_t i = 0; i < m_size; i++) {
+ for (size_t i = 0; i < length(); i++) {
DCHECK(m_values[i]);
DCHECK(toList.m_values[i]);
m_values[i]->interpolate(*(toList.m_values[i]), progress, *(resultList.m_values[i]));
@@ -66,8 +66,8 @@ void InterpolableList::interpolate(const InterpolableValue& to, const double pro
std::unique_ptr<InterpolableValue> InterpolableList::cloneAndZero() const
{
- std::unique_ptr<InterpolableList> result = InterpolableList::create(m_size);
- for (size_t i = 0; i < m_size; i++)
+ std::unique_ptr<InterpolableList> result = InterpolableList::create(length());
+ for (size_t i = 0; i < length(); i++)
result->set(i, m_values[i]->cloneAndZero());
return std::move(result);
}
@@ -79,7 +79,7 @@ void InterpolableNumber::scale(double scale)
void InterpolableList::scale(double scale)
{
- for (size_t i = 0; i < m_size; i++)
+ for (size_t i = 0; i < length(); i++)
m_values[i]->scale(scale);
}
@@ -91,8 +91,8 @@ void InterpolableNumber::scaleAndAdd(double scale, const InterpolableValue& othe
void InterpolableList::scaleAndAdd(double scale, const InterpolableValue& other)
{
const InterpolableList& otherList = toInterpolableList(other);
- DCHECK_EQ(otherList.m_size, m_size);
- for (size_t i = 0; i < m_size; i++)
+ DCHECK_EQ(otherList.length(), length());
+ for (size_t i = 0; i < length(); i++)
m_values[i]->scaleAndAdd(scale, *otherList.m_values[i]);
}

Powered by Google App Engine
This is Rietveld 408576698