Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View transitions: names should be tree-scoped rather then nodes #47006

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions css/css-view-transitions/shadow-part-with-name-nested.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: nested shadow parts should work with view-transition-name</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="match" href="names-are-tree-scoped-ref.html">
<script src="/common/reftest-wait.js"></script>
<style>
div {
width: 100px;
height: 100px;
background: red;
}

::part(party) {
view-transition-name: party;
}

:root { view-transition-name: none; }
html::view-transition-group(*) { animation-play-state: paused; }
html::view-transition-old(*) { animation: unset; opacity: 0 }
html::view-transition-new(*) { animation: unset; opacity: 0 }
html::view-transition-group(party) {
position: absolute;
width: 100px;
height: 100px;
background: green;
}
</style>

<custom-component>
<template shadowrootmode="open">
<nested-component exportparts="party">
<style>
div {
width: 100px;
height: 100px;
}
</style>
<div part="party"></div>
</nested-component>
</template>
</custom-component>

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

function runTest() {
document.startViewTransition().ready.then(takeScreenshot);
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>

</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: shadow parts should give precedence to !important</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="match" href="names-are-tree-scoped-ref.html">
<script src="/common/reftest-wait.js"></script>
<style>
div {
width: 100px;
height: 100px;
background: green;
position: absolute;
}

::part(party) {
view-transition-name: animate-me;
}

html {
view-transition-name: none;
}

html::view-transition-group(*) { animation-play-state: paused; }
html::view-transition-old(*) { animation: unset; opacity: 0 }
html::view-transition-new(*) { animation: unset; opacity: 0 }
html::view-transition-group(animate-me) {
position: absolute;
width: 100px;
height: 100px;
background: red;
}
</style>

<div></div>

<custom-component>
<template shadowrootmode="open">
<style>
div {
width: 100px;
height: 100px;
position: absolute;
view-transition-name: please-dont-animate-me !important;
}
</style>
<div part="party"></div>
</template>
</custom-component>

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

function runTest() {
document.startViewTransition().ready.then(takeScreenshot);
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>

</body>
51 changes: 51 additions & 0 deletions css/css-view-transitions/shadow-part-with-name.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: shadow parts </title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="match" href="names-are-tree-scoped-ref.html">
<script src="/common/reftest-wait.js"></script>
<style>
div {
width: 100px;
height: 100px;
background: red;
}

::part(party) {
view-transition-name: party;
}

:root { view-transition-name: none; }
html::view-transition-group(*) { animation-play-state: paused; }
html::view-transition-old(*) { animation: unset; opacity: 0 }
html::view-transition-new(*) { animation: unset; opacity: 0 }
html::view-transition-group(party) {
position: absolute;
width: 100px;
height: 100px;
background: green;
}
</style>

<custom-component>
<template shadowrootmode="open">
<style>
div {
width: 100px;
height: 100px;
}
</style>
<div part="party"></div>
</template>
</custom-component>

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

function runTest() {
document.startViewTransition().ready.then(takeScreenshot);
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>

</body>