Bug 1534616 - Add a mochitest for hit-testing content under a clipped modal div. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 13 Mar 2019 20:07:31 +0000
changeset 521764 6b1b462030ce
parent 521763 57387d4ed085
child 521765 d280b4e8d2a4
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1534616, 1531170
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534616 - Add a mochitest for hit-testing content under a clipped modal div. r=botond This tests the scenario fixed by bug 1531170. Differential Revision: https://phabricator.services.mozilla.com/D23241
gfx/layers/apz/test/mochitest/helper_hittest_clipped_fixed_modal.html
gfx/layers/apz/test/mochitest/test_group_hittest.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_clipped_fixed_modal.html
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Hit-testing on content covered by a fullscreen fixed-position item clipped away</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>
+.modal
+{
+    position:fixed;
+    z-index:10;
+    width:100%;
+    height:100%;
+    left:0;
+    top:0;
+    clip:rect(1px,1px,1px,1px);
+}
+.modal__content
+{
+    overflow:auto;
+    position:fixed;
+    top:0;
+    left:0;
+    width:100%;
+    height:100%;
+}
+.modal__body
+{
+    position:absolute;
+    top:0;
+    left:0;
+    width:100%;
+    height:100%;
+}
+.content
+{
+    position:fixed;
+    top:0;
+    left:0;
+    width:100%;
+    height:100%;
+    overflow-y:auto
+}
+</style>
+</head>
+<body>
+<div class="content">
+ <div style="height: 5000px; background-image: linear-gradient(red,blue)">
+    Filler to make the content div scrollable
+ </div>
+</div>
+<div class="modal">
+ <div class="modal__content">
+  <div class="modal__body">
+  </div>
+ </div>
+</div>
+</body>
+<script type="application/javascript">
+
+function* test(testDriver) {
+  var config = getHitTestConfig();
+  var utils = config.utils;
+
+  // layerize the scrollable frame
+  var subframe = document.querySelector(".content");
+  utils.setDisplayPortForElement(0, 0, 800, 2000, subframe, 1);
+  yield waitForApzFlushedRepaints(testDriver);
+
+  var target = document.querySelector(".content");
+  checkHitResult(hitTest(centerOf(target)),
+                 APZHitResultFlags.VISIBLE,
+                 utils.getViewId(subframe),
+                 "content covered by a clipped fixed div");
+
+  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
@@ -31,16 +31,17 @@ var subtests = [
   {"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_sticky_bug1478304.html", "prefs": prefs},
+  {"file": "helper_hittest_clipped_fixed_modal.html", "prefs": prefs},
 ];
 
 if (isApzEnabled()) {
   SimpleTest.waitForExplicitFinish();
   window.onload = function() {
     runSubtestsSeriallyInFreshWindows(subtests)
     .then(SimpleTest.finish, SimpleTest.finish);
   };