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

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

Issue 929273002: Use IDL union for Timing.duration (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/AnimationNodeTiming.h ('k') | Source/core/animation/AnimationTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationNodeTiming.cpp
diff --git a/Source/core/animation/AnimationNodeTiming.cpp b/Source/core/animation/AnimationNodeTiming.cpp
index 7d1df0344612dc6997fe9afed8d590ca0efb332a..d469cb7556b29709094099415b650bc58cf2f902 100644
--- a/Source/core/animation/AnimationNodeTiming.cpp
+++ b/Source/core/animation/AnimationNodeTiming.cpp
@@ -47,22 +47,12 @@ double AnimationNodeTiming::iterations()
return m_parent->specifiedTiming().iterationCount;
}
-// This logic was copied from the example in bindings/tests/idls/TestInterface.idl
-// and bindings/tests/results/V8TestInterface.cpp.
-// FIXME: It might be possible to have 'duration' defined as an attribute in the idl.
-// If possible, fix will be in a follow-up patch.
-// http://crbug.com/240176
-void AnimationNodeTiming::getDuration(String propertyName, DoubleOrString& returnValue)
+void AnimationNodeTiming::duration(DoubleOrString& returnValue)
{
- if (propertyName != "duration")
- return;
-
- if (std::isnan(m_parent->specifiedTiming().iterationDuration)) {
+ if (std::isnan(m_parent->specifiedTiming().iterationDuration))
returnValue.setString("auto");
- return;
- }
- returnValue.setDouble(m_parent->specifiedTiming().iterationDuration * 1000);
- return;
+ else
+ returnValue.setDouble(m_parent->specifiedTiming().iterationDuration * 1000);
}
double AnimationNodeTiming::playbackRate()
@@ -115,14 +105,13 @@ void AnimationNodeTiming::setIterations(double iterations)
m_parent->updateSpecifiedTiming(timing);
}
-bool AnimationNodeTiming::setDuration(String name, double duration)
+void AnimationNodeTiming::setDuration(const DoubleOrString& durationOrAuto)
{
- if (name != "duration")
- return false;
+ // Any strings other than "auto" are coerced to "auto".
+ double duration = durationOrAuto.isString() ? std::numeric_limits<double>::quiet_NaN() : durationOrAuto.getAsDouble();
Timing timing = m_parent->specifiedTiming();
TimingInput::setIterationDuration(timing, duration);
m_parent->updateSpecifiedTiming(timing);
- return true;
}
void AnimationNodeTiming::setPlaybackRate(double playbackRate)
« no previous file with comments | « Source/core/animation/AnimationNodeTiming.h ('k') | Source/core/animation/AnimationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698