Bug 1271432 - Add a mochitest. r=tnikkel a=test-only
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 17 May 2016 11:05:46 -0400
changeset 333177 9f96ed6259453ce242f41454ae822efc335e2e3c
parent 333176 3c7a33fe0b6472bf47264c2390c5bc19f1a6dce4
child 333178 7df3361227bfa579a8703712288f7b5c83ed8992
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel, test-only
Bug 1271432 - Add a mochitest. r=tnikkel a=test-only MozReview-Commit-ID: DUzs7VzRUte
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1271432.html
@@ -0,0 +1,594 @@
+  <title>Ensure that the hit region doesn't get unexpectedly expanded</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">
+var is = window.opener.is;
+var ok = window.opener.ok;
+function* runTest() {
+  var scroller = document.getElementById('scroller');
+  var scrollerPos = scroller.scrollTop;
+  var dx = 100, dy = 50;
+  is(window.scrollY, 0, "Initial page scroll position should be 0");
+  is(scrollerPos, 0, "Initial scroller position should be 0");
+  yield synthesizeNativeMouseMoveAndWaitForMoveEvent(scroller, dx, dy, driveTest);
+  yield synthesizeNativeWheelAndWaitForScrollEvent(scroller, dx, dy, 0, -10, driveTest);
+  is(window.scrollY, 0, "Page scroll position should still be 0");
+  ok(scroller.scrollTop > scrollerPos, "Scroller should have scrolled");
+  // wait for it to layerize fully and then try again
+  yield waitForAllPaints(function() {
+    flushApzRepaints(driveTest);
+  });
+  scrollerPos = scroller.scrollTop;
+  // The mouse is already at the right position. If we call scrollWheelOver it
+  // hangs on windows waiting for the mouse-move, so instead we just synthesize
+  // the wheel directly.
+  yield synthesizeNativeWheelAndWaitForScrollEvent(scroller, dx, dy, 0, -10, driveTest);
+  is(window.scrollY, 0, "Page scroll position should still be 0 after layerization");
+  ok(scroller.scrollTop > scrollerPos, "Scroller should have continued scrolling");
+var gTestContinuation = null;
+function driveTest() {
+  if (!gTestContinuation) {
+    gTestContinuation = runTest();
+  }
+  var ret = gTestContinuation.next();
+  if (ret.done) {
+    window.opener.testDone();
+  }
+window.onload = function() {
+  waitForAllPaints(function() {
+    flushApzRepaints(driveTest);
+  });
+a#with_after_content {
+    background-color: #F16725;
+    opacity: 0.8;
+    display: inline-block;
+    margin-top: 40px;
+    margin-left: 40px;
+a#with_after_content::after {
+    content: " ";
+    position: absolute;
+    width: 0px;
+    height: 0px;
+    bottom: 40px;
+    z-index: -1;
+    right: 40px;
+    background-color: transparent;
+    border-style: solid;
+    border-width: 15px 15px 15px 0;
+    border-color: #d54e0e transparent transparent transparent;
+    box-shadow: none;
+    box-sizing: border-box;
+div#scroller {
+    overflow-y: scroll;
+    width: 50%;
+    height: 50%;
+<a id="with_after_content">Some text</a>
+<div id="scroller">
+Scrolling on the very left edge of this div will work.
+Scrolling on the right side of this div (starting with the left edge of the orange box above) should work, but doesn't.<br/>
+<div style="height: 1000px">this div makes the page scrollable</div>
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -9,16 +9,17 @@ support-files =
+  helper_bug1271432.html
 tags = apz
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
--- a/gfx/layers/apz/test/mochitest/test_scroll_window.html
+++ b/gfx/layers/apz/test/mochitest/test_scroll_window.html
@@ -15,16 +15,21 @@ var tests = [
   {'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]]}
 var testIndex = -1;
 var w = null;
 function testDone() {
   var test = tests[testIndex];