Web Animations: Use null for unresolved startTime and currentTime in AnimationPlayer

BUG=396372

Review URL: https://codereview.chromium.org/556453004

git-svn-id: svn://svn.chromium.org/blink/trunk@181704 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0b67de13
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
function assert_unresolved(value) {
assert_equals(value, null);
}
test(function() {
var player = document.documentElement.animate([], 100000);
player.cancel();
assert_unresolved(player.startTime);
assert_unresolved(player.currentTime);
}, "unresolved startTime and currentTime");
</script>
......@@ -147,11 +147,25 @@ void AnimationPlayer::updateCurrentTimingState(TimingUpdateReason reason)
m_holdTime = m_playbackRate < 0 ? 0 : sourceEnd();
}
double AnimationPlayer::startTime(bool& isNull) const
{
double result = startTime();
isNull = std::isnan(result);
return result;
}
double AnimationPlayer::startTime() const
{
return m_startTime * 1000;
}
double AnimationPlayer::currentTime(bool& isNull)
{
double result = currentTime();
isNull = std::isnan(result);
return result;
}
double AnimationPlayer::currentTime()
{
if (m_currentTimePending || m_idle)
......
......@@ -70,6 +70,7 @@ public:
void cancel();
double currentTime(bool& isNull);
double currentTime();
void setCurrentTime(double newCurrentTime);
......@@ -110,6 +111,7 @@ public:
double calculateStartTime(double currentTime) const;
bool hasStartTime() const { return !isNull(m_startTime); }
double startTime(bool& isNull) const;
double startTime() const;
double startTimeInternal() const { return m_startTime; }
void setStartTime(double);
......
......@@ -36,8 +36,8 @@ enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" };
ActiveDOMObject,
] interface AnimationPlayer : EventTarget {
[RuntimeEnabled=WebAnimationsAPI] attribute AnimationNode? source;
[RuntimeEnabled=WebAnimationsPlaybackControl] attribute double startTime;
[RuntimeEnabled=WebAnimationsPlaybackControl] attribute double currentTime;
[RuntimeEnabled=WebAnimationsPlaybackControl] attribute double? startTime;
[RuntimeEnabled=WebAnimationsPlaybackControl] attribute double? currentTime;
[RuntimeEnabled=WebAnimationsPlaybackControl] attribute double playbackRate;
[RuntimeEnabled=WebAnimationsPlaybackControl] readonly attribute AnimationPlayState playState;
[RuntimeEnabled=WebAnimationsPlaybackControl, RaisesException] void finish();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment