Bug 1478304 - Add a mochitest. r=kats
authorBotond Ballo <botond@mozilla.com>
Sat, 20 Oct 2018 01:03:47 +0000
changeset 490566 4a875561b1ae1ceb0c3e0dcbea14ee46abb9725d
parent 490565 ebf726d7d48ddc01f847a43baf3a606ce6ad2429
child 490567 24a03346eaf5e5306a1c4d983e30c5102629560c
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerskats
bugs1478304
milestone64.0a1
Bug 1478304 - Add a mochitest. r=kats Depends on D9327 Differential Revision: https://phabricator.services.mozilla.com/D9328
gfx/layers/apz/test/mochitest/helper_hittest_sticky_bug1478304.html
gfx/layers/apz/test/mochitest/test_group_hittest.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_sticky_bug1478304.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>APZ hit-testing with sticky element inside a transform (bug 1478304)</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>
+  <meta name="viewport" content="width=device-width"/>
+  <style>
+    #subframe {
+      width: 500px;
+      height: 200px;
+      overflow-y: auto;
+    }
+    #transform { 
+      transform: translate(0); 
+    }
+    #sticky {
+      background-color: white;
+      position: sticky;
+      top: 0;
+    }
+    #spacer {
+      width: 100px;
+      height: 1000px;
+    }
+    </style>
+</head>
+<body>
+  <div id="subframe">
+    <div id="transform">
+      <div id="sticky">sticky with transformed parent (click me or hover me and try a scroll)</div>
+      <div id="spacer"></div>
+    </div>
+  </div>
+</body>
+<script type="application/javascript">
+
+function* test(testDriver) {
+  var utils = getHitTestConfig().utils;
+
+  var subframe = document.getElementById("subframe");
+  var sticky = document.getElementById("sticky");
+
+  checkHitResult(
+    hitTest(centerOf(sticky)),
+    APZHitResultFlags.VISIBLE,
+    utils.getViewId(subframe),
+    "subframe was successfully hit");
+
+  subtestDone();
+}
+
+waitUntilApzStable().then(runContinuation(test));
+
+</script>
+</html>
--- a/gfx/layers/apz/test/mochitest/test_group_hittest.html
+++ b/gfx/layers/apz/test/mochitest/test_group_hittest.html
@@ -29,17 +29,18 @@ var prefs = [
 var subtests = [
   {'file': 'helper_hittest_basic.html', 'prefs': prefs},
   {'file': 'helper_hittest_fixed_in_scrolled_transform.html', 'prefs': prefs},
   {'file': 'helper_hittest_float_bug1434846.html', 'prefs': prefs},
   {'file': 'helper_hittest_float_bug1443518.html', 'prefs': prefs},
   {'file': 'helper_hittest_checkerboard.html', 'prefs': prefs},
   {'file': 'helper_hittest_backface_hidden.html', 'prefs': prefs},
   {'file': 'helper_hittest_touchaction.html', 'prefs': prefs},
-  {'file': 'helper_hittest_nested_transforms_bug1459696.html', 'prefs': prefs}
+  {'file': 'helper_hittest_nested_transforms_bug1459696.html', 'prefs': prefs},
+  {'file': 'helper_hittest_sticky_bug1478304.html', 'prefs': prefs}
 ];
 
 if (isApzEnabled()) {
   SimpleTest.waitForExplicitFinish();
   window.onload = function() {
     runSubtestsSeriallyInFreshWindows(subtests)
     .then(SimpleTest.finish, SimpleTest.finish);
   };