Skip to content

Commit

Permalink
view-transitions: Add WPT for exit transitions with LayoutObjects.
Browse files Browse the repository at this point in the history
Before [1], ViewTransition had a bug which would incorrectly assume that
a PaintLayer generating anonymous LayoutObject corresponds to a node
which is participating in a ViewTransition.

While the previous patch fixed this bug, it was intended to be a no-op.
This change adds a test to ensure the error case is covered in VT WPTs.

[1]: https://chromium-review.googlesource.com/c/chromium/src/+/4367418
[email protected]

Fixed: 1443134
Change-Id: I259fdda6d4e49464cedb28c9b6c120d35ec998d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4528215
Commit-Queue: Chris Harrelson <[email protected]>
Reviewed-by: Chris Harrelson <[email protected]>
Auto-Submit: Khushal Sagar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1143496}
  • Loading branch information
khushalsagar authored and pull[bot] committed Feb 27, 2024
1 parent 1ad2e61 commit 1475379
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<title>View transitions: exit transition with layout objects that don't have a node (ref)</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:[email protected]">

<style>
body {
width: 100vw;
height: 100vh;
background: pink;
}

#target {
width: 100px;
height: 100px;
background: blue;
}
</style>
<div id="target"></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: exit transition with layout objects that don't have a node</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:[email protected]">
<link rel="match" href="exit-transition-with-anonymous-layout-object-ref.html">

<script src="/common/reftest-wait.js"></script>
<style>
body {
width: 100vw;
height: 100vh;
}

#target {
width: 100px;
height: 100px;
background: blue;
view-transition-name: target;
}

#hidden {
width: 10px;
height: 10px;
background: grey;
view-transition-name: hidden;
}

fieldset {
width: 100px;
height: 100px;
background: lightgreen;
overflow: clip;
}

html::view-transition { background: pink; }
html::view-transition-group(root) { visibility: hidden; }
html::view-transition-group(hidden) { animation-duration: 300s; }
html::view-transition-image-pair(hidden) { animation: unset; opacity: 0; }
html::view-transition-old(target) {
animation: unset;
opacity: 1;
}
</style>
<div id="target"></div>
<fieldset id="anonymous">hi</fieldset>
<div id=hidden class=hidden></div>

<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");

async function runTest() {
let t = document.startViewTransition(() => {
target.style.viewTransitionName = "none";
});
await t.ready;
anonymous.style.position = "relative";
requestAnimationFrame(() => requestAnimationFrame(() =>
requestAnimationFrame(() => requestAnimationFrame(takeScreenshot))
));
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>

0 comments on commit 1475379

Please sign in to comment.