Skip to content

Commit

Permalink
VT: End the transition only if animation is not running or paused
Browse files Browse the repository at this point in the history
Instead of effect IsCurrent, the spec says we should check animation
run state and whether it's running or paused. This change aligns with
the spec

[email protected]

Fixed: 1392138
Change-Id: I7dcc316ee5c2d20b1e824e7a21a8f4a5859a8ee3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4150115
Commit-Queue: Vladimir Levin <[email protected]>
Reviewed-by: Khushal Sagar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1090996}
  • Loading branch information
vmpstr authored and chromium-wpt-export-bot committed Jan 10, 2023
1 parent fe30ab2 commit 8ff38c5
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions css/css-view-transitions/paused-animation-at-end.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<title>View transitions: pause animation and set current time to the end</title>
<link rel="help" href="https://www.w3.org/TR/css-view-transitions-1/">
<link rel="author" href="mailto:[email protected]">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
:root { view-transition-name: unset; }
#target {
width: 100px;
height: 100px;
contain: layout;
view-transition-name: target;
}
.one {
background: blue;
}
.two {
background: green;
}
</style>

<div id=target class=one></div>

<script>
promise_test(async (t) => {
return new Promise((resolve, reject) => {
let transition = document.startViewTransition(() => {
target.classList.replace("one", "two");
});

transition.finished.then(() => reject("transition unexpectedly finished"));
transition.ready.then(() => {
document.getAnimations().forEach((animation) => {
animation.pause();
animation.currentTime = 1000;
});
step_timeout(resolve, 500);
});
});
}, "view transition is not over if animations are paused");
</script>

0 comments on commit 8ff38c5

Please sign in to comment.