Bug 178931 - [Web Animations] Expose the playbackRate property on Animation
Summary: [Web Animations] Expose the playbackRate property on Animation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-27 03:15 PDT by Antoine Quint
Modified: 2017-10-31 06:41 PDT (History)
7 users (show)

See Also:


Attachments
Patch (8.45 KB, patch)
2017-10-30 07:45 PDT, Antoine Quint
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2017-10-27 03:15:44 PDT
The Animation interface exposes a playbackRate property to control the animation's speed.
Comment 1 Antoine Quint 2017-10-30 07:45:12 PDT
Created attachment 325350 [details]
Patch
Comment 2 Sam Weinig 2017-10-30 07:51:29 PDT
Comment on attachment 325350 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=325350&action=review

> Source/WebCore/animation/WebAnimation.cpp:47
> +    , m_playbackRate(1)

This could be in the header.

> LayoutTests/http/wpt/wk-web-animations/timing-model/animation-playback-rate.html:27
> +test(t => {
> +  const animation = new Animation(document.timeline);
> +  animation.startTime = 1;
> +  animation.playbackRate = 2;
> +  internals.setTimelineCurrentTime(document.timeline, 3);
> +
> +  assert_equals(animation.startTime, 1);
> +  assert_equals(animation.currentTime, 4);
> +  assert_equals(animation.playbackRate, 2);
> +}, 'Correctly compute the current time based on the playback rate');

I'd add a test for what happens when the playbackRate is 0.
Comment 3 Antoine Quint 2017-10-30 07:58:09 PDT
(In reply to Sam Weinig from comment #2)
> > Source/WebCore/animation/WebAnimation.cpp:47
> > +    , m_playbackRate(1)
> 
> This could be in the header.

Will move to header in commit.

> I'd add a test for what happens when the playbackRate is 0.

Currently, bad things happen when setting the playback rate to 0. We will deal with that correctly when we implement pausing and the introduce the concept of the hold time. I'm just about to start on that, see webkit.org/b/178932.

But we can add a test for getting the current time with playback rate = 0, this already works, and should always report currentTime = 0. Will add another test in the commit.
Comment 4 Antoine Quint 2017-10-30 08:09:12 PDT
Committed r224181: <https://trac.webkit.org/changeset/224181>
Comment 5 Radar WebKit Bug Importer 2017-10-31 06:41:06 PDT
<rdar://problem/35271079>