summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_bug1464568_opacity.html
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_bug1464568_opacity.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1464568_opacity.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1464568_opacity.html b/gfx/layers/apz/test/mochitest/helper_bug1464568_opacity.html
new file mode 100644
index 0000000000..0a7715a995
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1464568_opacity.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test that opacity animation is correctly placed during asynchronous scrolling</title>
+ <script src="apz_test_utils.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+ <meta name="viewport" content="width=device-width"/>
+ <style>
+ #anim {
+ background: green;
+ width: 100px;
+ height: 100px;
+ animation: anim 100s step-start;
+ }
+ @keyframes anim {
+ from { opacity: 0; }
+ to { opacity: 1; }
+ }
+ </style>
+</head>
+<body>
+ <!--
+ This height should be smaller than window height, otherwise the animation
+ followed by this element will be out of view, thus the animation doesn't run
+ on the compositor.
+ -->
+ <div style="height: 500px"></div>
+ <div id="anim"></div>
+ <!--
+ Give the page room to scroll, so that the setAsyncScrollOffset() call
+ doesn't take the scroll position out of bounds
+ -->
+ <div style="height: 1000px"></div>
+</body>
+<script>
+"use strict";
+
+const utils = SpecialPowers.getDOMWindowUtils(window);
+
+async function test_opacity() {
+ utils.setDisplayPortForElement(0, 0, 300, 1000, document.documentElement, 1);
+ await promiseAllPaintsDone();
+ let dpr = window.devicePixelRatio;
+
+ let transform = parseTransform(utils.getOMTCTransform(anim));
+ isTransformClose(transform, [1, 0, 0, 1, 0, 0],
+ "The element shouldn't be moved before scrolling");
+
+ utils.setAsyncScrollOffset(document.documentElement, 0, 300);
+
+ await new Promise(resolve => waitForApzFlushedRepaints(resolve));
+
+ transform = parseTransform(utils.getOMTCTransform(anim));
+ isTransformClose(transform, [1, 0, 0, 1, 0, -300 * dpr],
+ "Element should have been moved by the offset");
+}
+
+if (utils.layerManagerType == "WebRender") {
+ ok(true, "This test doesn't need to run on WebRender");
+ subtestDone();
+} else {
+ waitUntilApzStable().then(test_opacity).then(subtestDone, subtestFailed);
+}
+
+</script>
+</html>