summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scroll-animations/css/support
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/scroll-animations/css/support')
-rw-r--r--testing/web-platform/tests/scroll-animations/css/support/animation-range.css82
-rw-r--r--testing/web-platform/tests/scroll-animations/css/support/testcommon.js19
2 files changed, 101 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-animations/css/support/animation-range.css b/testing/web-platform/tests/scroll-animations/css/support/animation-range.css
new file mode 100644
index 0000000000..1ebd0b429b
--- /dev/null
+++ b/testing/web-platform/tests/scroll-animations/css/support/animation-range.css
@@ -0,0 +1,82 @@
+.flex {
+ display: flex;
+}
+
+.flex > div {
+ position: relative;
+ height: 160px;
+ margin: 0 10px;
+}
+
+.scroller {
+ width: 100px;
+ height: 100px;
+ overflow: auto;
+ border: 1px solid black;
+}
+
+.subject {
+ view-timeline-name: --view;
+ width: 20px;
+ height: 20px;
+ margin: 100px auto;
+ background: green;
+}
+
+.meters {
+ position: absolute;
+ left: 0;
+ top: 110px;
+ height: 50px;
+}
+
+.meters > div {
+ display: flex;
+ align-items: center;
+}
+
+@keyframes active-interval {
+ 0% { opacity: 1; }
+ 100% { opacity: 1; }
+}
+
+.meter {
+ width: 50px;
+ position: relative;
+ border: 2px solid black;
+ height: 5px;
+ overflow: clip;
+ opacity: 0.4;
+ animation: active-interval linear;
+ animation-timeline: --view;
+}
+
+@keyframes slide-in {
+ 0% { transform: translateX(-100%)}
+ 100% { transform: translateX(0%)}
+}
+
+.bar {
+ width: 100%;
+ height: 100%;
+ background: blue;
+ transform: translateX(-100%);
+ animation: slide-in linear;
+ animation-timeline: --view;
+}
+
+.spacer {
+ height: 400px;
+}
+
+.contain .bar, .contain .meter {
+ animation-range: contain;
+}
+
+.entry .bar, .entry .meter {
+ animation-range: entry;
+}
+
+.exit .bar, .exit .meter {
+ animation-range: exit;
+}
diff --git a/testing/web-platform/tests/scroll-animations/css/support/testcommon.js b/testing/web-platform/tests/scroll-animations/css/support/testcommon.js
new file mode 100644
index 0000000000..91540774d0
--- /dev/null
+++ b/testing/web-platform/tests/scroll-animations/css/support/testcommon.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/**
+ * Returns a Promise that is resolved after a CSS scroll timeline is created (as
+ * the result of a style change) and a snapshot has been taken, so that the
+ * animation style is correctly reflected by getComputedStyle().
+ * Technically, this only takes a full frame update. We implement this as two
+ * requestAnimationFrame callbacks because the result will be available at the
+ * beginning of the second frame.
+ */
+async function waitForCSSScrollTimelineStyle() {
+ await waitForNextFrame();
+ await waitForNextFrame();
+}
+
+function assert_implements_animation_timeline() {
+ assert_implements(CSS.supports('animation-timeline:--foo'),
+ 'animation-timeline not supported');
+}