Skip to content

Commit

Permalink
view-transitions: Ensure root element generates group animations.
Browse files Browse the repository at this point in the history
This change aligns the implementation for tracking state and generating
styles for the root element with sub-elements. This aligns well with the
spec and ensures the behaviour for root transitions stays consistent
with element transitions.

Specifically, we now generate animations for the group pseudo
corresponding to the root. This means we now have a no-op animation for
the root. While this aligns with the spec, it should be optimized going
forward.

[email protected]

Bug: 1454863, 1457298
Change-Id: I3ea09dd0f021675875f2aabf911421e8810f8465
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4668328
Reviewed-by: Dave Tapuska <[email protected]>
Auto-Submit: Khushal Sagar <[email protected]>
Reviewed-by: Vladimir Levin <[email protected]>
Commit-Queue: Khushal Sagar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1168240}
  • Loading branch information
khushalsagar authored and chromium-wpt-export-bot committed Jul 10, 2023
1 parent e3d6f0f commit 29310ae
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions css/css-view-transitions/group-animation-for-root-transition.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<title>View transitions: group pseudo for the root transition has animation</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:[email protected]">

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

<script>
promise_test(() => {
return new Promise(async (resolve, reject) => {
let transition = document.startViewTransition();
transition.ready.then(() => {
let foundGroupAnimation = false;
let foundOldAnimation = false;
let foundNewAnimation = false;

document.getAnimations().forEach((animation) => {
let pseudo = animation.effect.pseudoElement;
if (pseudo == "::view-transition-group(root)") {
assert_false(foundGroupAnimation);
foundGroupAnimation = true;
} else if (pseudo == "::view-transition-new(root)") {
assert_false(foundNewAnimation);
foundNewAnimation = true;
} else if (pseudo == "::view-transition-old(root)") {
assert_false(foundOldAnimation);
foundOldAnimation = true;
} else {
reject();
}
});

if (foundGroupAnimation && foundOldAnimation && foundNewAnimation)
resolve();
else
reject();
});
});
}, "incorrect UA animations for root transition");
</script>

0 comments on commit 29310ae

Please sign in to comment.