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

Unified Diff: Source/core/animation/Interpolation.cpp

Issue 1153943003: Add foundation for removing AnimatableValues from StyleInterpolation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review changes Created 5 years, 6 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
« no previous file with comments | « Source/core/animation/Interpolation.h ('k') | Source/core/animation/InvalidatableStyleInterpolation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/Interpolation.cpp
diff --git a/Source/core/animation/Interpolation.cpp b/Source/core/animation/Interpolation.cpp
index 21b955fa95beb3048df02c05cf3b81fa5783640b..4c3ef4c8bb5deea9254e64ce720b71b4f08377a0 100644
--- a/Source/core/animation/Interpolation.cpp
+++ b/Source/core/animation/Interpolation.cpp
@@ -11,6 +11,8 @@ namespace {
bool typesMatch(const InterpolableValue* start, const InterpolableValue* end)
{
+ if (start == end)
+ return true;
if (start->isNumber())
return end->isNumber();
if (start->isBool())
@@ -37,7 +39,7 @@ Interpolation::Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
, m_end(end)
, m_cachedFraction(0)
, m_cachedIteration(0)
- , m_cachedValue(m_start->clone())
+ , m_cachedValue(m_start ? m_start->clone() : nullptr)
{
RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get()));
}
@@ -46,7 +48,7 @@ Interpolation::~Interpolation()
{
}
-void Interpolation::interpolate(int iteration, double fraction) const
+void Interpolation::interpolate(int iteration, double fraction)
{
if (m_cachedFraction != fraction || m_cachedIteration != iteration) {
m_start->interpolate(*m_end, fraction, *m_cachedValue);
« no previous file with comments | « Source/core/animation/Interpolation.h ('k') | Source/core/animation/InvalidatableStyleInterpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698