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

Unified Diff: Source/core/platform/animation/TimingFunction.h

Issue 52923003: Fixing reflectivity of operator== for timing functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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/core.gypi ('k') | Source/core/platform/animation/TimingFunctionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/animation/TimingFunction.h
diff --git a/Source/core/platform/animation/TimingFunction.h b/Source/core/platform/animation/TimingFunction.h
index ecc9c7477f79897159b7525da372d91e786c83d2..abbaf4ed80228d32b76db7d9d2c0db8435178c66 100644
--- a/Source/core/platform/animation/TimingFunction.h
+++ b/Source/core/platform/animation/TimingFunction.h
@@ -35,7 +35,6 @@
#include "wtf/Vector.h"
#include <algorithm>
-
namespace WebCore {
class TimingFunction : public RefCounted<TimingFunction> {
@@ -53,6 +52,7 @@ public:
// accuracy and is not guaranteed.
virtual double evaluate(double fraction, double accuracy) const = 0;
virtual bool operator==(const TimingFunction& other) const = 0;
+ virtual bool operator!=(const TimingFunction& other) const { return !operator==(other); }
protected:
TimingFunction(Type type)
@@ -153,14 +153,14 @@ public:
virtual bool operator==(const TimingFunction& other) const
{
- if (other.type() == CubicBezierFunction) {
- const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(&other);
- if (m_subType != Custom)
- return m_subType == ctf->m_subType;
+ if (other.type() != CubicBezierFunction)
+ return false;
+ const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(&other);
+ if (m_subType == Custom && ctf->m_subType == Custom)
return m_x1 == ctf->m_x1 && m_y1 == ctf->m_y1 && m_x2 == ctf->m_x2 && m_y2 == ctf->m_y2;
- }
- return false;
+
+ return m_subType == ctf->m_subType;
}
double x1() const { return m_x1; }
@@ -233,13 +233,14 @@ public:
virtual bool operator==(const TimingFunction& other) const
{
- if (other.type() == StepsFunction) {
- const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(&other);
- if (m_subType != Custom)
- return m_subType == stf->m_subType;
+ if (other.type() != StepsFunction)
+ return false;
+
+ const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(&other);
+ if (m_subType == Custom && stf->m_subType == Custom)
return m_steps == stf->m_steps && m_stepAtStart == stf->m_stepAtStart;
- }
- return false;
+
+ return m_subType == stf->m_subType;
}
int numberOfSteps() const { return m_steps; }
@@ -274,6 +275,7 @@ public:
ASSERT(upperBound > max);
m_segments.append(Segment(max, upperBound, timingFunction));
}
+
virtual double evaluate(double fraction, double accuracy) const
{
RELEASE_ASSERT_WITH_MESSAGE(fraction >= 0 && fraction <= 1, "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified");
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/platform/animation/TimingFunctionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698