RESOLVED FIXED182100
[Web Animations] Expose the reverse() method
https://bugs.webkit.org/show_bug.cgi?id=182100
Summary [Web Animations] Expose the reverse() method
Antoine Quint
Reported 2018-01-25 07:13:14 PST
Animations support a reverse() method to play animations backwards.
Attachments
Patch (14.53 KB, patch)
2018-01-25 08:21 PST, Antoine Quint
no flags
Patch for landing (6.15 KB, patch)
2018-01-25 10:44 PST, Antoine Quint
graouts: commit-queue+
Radar WebKit Bug Importer
Comment 1 2018-01-25 07:13:32 PST
Antoine Quint
Comment 2 2018-01-25 08:21:00 PST
Dean Jackson
Comment 3 2018-01-25 09:32:57 PST
Comment on attachment 332269 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=332269&action=review > Source/WebCore/animation/WebAnimation.cpp:296 > void WebAnimation::setPlaybackRate(double newPlaybackRate) > { > + setPlaybackRate(newPlaybackRate, Silently::No); > +} > + > +void WebAnimation::setPlaybackRate(double newPlaybackRate, Silently silently) Why isn't this a single method with a default parameter? > Source/WebCore/animation/WebAnimation.cpp:304 > + // The procedure to set the animation playback rate of an animation, animation to new playback rate is as follows. animation, animation huh? > Source/WebCore/animation/WebAnimation.cpp:305 > + // The procedure to silently set the animation playback rate of animation, animation to new playback rate is identical huh again? > Source/WebCore/animation/WebAnimation.cpp:306 > + // to the above procedure except that rather than invoking the procedure to set the current time in the final step, procedure procedure procedure > Source/WebCore/animation/WebAnimation.cpp:775 > + // The procedure to reverse an animation of animation animation is as follows: animation animation > Source/WebCore/animation/WebAnimation.cpp:796 > + return playResult.releaseException(); Are you supposed to throw the exception here? I wonder why you restore the forward rate before throwing. > Source/WebCore/animation/WebAnimation.h:118 > + void setPlaybackRate(double, Silently); See note above.
Antoine Quint
Comment 4 2018-01-25 10:24:10 PST
(In reply to Dean Jackson from comment #3) > Comment on attachment 332269 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=332269&action=review > > > Source/WebCore/animation/WebAnimation.cpp:296 > > void WebAnimation::setPlaybackRate(double newPlaybackRate) > > { > > + setPlaybackRate(newPlaybackRate, Silently::No); > > +} > > + > > +void WebAnimation::setPlaybackRate(double newPlaybackRate, Silently silently) > > Why isn't this a single method with a default parameter? Because the single parameter method is a method that is exposed via bindings. But maybe that's OK? > > Source/WebCore/animation/WebAnimation.cpp:304 > > + // The procedure to set the animation playback rate of an animation, animation to new playback rate is as follows. > > animation, animation huh? I should put quote around the second "animation", it's in italics in the spec to clarify it is the name of the animation that is being referred to. > > Source/WebCore/animation/WebAnimation.cpp:796 > > + return playResult.releaseException(); > > Are you supposed to throw the exception here? I wonder why you restore the > forward rate before throwing. I will raise an issue to clarify, but the WPT tests expect the exception to be forwarded. The comments explain that we need to reset if calling play() raises an exception.
Antoine Quint
Comment 5 2018-01-25 10:44:11 PST
Created attachment 332287 [details] Patch for landing
Antoine Quint
Comment 6 2018-01-25 10:54:50 PST
(In reply to Antoine Quint from comment #4) > (In reply to Dean Jackson from comment #3) > > Comment on attachment 332269 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=332269&action=review > > > > > Source/WebCore/animation/WebAnimation.cpp:296 > > > void WebAnimation::setPlaybackRate(double newPlaybackRate) > > > { > > > + setPlaybackRate(newPlaybackRate, Silently::No); > > > +} > > > + > > > +void WebAnimation::setPlaybackRate(double newPlaybackRate, Silently silently) > > > > Why isn't this a single method with a default parameter? > > Because the single parameter method is a method that is exposed via > bindings. But maybe that's OK? It is OK! I fixed in the landing patch. > > > Source/WebCore/animation/WebAnimation.cpp:796 > > > + return playResult.releaseException(); > > > > Are you supposed to throw the exception here? I wonder why you restore the > > forward rate before throwing. > > I will raise an issue to clarify, but the WPT tests expect the exception to > be forwarded. The comments explain that we need to reset if calling play() > raises an exception. See https://github.com/w3c/csswg-drafts/issues/2226.
Antoine Quint
Comment 7 2018-01-25 12:23:50 PST
Note You need to log in before you can comment on or make changes to this bug.