diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/scroll-animations/css/view-timeline-lookup.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/scroll-animations/css/view-timeline-lookup.html')
-rw-r--r-- | testing/web-platform/tests/scroll-animations/css/view-timeline-lookup.html | 273 |
1 files changed, 273 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-animations/css/view-timeline-lookup.html b/testing/web-platform/tests/scroll-animations/css/view-timeline-lookup.html new file mode 100644 index 0000000000..6cead9dc58 --- /dev/null +++ b/testing/web-platform/tests/scroll-animations/css/view-timeline-lookup.html @@ -0,0 +1,273 @@ +<!DOCTYPE html> +<title>Named view-timeline lookup</title> +<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#view-timelines-named"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/web-animations/testcommon.js"></script> +<script src="support/testcommon.js"></script> +<style> + @keyframes anim { + from { z-index: 0; } + to { z-index: 100; } + } + .scroller { + overflow: auto; + width: 100px; + height: 100px; + } + .scroller > div { + height: 25px; + z-index: -1; + } +</style> +<main id=main></main> +<script> + function inflate(t, template) { + t.add_cleanup(() => main.replaceChildren()); + main.append(template.content.cloneNode(true)); + main.offsetTop; + } +</script> + +<template id=timeline_self> + <style> + #target { + height: 0px; + view-timeline: t1; + animation: anim 1s linear; + animation-timeline: t1; + } + </style> + <div id=scroller class=scroller> + <div id=target></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + </div> +</template> +<script> + promise_test(async (t) => { + inflate(t, timeline_self); + await waitForNextFrame(); + assert_equals(getComputedStyle(target).zIndex, '100'); + }, 'view-timeline on self'); +</script> + +<template id=timeline_preceding_sibling> + <style> + #scroller { + view-timeline: t1 defer; + } + #timeline { + height: 0px; + view-timeline: t1 ancestor; + } + #target { + animation: anim 1s linear; + animation-timeline: t1; + } + </style> + <div id=scroller class=scroller> + <div></div> + <div id=timeline></div> + <div></div> + <div></div> + <div id=target></div> + <div></div> + <div></div> + </div> +</template> +<script> + promise_test(async (t) => { + inflate(t, timeline_preceding_sibling); + await waitForNextFrame(); + assert_equals(getComputedStyle(target).zIndex, '75'); + }, 'view-timeline on preceding sibling'); +</script> + +<template id=timeline_ancestor> + <style> + #timeline { + height: 0px; + view-timeline: t1; + } + #target { + animation: anim 1s linear; + animation-timeline: t1; + } + </style> + <div id=scroller class=scroller> + <div></div> + <div></div> + <div></div> + <div id=timeline> + <div> + <div id=target></div> + </div> + </div> + <div></div> + <div></div> + </div> +</template> +<script> + promise_test(async (t) => { + inflate(t, timeline_ancestor); + await waitForNextFrame(); + assert_equals(getComputedStyle(target).zIndex, '25'); + }, 'view-timeline on ancestor'); +</script> + +<template id=timeline_ancestor_sibling> + <style> + #scroller { + view-timeline: t1 defer; + } + #timeline { + height: 0px; + view-timeline: t1 ancestor; + } + #target { + animation: anim 1s linear; + animation-timeline: t1; + } + </style> + <div id=scroller class=scroller> + <div></div> + <div id=timeline></div> + <div></div> + <div> + <div> + <div id=target></div> + </div> + </div> + <div></div> + <div></div> + </div> +</template> +<script> + promise_test(async (t) => { + inflate(t, timeline_ancestor_sibling); + await waitForNextFrame(); + assert_equals(getComputedStyle(target).zIndex, '75'); + }, 'view-timeline on ancestor sibling'); +</script> + +<template id=timeline_ancestor_sibling_conflict> + <style> + #scroller { + view-timeline: t1 defer; + } + #timeline1, #timeline2 { + height: 0px; + view-timeline: t1 ancestor; + } + #target { + animation: anim 1s linear; + animation-timeline: t1; + } + </style> + <div id=scroller class=scroller> + <div></div> + <div id=timeline1></div> + <div></div> + <div id=timeline2></div> + <div> + <div> + <div id=target></div> + </div> + </div> + <div></div> + <div></div> + </div> +</template> +<script> + promise_test(async (t) => { + inflate(t, timeline_ancestor_sibling_conflict); + await waitForNextFrame(); + assert_equals(getComputedStyle(target).zIndex, 'auto'); + }, 'view-timeline on ancestor sibling, conflict remains unresolved'); +</script> + +<template id=timeline_ancestor_closer_timeline_wins> + <style> + #scroller { + view-timeline: t1 defer; + } + #timeline { + height: 0px; + view-timeline: t1 ancestor; + } + #parent { + scroll-timeline: t1 defer; + } + #target { + animation: anim 1s linear; + animation-timeline: t1; + } + </style> + <div id=scroller class=scroller> + <div></div> + <div id=timeline></div> + <div></div> + <div id=parent> + <div id=target></div> + </div> + <div></div> + <div></div> + </div> +</template> +<script> + promise_test(async (t) => { + inflate(t, timeline_ancestor_closer_timeline_wins); + await waitForNextFrame(); + assert_equals(getComputedStyle(target).zIndex, 'auto'); + }, 'view-timeline on ancestor sibling, closer timeline wins'); +</script> + +<template id=timeline_ancestor_scroll_timeline_wins_on_same_element> + <style> + #scroller { + view-timeline: t1 defer; + scroll-timeline: t1 defer; + } + #timelines { + height: 0px; + view-timeline: t1 ancestor; + scroll-timeline: t1 ancestor; + overflow: auto; + } + #timelines > div { + height: 50px; + } + #target { + animation: anim 1s linear; + animation-timeline: t1; + } + </style> + <div id=scroller class=scroller> + <div></div> + <div id=timelines> + <div></div> + </div> + <div></div> + <div> + <div> + <div id=target></div> + </div> + </div> + <div></div> + <div></div> + </div> +</template> +<script> + promise_test(async (t) => { + inflate(t, timeline_ancestor_scroll_timeline_wins_on_same_element); + await waitForNextFrame(); + // In case of a name conflict on the same element, scroll progress timelines + // take precedence over view progress timelines. + // https://drafts.csswg.org/scroll-animations-1/#timeline-scope + assert_equals(getComputedStyle(target).zIndex, '0'); + }, 'view-timeline on ancestor sibling, scroll-timeline wins on same element'); +</script> |