зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1523562 [wpt PR 15049] - Revert "[animation-worklet] Basic pause implementation", a=testonly
Automatic update from web-platform-tests Revert "[animation-worklet] Basic pause implementation" This reverts commit 94b5b84b058609ccf1d58f5175c0931b63b9f0f2. Reason for revert: Findit (https://goo.gl/kROfz5) identified CL at revision 625711 as the culprit for flakes in the build cycles as shown on: https://findit-for-me.appspot.com/waterfall/flake/flake-culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyQwsSDEZsYWtlQ3VscHJpdCIxY2hyb21pdW0vOTRiNWI4NGIwNTg2MDljY2YxZDU4ZjUxNzVjMDkzMWI2M2I5ZjBmMgw Sample Failed Build: https://ci.chromium.org/buildbot/chromium.memory/WebKit%20Linux%20Trusty%20Leak/29257 Sample Failed Step: webkit_layout_tests Sample Flaky Test: external/wpt/animation-worklet/worklet-animation-pause.https.html Original change's description: > [animation-worklet] Basic pause implementation > > Pausing worklet animation now holds the time. This works as expected for > main thread animations. Implementing this for composited worklet > animations will be done in a follow up patch. > > Major changes: > - Add and expose pause() method pausing the animation. > - Introduce hold_time that is used when animation is paused. > - Rework how current time is computed, it is now closer to > regular animations i.e., we either compute it based on > "start time and timeline.currentTime" or use "hold time". > - Instead of setting start time we now set the current time > which then works backward to compute either the start time > or the hold time based on the animation state. > - When transitioning animation play state, we now always set > the current time. Previously this was adhoc and inconsistent. > - Introduce has_started_ to differentiate when playing an > animation for the first time vs playing it from pause. > > > TEST: > * wpt/animation-worklet/worklet-animation-pause.https.html: js test for basic current time calculations > * wpt/animation-worklet/worklet-animation-pause-immediately.https.html: reftest for basic pause > * wpt/animation-worklet/worklet-animation-pause-result.https.html: reftest for pause/resume. > * WorkletAnimationTest.PausePlay: unit test for basic state transition and time calc > > Bug: 821910 > > Change-Id: Ie4b00129398159b3b5b83212bb63c43f2ce8bf4e > Reviewed-on: https://chromium-review.googlesource.com/c/1383298 > Commit-Queue: Majid Valipour <majidvp@chromium.org> > Reviewed-by: Majid Valipour <majidvp@chromium.org> > Reviewed-by: Yi Gu <yigu@chromium.org> > Cr-Commit-Position: refs/heads/master@{#625711} Change-Id: Ibb3c50f772493f1761cee657aaa618f357348188 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 821910 Reviewed-on: https://chromium-review.googlesource.com/c/1434815 Cr-Commit-Position: refs/heads/master@{#625747} -- wpt-commits: 584401124395d4017e235710dacc70bd61e93e13 wpt-pr: 15049
This commit is contained in:
Родитель
298cc8c20b
Коммит
ad55b8eae9
|
@ -30,9 +30,3 @@ function waitForAsyncAnimationFrames(count) {
|
|||
// AnimationWorklet.
|
||||
return waitForAnimationFrames(count + 1);
|
||||
}
|
||||
|
||||
async function waitForAnimationFrameWithCondition(condition) {
|
||||
do {
|
||||
await new Promise(window.requestAnimationFrame);
|
||||
} while (!condition())
|
||||
};
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
#box {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
transform: translateY(100px);
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="box"></div>
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Verify that calling pause immediately after playing works as expected</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
|
||||
<link rel="match" href="references/translated-box-ref.html">
|
||||
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script src="/web-animations/testcommon.js"></script>
|
||||
<script src="common.js"></script>
|
||||
<style>
|
||||
#box {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="box"></div>
|
||||
|
||||
<script>
|
||||
registerPassthroughAnimator().then(async _ => {
|
||||
const box = document.getElementById('box');
|
||||
const effect = new KeyframeEffect(box,
|
||||
{ transform: ['translateY(100px)', 'translateY(200px)'] },
|
||||
{ duration: 100, iterations: 1 }
|
||||
);
|
||||
|
||||
const animation = new WorkletAnimation('passthrough', effect);
|
||||
animation.play();
|
||||
// Immediately pausing animation should freeze the current time at 0.
|
||||
animation.pause();
|
||||
// Wait at least one frame to ensure a paused animation actually freezes.
|
||||
await waitForAsyncAnimationFrames(1);
|
||||
takeScreenshot();
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -1,40 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Verify that calling pause immediately after playing works as expected</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
|
||||
<link rel="match" href="references/translated-box-ref.html">
|
||||
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script src="common.js"></script>
|
||||
<style>
|
||||
#box {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="box"></div>
|
||||
|
||||
<script>
|
||||
registerPassthroughAnimator().then(async _ => {
|
||||
const duration = 18; // a bit longer than a frame
|
||||
const box = document.getElementById('box');
|
||||
const effect = new KeyframeEffect(box,
|
||||
{ transform: ['translateY(0px)', 'translateY(100px)'] },
|
||||
{ duration: duration, iterations: 1, fill: 'forwards'}
|
||||
);
|
||||
|
||||
const animation = new WorkletAnimation('passthrough', effect);
|
||||
// Immediately pausing animation should freeze the current time at 0.
|
||||
animation.pause();
|
||||
// Playing should cause animation to resume.
|
||||
animation.play();
|
||||
// Wait until we ensure animation has reached completion.
|
||||
await waitForAnimationFrameWithCondition( _ => {
|
||||
return animation.currentTime >= duration;
|
||||
});
|
||||
takeScreenshot();
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -1,58 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Verify that currentTime and playState are correct when animation is paused</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/web-animations/testcommon.js"></script>
|
||||
<script src="common.js"></script>
|
||||
|
||||
<div id="box"></div>
|
||||
|
||||
<script>
|
||||
|
||||
setup(setupAndRegisterTests, {explicit_done: true});
|
||||
|
||||
function createAnimation() {
|
||||
const box = document.getElementById('box');
|
||||
const effect = new KeyframeEffect(box,
|
||||
{ transform: ['translateY(100px)', 'translateY(200px)'] },
|
||||
{ duration: 100, iterations: 1 }
|
||||
);
|
||||
|
||||
return new WorkletAnimation('passthrough', effect);
|
||||
}
|
||||
|
||||
async function setupAndRegisterTests() {
|
||||
await registerPassthroughAnimator();
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createAnimation();
|
||||
animation.play();
|
||||
// Immediately pausing animation should freeze the current time at 0.
|
||||
animation.pause();
|
||||
assert_equals(animation.currentTime, 0);
|
||||
assert_equals(animation.playState, "paused");
|
||||
// Wait some time to ensure a paused animation actually freezes.
|
||||
await waitForNextFrame();
|
||||
assert_equals(animation.currentTime, 0);
|
||||
assert_equals(animation.playState, "paused");
|
||||
}, 'pausing an animation freezes its current time');
|
||||
|
||||
promise_test(async t => {
|
||||
const animation = createAnimation();
|
||||
const startTime = document.timeline.currentTime;
|
||||
animation.pause();
|
||||
animation.play();
|
||||
await waitForNextFrame();
|
||||
const timelineTime = document.timeline.currentTime;
|
||||
assert_equals(animation.playState, "running");
|
||||
assert_greater_than(animation.currentTime, 0);
|
||||
assert_times_equal(animation.currentTime, (timelineTime - startTime));
|
||||
}, 'playing a paused animation should resume it');
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
Загрузка…
Ссылка в новой задаче