Bug 1246290 - Add a reftest for the apz.disable_for_scroll_linked_effects pref. r=botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 31 Mar 2016 14:39:32 -0400
changeset 346285 b25d9e38622f287977988fda1e39966c1c2be572
parent 346284 470c29ec77e0ea19e613d532b87d2f3cf1005dad
child 346286 c134231997ad853f04c6bc3303ab6b967baaa1a8
push id14327
push userkgupta@mozilla.com
push dateThu, 31 Mar 2016 18:40:12 +0000
reviewersbotond
bugs1246290
milestone48.0a1
Bug 1246290 - Add a reftest for the apz.disable_for_scroll_linked_effects pref. r=botond MozReview-Commit-ID: H5FYIiVCi8p
layout/reftests/async-scrolling/disable-apz-for-sle-pages-ref.html
layout/reftests/async-scrolling/disable-apz-for-sle-pages.html
layout/reftests/async-scrolling/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/disable-apz-for-sle-pages-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+  <title>Check that the apz.disable_for_sle_pages pref behaves as expected</title>
+  <script>
+    addEventListener('load', function() {
+        window.scrollTo(0, 100);
+        setTimeout(done, 0);
+    }, false);
+
+    function done() {
+        document.documentElement.classList.remove('reftest-wait');
+    }
+  </script>
+ </head>
+ <body style="height: 5000px; background-image:url(repeatable-diagonal-gradient.png);">
+  <div id="fake-fixed" style="position: absolute; top: 100px; left: 100px; width: 100px; height: 100px; background-color: green"></div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/async-scrolling/disable-apz-for-sle-pages.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait" reftest-async-scroll
+      reftest-async-scroll-y="200">
+ <head>
+  <title>Check that the apz.disable_for_sle_pages pref behaves as expected</title>
+  <script>
+    // Upon load, this page scrolls to (0, 100). This triggers a scroll event,
+    // which runs the scroll listener below. The scroll listener updates the
+    // position of the div to simulate position:fixed using a scroll-linked
+    // effect. The scroll-linked effect detector should then report that the
+    // document contains such an effect, which will disable APZ on the page.
+    // That in turn will cause the reftest-async-scroll-y to get ignored, and
+    // that's what the reftest checks for.
+
+    addEventListener('scroll', function() {
+        document.getElementById('fake-fixed').style.top = window.scrollY + "px";
+    }, false);
+
+    addEventListener('load', function() {
+        window.scrollTo(0, 100);
+        setTimeout(done, 0);
+    }, false);
+
+    function done() {
+        document.documentElement.classList.remove('reftest-wait');
+    }
+  </script>
+ </head>
+ <body style="height: 5000px; background-image:url(repeatable-diagonal-gradient.png);">
+  <div id="fake-fixed" style="position: absolute; top: 0; left: 100px; width: 100px; height: 100px; background-color: green"></div>
+ </body>
+</html>
--- a/layout/reftests/async-scrolling/reftest.list
+++ b/layout/reftests/async-scrolling/reftest.list
@@ -34,16 +34,17 @@ skip-if(!asyncPan) == position-sticky-tr
 skip-if(!asyncPan) == offscreen-prerendered-active-opacity.html offscreen-prerendered-active-opacity-ref.html
 fuzzy-if(Android,6,4) skip-if(!asyncPan) == offscreen-clipped-blendmode-1.html offscreen-clipped-blendmode-ref.html
 fuzzy-if(Android,6,4) skip-if(!asyncPan) == offscreen-clipped-blendmode-2.html offscreen-clipped-blendmode-ref.html
 fuzzy-if(Android,6,4) skip == offscreen-clipped-blendmode-3.html offscreen-clipped-blendmode-ref.html # bug 1251588 - wrong AGR on mix-blend-mode item
 fuzzy-if(Android,6,4) skip-if(!asyncPan) == offscreen-clipped-blendmode-4.html offscreen-clipped-blendmode-ref.html
 fuzzy-if(Android,7,4) skip-if(!asyncPan) == perspective-scrolling-1.html perspective-scrolling-1-ref.html
 fuzzy-if(Android,7,4) skip-if(!asyncPan) == perspective-scrolling-2.html perspective-scrolling-2-ref.html
 fuzzy-if(Android,7,4) skip-if(!asyncPan) == perspective-scrolling-3.html perspective-scrolling-3-ref.html
+pref(apz.disable_for_scroll_linked_effects,true) skip-if(!asyncPan) == disable-apz-for-sle-pages.html disable-apz-for-sle-pages-ref.html
 
 # for the following tests, we want to disable the low-precision buffer
 # 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