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

Unified Diff: Source/platform/animation/TimingFunction.cpp

Issue 238573002: Web Animations: Allow timing inputs outside the range [0, 1] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@lkgr
Patch Set: Created 6 years, 8 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 | « no previous file | Source/platform/animation/TimingFunctionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/animation/TimingFunction.cpp
diff --git a/Source/platform/animation/TimingFunction.cpp b/Source/platform/animation/TimingFunction.cpp
index a7c0ee18bf92c402b3eb0ce95ef3a94ac30bffc6..0781c4fbe6f96f7350e83819039a51c219811b6d 100644
--- a/Source/platform/animation/TimingFunction.cpp
+++ b/Source/platform/animation/TimingFunction.cpp
@@ -5,6 +5,8 @@
#include "config.h"
#include "platform/animation/TimingFunction.h"
+#include "wtf/MathExtras.h"
+
namespace WebCore {
String LinearTimingFunction::toString() const
@@ -40,7 +42,6 @@ String CubicBezierTimingFunction::toString() const
double CubicBezierTimingFunction::evaluate(double fraction, double accuracy) const
{
- ASSERT_WITH_MESSAGE(fraction >= 0 && fraction <= 1, "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified");
if (!m_bezier)
m_bezier = adoptPtr(new UnitBezier(m_x1, m_y1, m_x2, m_y2));
return m_bezier->solve(fraction, accuracy);
@@ -78,7 +79,6 @@ String StepsTimingFunction::toString() const
double StepsTimingFunction::evaluate(double fraction, double) const
{
- ASSERT_WITH_MESSAGE(fraction >= 0 && fraction <= 1, "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified");
double startOffset = 0;
switch (m_stepAtPosition) {
case StepAtStart:
@@ -94,7 +94,7 @@ double StepsTimingFunction::evaluate(double fraction, double) const
ASSERT_NOT_REACHED();
break;
}
- return std::min(1.0, floor((m_steps * fraction) + startOffset) / m_steps);
+ return clampTo(floor((m_steps * fraction) + startOffset) / m_steps, 0.0, 1.0);
}
// Equals operators
« no previous file with comments | « no previous file | Source/platform/animation/TimingFunctionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698