diff options
Diffstat (limited to 'testing/web-platform/tests/scroll-animations/css/view-timeline-name-tree-scoped.html')
-rw-r--r-- | testing/web-platform/tests/scroll-animations/css/view-timeline-name-tree-scoped.html | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-animations/css/view-timeline-name-tree-scoped.html b/testing/web-platform/tests/scroll-animations/css/view-timeline-name-tree-scoped.html new file mode 100644 index 0000000000..c216c345ed --- /dev/null +++ b/testing/web-platform/tests/scroll-animations/css/view-timeline-name-tree-scoped.html @@ -0,0 +1,145 @@ +<!DOCTYPE html> +<title>view-timelime-name and tree-scoped references</title> +<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#view-timelines-named"> +<link rel="help" src="https://drafts.csswg.org/css-scoping-1/#shadow-names"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/web-animations/testcommon.js"></script> +<script src="/resources/declarative-shadow-dom-polyfill.js"></script> + +<main id=main></main> +<script> + function inflate(t, template) { + t.add_cleanup(() => main.replaceChildren()); + main.append(template.content.cloneNode(true)); + main.offsetTop; + } + + setup(() => { + polyfill_declarative_shadow_dom(document); + }); +</script> +<style> + @keyframes anim { + from { z-index: 100; } + to { z-index: 100; } + } +</style> + + +<template id=view_timeline_host> + <style> + .target { + animation: anim 10s linear; + animation-timeline: timeline; + } + .scroller > div { + view-timeline: timeline horizontal; + } + </style> + <div class=scroller> + <div> + <div class=target> + <template shadowroot=open> + <style> + :host { + view-timeline: timeline vertical; + } + </style> + </template> + </div> + </div> + </div> + <style> + </style> +</template> +<script> + promise_test(async (t) => { + inflate(t, view_timeline_host); + let target = main.querySelector('.target'); + assert_equals(target.getAnimations().length, 1); + let anim = target.getAnimations()[0]; + assert_not_equals(anim.timeline, null); + assert_equals(anim.timeline.axis, 'horizontal'); + }, 'Outer animation can not see view timeline defined by :host'); +</script> + + +<template id=view_timeline_slotted> + <style> + .target { + animation: anim 10s linear; + animation-timeline: timeline; + } + .host { + view-timeline: timeline horizontal; + } + </style> + <div class=scroller> + <div class=host> + <template shadowroot=open> + <style> + ::slotted(.target) { + view-timeline: timeline vertical; + } + </style> + <slot></slot> + </template> + <div class=target></div> + </div> + </div> + <style> + </style> +</template> +<script> + promise_test(async (t) => { + inflate(t, view_timeline_slotted); + let target = main.querySelector('.target'); + assert_equals(target.getAnimations().length, 1); + let anim = target.getAnimations()[0]; + assert_not_equals(anim.timeline, null); + assert_equals(anim.timeline.axis, 'horizontal'); + }, 'Outer animation can not see view timeline defined by ::slotted'); +</script> + + +<template id=view_timeline_part> + <style> + .host { + view-timeline: timeline vertical; + } + .host::part(foo) { + view-timeline: timeline horizontal; + } + </style> + <div class=host> + <template shadowroot=open> + <style> + /* Not using 'anim' at document scope, due to https://crbug.com/1334534 */ + @keyframes anim2 { + from { z-index: 100; } + to { z-index: 100; } + } + .target { + animation: anim2 10s linear; + animation-timeline: timeline; + } + </style> + <div part=foo> + <div class=target></div> + </div> + </template> + </div> + <style> + </style> +</template> +<script> + promise_test(async (t) => { + inflate(t, view_timeline_part); + let target = main.querySelector('.host').shadowRoot.querySelector('.target'); + assert_equals(target.getAnimations().length, 1); + let anim = target.getAnimations()[0]; + assert_not_equals(anim.timeline, null); + assert_equals(anim.timeline.axis, 'horizontal'); + }, 'Inner animation can see view timeline defined by ::part'); +</script> |