Bug 1465616 - Add async-scroll reftests. r?botond draft
authorKashav Madan <kshvmdn@gmail.com>
Fri, 20 Jul 2018 17:48:30 -0400
changeset 830112 1021f8858ff53c93b718cb2c8f4265dbe99a8f91
parent 830111 24023dd4bbb020e0ee71599a4f81a37a1642d80b
child 830113 5bc06f9e584857c04e0bdf7af61882fe613e9fe0
push id118813
push userbmo:kshvmdn@gmail.com
push dateSun, 19 Aug 2018 00:42:00 +0000
reviewersbotond
bugs1465616
milestone63.0a1
Bug 1465616 - Add async-scroll reftests. r?botond The first set of tests test that fixed/sticky position elements are no longer attached to the visual viewport (i.e., that they go "out of view" when the visual viewport is scrolled) and the second set of tests test that fixed/sticky position elements are attached to the layout viewport (i.e., that they "follow" the layout viewport when it's scrolled). MozReview-Commit-ID: 6H2f0oz9lW7
layout/reftests/async-scrolling/position-fixed-async-zoom-1-ref.html
layout/reftests/async-scrolling/position-fixed-async-zoom-1.html
layout/reftests/async-scrolling/position-fixed-async-zoom-2-ref.html
layout/reftests/async-scrolling/position-fixed-async-zoom-2.html
layout/reftests/async-scrolling/position-sticky-async-zoom-1-ref.html
layout/reftests/async-scrolling/position-sticky-async-zoom-1.html
layout/reftests/async-scrolling/position-sticky-async-zoom-2-ref.html
layout/reftests/async-scrolling/position-sticky-async-zoom-2.html
layout/reftests/async-scrolling/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-fixed-async-zoom-1-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=2.0">
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: fixed;
+      top: -50px;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-fixed-async-zoom-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html reftest-async-scroll
+      reftest-displayport-x="0" reftest-displayport-y="0"
+      reftest-displayport-w="800" reftest-displayport-h="1000"
+      reftest-async-scroll-x="0" reftest-async-scroll-y="50"
+      reftest-async-zoom="2.0">
+<head>
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: fixed;
+      top: 0;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body>
+  <!-- Test that position:fixed elements are attached to the layout viewport
+       instead of the visual viewport.
+
+       An async scroll of 50 CSS pixels will scroll the visual viewport by 100
+       screen pixels (since async zoom is set to 2.0) and result in the top
+       half of the div being scrolled out of view. -->
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-fixed-async-zoom-2-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=2.0">
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: absolute;
+      top: 0;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-fixed-async-zoom-2.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html class="reftest-wait"
+      reftest-async-scroll
+      reftest-displayport-x="0" reftest-displayport-y="0"
+      reftest-displayport-w="800" reftest-displayport-h="1000"
+      reftest-async-scroll-x="0" reftest-async-scroll-y="-50"
+      reftest-async-zoom="2.0">
+<head>
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: fixed;
+      top: 0;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body onload="scrollTo(0, 1000); document.documentElement.classList.remove('reftest-wait');">
+  <!-- Test that position:fixed elements scroll with the layout viewport.
+
+       Scroll the window (i.e., the layout viewport) to (0, 1000). An async
+       scroll of -50 CSS pixels will move both the layout and visual viewport
+       up by 100 screen pixels (since async zoom is set to 2.0). The div should
+       remain at top-left corner of the layout viewport. -->
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-sticky-async-zoom-1-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=2.0">
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: fixed;
+      top: -50px;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-sticky-async-zoom-1.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html reftest-async-scroll
+      reftest-displayport-x="0" reftest-displayport-y="0"
+      reftest-displayport-w="800" reftest-displayport-h="1000"
+      reftest-async-scroll-x="0" reftest-async-scroll-y="50"
+      reftest-async-zoom="2.0">
+<head>
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: sticky;
+      top: 0;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body>
+  <!-- This test is identical to the position-fixed-async-zoom-1 test, but for
+       position:sticky elements. -->
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-sticky-async-zoom-2-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=2.0">
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: absolute;
+      top: 0;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/position-sticky-async-zoom-2.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html class="reftest-wait"
+      reftest-async-scroll
+      reftest-displayport-x="0" reftest-displayport-y="0"
+      reftest-displayport-w="800" reftest-displayport-h="1000"
+      reftest-async-scroll-x="0" reftest-async-scroll-y="-50"
+      reftest-async-zoom="2.0">
+<head>
+  <style>
+    body {
+      height: 3000px;
+      margin: 0;
+      overflow: hidden;
+    }
+    div {
+      position: sticky;
+      top: 0;
+      width: 100px;
+      height: 100px;
+      background: green;
+    }
+  </style>
+</head>
+<body onload="scrollTo(0, 1000); document.documentElement.classList.remove('reftest-wait');">
+  <!-- This test is identical to the position-fixed-async-zoom-2 test, but for
+       position:sticky elements. -->
+  <div></div>
+</body>
+</html>
--- a/layout/reftests/async-scrolling/reftest.list
+++ b/layout/reftests/async-scrolling/reftest.list
@@ -71,8 +71,13 @@ fuzzy-if(Android,0-2,0-4) skip-if(!async
 # as it will expand the displayport beyond what the test specifies in
 # its reftest-displayport attributes, and interfere with where we expect
 # checkerboarding to occur
 default-preferences pref(layers.low-precision-buffer,false)
 skip-if(!asyncPan) == checkerboard-1.html checkerboard-1-ref.html
 skip-if(!asyncPan) == checkerboard-2.html checkerboard-2-ref.html
 skip-if(!asyncPan) == checkerboard-3.html checkerboard-3-ref.html
 default-preferences
+
+skip-if(!Android) pref(apz.allow_zooming,true) == position-fixed-async-zoom-1.html position-fixed-async-zoom-1-ref.html
+skip-if(!Android) pref(apz.allow_zooming,true) == position-fixed-async-zoom-2.html position-fixed-async-zoom-2-ref.html
+skip-if(!Android) pref(apz.allow_zooming,true) == position-sticky-async-zoom-1.html position-sticky-async-zoom-1-ref.html
+skip-if(!Android) pref(apz.allow_zooming,true) == position-sticky-async-zoom-2.html position-sticky-async-zoom-2-ref.html