Bug 1276107 - Add a test for scrolling an inactive subframe with z-index. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Wed, 01 Jun 2016 19:56:49 -0400
changeset 375330 d48c76e7c8fc9db9d47d3553685c188c6dde0b88
parent 375329 a70b887bfaca17de4c68a5870145e21c2992695f
child 375331 5fddc3a80999cd6e284afbcabcddd74f398a06b9
push id20237
push userbballo@mozilla.com
push dateFri, 03 Jun 2016 22:33:44 +0000
reviewerskats
bugs1276107
milestone49.0a1
Bug 1276107 - Add a test for scrolling an inactive subframe with z-index. r=kats MozReview-Commit-ID: 6HcYkrmgLFw
gfx/layers/apz/test/mochitest/helper_scroll_inactive_zindex.html
gfx/layers/apz/test/mochitest/mochitest.ini
gfx/layers/apz/test/mochitest/test_group_wheelevents.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_scroll_inactive_zindex.html
@@ -0,0 +1,47 @@
+<head>
+  <meta name="viewport" content="width=device-width; initial-scale=1.0">
+  <title>Wheel-scrolling over inactive subframe with z-index</title>
+  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+  <script type="application/javascript" src="apz_test_utils.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
+  <script type="application/javascript">
+
+function* test(testDriver) {
+  var subframe = document.getElementById('scroll');
+
+  // scroll over the middle of the subframe, and make sure that it scrolls,
+  // not the page
+  var scrollPos = subframe.scrollTop;
+  yield moveMouseAndScrollWheelOver(subframe, 100, 100, testDriver);
+  dump("after scroll, subframe.scrollTop = " + subframe.scrollTop + "\n");
+  ok(subframe.scrollTop > scrollPos, "subframe scrolled after wheeling over it");
+}
+
+waitUntilApzStable()
+.then(runContinuation(test))
+.then(subtestDone);
+
+  </script>
+  <style>
+    #scroll {
+      width: 200px;
+      height: 200px;
+      overflow: scroll;
+    }
+    #scrolled {
+      width: 200px;
+      height: 1000px; /* so the subframe has room to scroll */
+      z-index: 2;
+      background: linear-gradient(red, blue); /* so you can see it scroll */
+      transform: translateZ(0px); /* to force active layers */ 
+      will-change: transform; /* to force active layers */
+    }
+  </style>
+</head>
+<body>
+  <div id="scroll">
+    <div id="scrolled"></div>
+  </div>
+  <div style="height: 5000px;"></div><!-- So the page is scrollable as well -->
+</body>
+</head>
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -14,16 +14,17 @@ support-files =
   helper_tap.html
   helper_long_tap.html
   helper_scroll_on_position_fixed.html
   helper_tap_passive.html
   helper_click.html
   helper_drag_click.html
   helper_bug1271432.html
   helper_scroll_inactive_perspective.html
+  helper_scroll_inactive_zindex.html
 tags = apz
 [test_bug982141.html]
 [test_bug1151663.html]
 [test_wheel_scroll.html]
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
 [test_wheel_transactions.html]
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
 [test_bug1151667.html]
--- a/gfx/layers/apz/test/mochitest/test_group_wheelevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_wheelevents.html
@@ -17,17 +17,18 @@ var prefs = [
   // the target APZC after each such movement.
   ['mousewheel.transaction.ignoremovedelay', 0],
   ['mousewheel.transaction.timeout', 0]
 ]
 
 var subtests = [
   {'file': 'helper_scroll_on_position_fixed.html', 'prefs': prefs},
   {'file': 'helper_bug1271432.html', 'prefs': prefs},
-  {'file': 'helper_scroll_inactive_perspective.html', 'prefs': prefs}
+  {'file': 'helper_scroll_inactive_perspective.html', 'prefs': prefs},
+  {'file': 'helper_scroll_inactive_zindex.html', 'prefs': prefs}
 ];
 
 if (isApzEnabled()) {
   SimpleTest.waitForExplicitFinish();
   window.onload = function() {
     runSubtestsSeriallyInFreshWindows(subtests)
     .then(SimpleTest.finish);
   };