Bug 1465616 - Add a mochitest for fixed position hit-testing. r=botond
MozReview-Commit-ID: IC82JZoVgPs
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_fixed_position_scroll_hittest.html
@@ -0,0 +1,54 @@
+<!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>
+ const input = document.querySelector("input");
+ function* test(testDriver) {
+ SpecialPowers.Services.obs.addObserver(testDriver, "APZ:TransformEnd");
+ yield synthesizeNativeTouchDrag(document.body, 10, 10, -2000, 0);
+ SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd", false);
+
+ yield waitForApzFlushedRepaints(testDriver);
+
+ // TODO: We're unsure why, but adding this observer substantially
+ // decreases the rate of intermittents that we see. We should figure out
+ // why and/or rewrite this test entirely.
+ SpecialPowers.Services.obs.addObserver(testDriver, "mouseevent");
+ yield synthesizeNativeClick(input, 0, 0, testDriver);
+ SpecialPowers.Services.obs.removeObserver(testDriver, "mouseevent", false);
+ }
+ window.addEventListener("click", (e) => {
+ is(e.target, input, "got click");
+ subtestDone();
+ });
+ 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() {