Bug 1465616 - Add a mochitest for fixed position hit-testing. r=botond draft
authorKashav Madan <kmadan@mozilla.com>
Wed, 04 Jul 2018 16:17:31 -0400
changeset 821029 8ac7b31bc5ea58e3a5e2ff53c0889a535cab9df9
parent 821028 d4f597023ba54ab0082d5df77101fd89a8e3cbd7
push id116994
push userbmo:kmadan@mozilla.com
push dateFri, 20 Jul 2018 19:32:49 +0000
reviewersbotond
bugs1465616
milestone63.0a1
Bug 1465616 - Add a mochitest for fixed position hit-testing. r=botond MozReview-Commit-ID: IC82JZoVgPs
gfx/layers/apz/test/mochitest/helper_fixed_position_scroll_hittest.html
gfx/layers/apz/test/mochitest/test_group_zoom.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_fixed_position_scroll_hittest.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width; initial-scale=2.0">
+  <title>Hittest position:fixed zoomed scroll</title>
+  <script type="application/javascript" src="apz_test_utils.js"></script>
+  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
+  <style>
+    body {
+      margin: 0;
+    }
+    #fixed {
+      position: fixed;
+      height: 30px;
+      width: 100%;
+      background: linear-gradient(135deg, white, black);
+    }
+    #fixed > input {
+      position: absolute;
+      top: 0;
+      right: 0;
+      height: 100%;
+    }
+  </style>
+</head>
+<body>
+  <div id="fixed"><input type="button" value="Button" /></div>
+  <script>
+    function* test(testDriver) {
+      document.addEventListener("click", (e) => {
+        is(e.target, document.querySelector("input"), "got click");
+        subtestDone();
+      });
+      // Scroll all the way to the right to bring the button into view.
+      yield synthesizeNativeTouchDrag(document.querySelector("body"), 10, 10, -2000, 0, testDriver);
+      yield waitForApzFlushedRepaints(testDriver);
+      yield synthesizeNativeClick(document.querySelector("input"), 5, 5, testDriver);
+    }
+    waitUntilApzStable().then(runContinuation(test));
+  </script>
+</body>
+</html>
+
--- a/gfx/layers/apz/test/mochitest/test_group_zoom.html
+++ b/gfx/layers/apz/test/mochitest/test_group_zoom.html
@@ -35,16 +35,17 @@ var doubletap_prefs = [
   ["ui.click_hold_context_menus.delay", 10000],
   ["apz.max_tap_time", 10000],
 ];
 
 var subtests = [
   {'file': 'helper_bug1280013.html', 'prefs': prefs},
   {'file': 'helper_basic_zoom.html', 'prefs': prefs},
   {'file': 'helper_zoomed_pan.html', 'prefs': prefs},
+  {'file': 'helper_fixed_position_scroll_hittest.html', 'prefs': prefs},
   {'file': 'helper_basic_doubletap_zoom.html', 'prefs': doubletap_prefs},
 ];
 
 if (isApzEnabled()) {
   // This has a lot of subtests, and Android emulators are slow.
   SimpleTest.requestLongerTimeout(2);
   SimpleTest.waitForExplicitFinish();
   window.onload = function() {