Bug 1465616 - Add reftests for main-thread scroll behaviour. r=botond draft
authorKashav Madan <kshvmdn@gmail.com>
Tue, 14 Aug 2018 13:34:36 -0400
changeset 830111 24023dd4bbb020e0ee71599a4f81a37a1642d80b
parent 830110 ff297bc935576a9fa7f4ee3a9f23803d96d74046
child 830112 1021f8858ff53c93b718cb2c8f4265dbe99a8f91
push id118813
push userbmo:kshvmdn@gmail.com
push dateSun, 19 Aug 2018 00:42:00 +0000
reviewersbotond
bugs1465616
milestone63.0a1
Bug 1465616 - Add reftests for main-thread scroll behaviour. r=botond MozReview-Commit-ID: IzSUQqvjrUp
gfx/layers/apz/test/reftest/pinch-zoom-position-fixed-ref.html
gfx/layers/apz/test/reftest/pinch-zoom-position-fixed.html
gfx/layers/apz/test/reftest/pinch-zoom-position-sticky-ref.html
gfx/layers/apz/test/reftest/pinch-zoom-position-sticky.html
gfx/layers/apz/test/reftest/reftest.list
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/reftest/pinch-zoom-position-fixed-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=1.5">
+  <style>
+    body {
+      margin: 0;
+      height: 2000px;
+      overflow: hidden;
+    }
+    div {
+      position: absolute;
+      bottom: 0;
+      width: 100%;
+      height: 500px;
+      background: repeating-linear-gradient(90deg, transparent, transparent 20px, black 20px, black 40px);
+    }
+  </style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/reftest/pinch-zoom-position-fixed.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=1.5">
+  <style>
+    body {
+      margin: 0;
+      height: 2000px;
+      overflow: hidden;
+    }
+    div {
+      position: fixed;
+      bottom: 0;
+      width: 100%;
+      height: 500px;
+      background: repeating-linear-gradient(90deg, transparent, transparent 20px, black 20px, black 40px);
+    }
+  </style>
+</head>
+<body onload="scrollTo(0, 500); document.documentElement.classList.remove('reftest-wait');">
+  <!-- Test that fixed position elements are attached to the layout viewport
+       instead of the visual viewport.
+
+       The reference page has a position:absolute element in place of a
+       position:fixed element, both positioned at the bottom of the page.
+
+       After zooming in, the top edge of the visual viewport will coincide with
+       the top edge of the layout viewport, but their bottom edges will
+       diverge.
+
+       Since absolute elements are attached to the initial containing block,
+       which coincides with the layout viewport on page load, the rendering of
+       the fixed element will only match if it is being attached to the layout
+       viewport. -->
+  <div></div>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/reftest/pinch-zoom-position-sticky-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=1.5">
+  <style>
+    body {
+      margin: 0;
+      height: 2000px;
+      overflow: hidden;
+    }
+    #tall {
+      height: 100vh;
+    }
+    #sticky {
+      position: absolute;
+      bottom: 0;
+      width: 100%;
+      height: 500px;
+      background: repeating-linear-gradient(90deg, transparent, transparent 20px, black 20px, black 40px);
+    }
+  </style>
+</head>
+<body>
+  <div id="tall"></div>
+  <div id="sticky"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/reftest/pinch-zoom-position-sticky.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+  <meta name="viewport" content="width=device-width, initial-scale=1.5">
+  <style>
+    body {
+      margin: 0;
+      height: 2000px;
+      overflow: hidden;
+    }
+    #tall {
+      height: 100vh;
+    }
+    #sticky {
+      position: sticky;
+      bottom: 0;
+      width: 100%;
+      height: 500px;
+      background: repeating-linear-gradient(90deg, transparent, transparent 20px, black 20px, black 40px);
+    }
+  </style>
+</head>
+<body onload="scrollTo(0, 500); document.documentElement.classList.remove('reftest-wait');">
+  <!-- This is similar to the pinch-zoom-position-fixed test, but we add a tall
+       element before the sticky element to ensure that the sticky element is
+       in its "fixed" configuration on page load. -->
+  <div id="tall"></div>
+  <div id="sticky"></div>
+</body>
+</html>
+
--- a/gfx/layers/apz/test/reftest/reftest.list
+++ b/gfx/layers/apz/test/reftest/reftest.list
@@ -17,8 +17,17 @@ fuzzy-if(Android,0-45,0-26) skip-if(!And
 # As above, the end of the scrollthumb won't match perfectly, but the bulk of the scrollbar should be present and identical.
 fuzzy-if(Android,0-54,0-14) skip-if(!Android) pref(apz.allow_zooming,true) == scrollbar-zoom-resolution-1.html scrollbar-zoom-resolution-1-ref.html
 fuzzy-if(Android,0-51,0-22) skip-if(!Android) pref(apz.allow_zooming,true) == scrollbar-zoom-resolution-2.html scrollbar-zoom-resolution-2-ref.html
 
 # Meta-viewport tag support
 skip-if(!Android) pref(apz.allow_zooming,true) == initial-scale-1.html initial-scale-1-ref.html
 
 skip-if(!asyncPan) == frame-reconstruction-scroll-clamping.html frame-reconstruction-scroll-clamping-ref.html
+
+# Test that position:fixed and position:sticky elements are attached to the
+# layout viewport.
+#
+# We skip these tests on Desktop platforms since they require container
+# scrolling, which is enabled by default on Android, but behind a "Once" pref
+# and cannot be enabled for individual reftests.
+skip-if(!Android) pref(apz.allow_zooming,true) == pinch-zoom-position-fixed.html pinch-zoom-position-fixed-ref.html
+skip-if(!Android) pref(apz.allow_zooming,true) == pinch-zoom-position-sticky.html pinch-zoom-position-sticky-ref.html