Changeset 224181 in webkit
- Timestamp:
- Oct 30, 2017 8:09:02 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r224178 r224181 1 2017-10-30 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Expose the playbackRate property on Animation 4 https://bugs.webkit.org/show_bug.cgi?id=178931 5 6 Reviewed by Sam Weinig. 7 8 Add a new test, using WPT, to check that the playbackRate property is accounted 9 for when getting and setting the current time. 10 11 * http/wpt/wk-web-animations/timing-model/animation-playback-rate-expected.txt: Added. 12 * http/wpt/wk-web-animations/timing-model/animation-playback-rate.html: Added. 13 1 14 2017-10-30 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r224179 r224181 1 2017-10-30 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Expose the playbackRate property on Animation 4 https://bugs.webkit.org/show_bug.cgi?id=178931 5 6 Reviewed by Sam Weinig. 7 8 Account for the playback rate when computing and setting an animation's 9 current time, ensuring that we adjust the start time to preserve the 10 current time when setting a new playback rate. 11 12 Test: http/wpt/wk-web-animations/timing-model/animation-playback-rate.html 13 14 * animation/WebAnimation.cpp: 15 (WebCore::WebAnimation::WebAnimation): 16 (WebCore::WebAnimation::currentTime const): 17 (WebCore::WebAnimation::setCurrentTime): 18 (WebCore::WebAnimation::setPlaybackRate): 19 * animation/WebAnimation.h: 20 * animation/WebAnimation.idl: 21 1 22 2017-10-30 Michael Catanzaro <mcatanzaro@igalia.com> 2 23 -
trunk/Source/WebCore/animation/WebAnimation.cpp
r224164 r224181 114 114 return std::nullopt; 115 115 116 // FIXME: account for playback rate when we support it (webkit.org/b/178931). 117 return timelineTime.value() - m_startTime.value(); 116 return (timelineTime.value() - m_startTime.value()) * m_playbackRate; 118 117 } 119 118 120 119 void WebAnimation::setCurrentTime(std::optional<Seconds> seekTime) 121 120 { 122 // FIXME: account for hold time when we support it (webkit.org/b/178932). 121 // FIXME: account for hold time when we support it (webkit.org/b/178932), 122 // including situations where playbackRate is 0. 123 123 124 124 if (!m_timeline) { … … 133 133 } 134 134 135 // FIXME: account for playback rate when we support it (webkit.org/b/178931). 136 setStartTime(timelineTime.value() - seekTime.value()); 135 setStartTime(timelineTime.value() - (seekTime.value() / m_playbackRate)); 136 } 137 138 void WebAnimation::setPlaybackRate(double newPlaybackRate) 139 { 140 if (m_playbackRate == newPlaybackRate) 141 return; 142 143 // 3.5.17.1. Updating the playback rate of an animation 144 // Changes to the playback rate trigger a compensatory seek so that that the animation's current time 145 // is unaffected by the change to the playback rate. 146 auto previousTime = currentTime(); 147 m_playbackRate = newPlaybackRate; 148 if (previousTime) 149 setCurrentTime(previousTime); 137 150 } 138 151 -
trunk/Source/WebCore/animation/WebAnimation.h
r224163 r224181 58 58 void setCurrentTime(std::optional<Seconds>); 59 59 60 double playbackRate() const { return m_playbackRate; } 61 void setPlaybackRate(double); 62 60 63 String description(); 61 64 … … 66 69 RefPtr<AnimationTimeline> m_timeline; 67 70 std::optional<Seconds> m_startTime; 71 double m_playbackRate { 1 }; 68 72 }; 69 73 -
trunk/Source/WebCore/animation/WebAnimation.idl
r224163 r224181 34 34 [ImplementedAs=bindingsStartTime] attribute double? startTime; 35 35 [MayThrowException, ImplementedAs=bindingsCurrentTime] attribute double? currentTime; 36 attribute double playbackRate; 36 37 };
Note: See TracChangeset
for help on using the changeset viewer.