Bug 1276107 - Add a test for scrolling an inactive subframe with perspective. r=kats, a=lizzard
authorBotond Ballo <botond@mozilla.com>
Wed, 01 Jun 2016 19:40:23 -0400
changeset 339637 db30e31b4b47e87a98eec2979b765b35d23ac65f
parent 339636 9044530a959509248a485cffec7f679da20b434f
child 339638 2393f2456c18149405eb75b2de561a53ef145cd9
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, lizzard
bugs1276107
milestone49.0a2
Bug 1276107 - Add a test for scrolling an inactive subframe with perspective. r=kats, a=lizzard MozReview-Commit-ID: 4gGzgo4dyoI
gfx/layers/apz/test/mochitest/helper_scroll_inactive_perspective.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_perspective.html
@@ -0,0 +1,46 @@
+<head>
+  <meta name="viewport" content="width=device-width; initial-scale=1.0">
+  <title>Wheel-scrolling over inactive subframe with perspective</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, to make sure 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;
+      perspective: 400px;
+    }
+    #scrolled {
+      width: 200px;
+      height: 1000px; /* so the subframe has room to scroll */
+      background: linear-gradient(red, blue); /* so you can see it scroll */
+      transform: translateZ(0px); /* so the perspective makes it to the display list */
+    }
+  </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
@@ -15,16 +15,17 @@ support-files =
   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_touch_action.html
   helper_touch_action_regions.html
+  helper_scroll_inactive_perspective.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
@@ -3,31 +3,31 @@
 <head>
   <meta charset="utf-8">
   <title>Various wheel-scrolling tests that spawn in new windows</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="apz_test_utils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
+var prefs = [
+  // turn off smooth scrolling so that we don't have to wait for
+  // APZ animations to finish before sampling the scroll offset
+  ['general.smoothScroll', false],
+  // ensure that any mouse movement will trigger a new wheel transaction,
+  // because in this test we move the mouse a bunch and want to recalculate
+  // 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': [
-        // turn off smooth scrolling so that we don't have to wait for
-        // APZ animations to finish before sampling the scroll offset
-        ['general.smoothScroll', false],
-        // ensure that any mouse movement will trigger a new wheel transaction,
-        // because in this test we move the mouse a bunch and want to recalculate
-        // the target APZC after each such movement.
-        ['mousewheel.transaction.ignoremovedelay', 0],
-        ['mousewheel.transaction.timeout', 0]]},
-  {'file': 'helper_bug1271432.html', 'prefs': [
-        // same prefs as in the previous test, for the same reasons.
-        ['general.smoothScroll', false],
-        ['mousewheel.transaction.ignoremovedelay', 0],
-        ['mousewheel.transaction.timeout', 0]]}
+  {'file': 'helper_scroll_on_position_fixed.html', 'prefs': prefs},
+  {'file': 'helper_bug1271432.html', 'prefs': prefs},
+  {'file': 'helper_scroll_inactive_perspective.html', 'prefs': prefs}
 ];
 
 if (isApzEnabled()) {
   SimpleTest.waitForExplicitFinish();
   window.onload = function() {
     runSubtestsSeriallyInFreshWindows(subtests)
     .then(SimpleTest.finish);
   };