Bug 1447131 - Mochitest for hit-testing over backface-visibility:hidden element. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Wed, 28 Mar 2018 14:22:54 -0400
changeset 773960 074ba63d6c4d9a69393cce691988697def556818
parent 773959 ad39696f8573e2e5119720c7495ce1b21cf62f82
child 774399 6859e152d1b28a1cf6113e5672ba39335e0895bc
child 774434 7be5b730fc074cfa872a12adaca27b1584f41cea
child 774442 11d9a120f1b1fdd841a7e7cb59b92975e08205df
child 775121 f1764396de82d583a087fe6cd27a5c11944d5121
push id104359
push userbballo@mozilla.com
push dateWed, 28 Mar 2018 18:25:07 +0000
reviewerskats
bugs1447131
milestone61.0a1
Bug 1447131 - Mochitest for hit-testing over backface-visibility:hidden element. r=kats MozReview-Commit-ID: EeQlvluPQD1
gfx/layers/apz/test/mochitest/helper_hittest_backface_hidden.html
gfx/layers/apz/test/mochitest/helper_hittest_subframe_float.html
gfx/layers/apz/test/mochitest/mochitest.ini
gfx/layers/apz/test/mochitest/test_group_hittest.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_backface_hidden.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>APZ hit-testing with backface-visibility:hidden</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>
+    body,html{
+      height: 100%;
+    }
+    body{
+      margin: 0;
+      transform-style: preserve-3d;
+    }
+    #back, #front{
+      backface-visibility: hidden;
+      position: absolute;
+      width: 100%;
+      height: 100%
+    }
+    #front{
+      overflow-y:auto;
+    }
+    #content{
+      width: 100%;
+      height: 200%;
+      background: linear-gradient(blue, green);
+    }
+    #back{
+      transform: rotateY(180deg);
+    }
+  </style>
+</head>
+<body>
+  <div id="front">
+    <div id="content"></div>
+  </div>
+  <div id="back"></div></body>
+<script type="application/javascript">
+
+function* test(testDriver) {
+  var config = getHitTestConfig();
+  if (config.isWebRender) {
+    ok(true, "This test is only enabled for non-WebRender");
+    subtestDone();
+    return;
+  }
+
+  var subframe = document.getElementById('front');
+  var subframeViewId = config.utils.getViewId(subframe);
+
+  var {hitInfo, scrollId} = hitTest(centerOf(subframe));
+
+  is(scrollId, subframeViewId,
+     "hit the scroll frame behind the backface-visibility:hidden element");
+
+  subtestDone();
+}
+
+waitUntilApzStable().then(runContinuation(test));
+
+</script>
+</html>
--- a/gfx/layers/apz/test/mochitest/helper_hittest_subframe_float.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_subframe_float.html
@@ -1,12 +1,12 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <title>Various tests to exercise the APZ hit-testing codepaths</title>
+  <title>APZ hit-testing with floated subframe</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>
     #float {
       float: left;
     }
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -16,16 +16,17 @@
     helper_bug1414336.html
     helper_click.html
     helper_div_pan.html
     helper_drag_click.html
     helper_drag_scroll.html
     helper_iframe_pan.html
     helper_iframe1.html
     helper_iframe2.html
+    helper_hittest_backface_hidden.html
     helper_hittest_basic.html
     helper_hittest_checkerboard.html
     helper_hittest_subframe_float.html
     helper_key_scroll.html
     helper_long_tap.html
     helper_override_root.html
     helper_override_subdoc.html
     helper_scroll_inactive_perspective.html
--- a/gfx/layers/apz/test/mochitest/test_group_hittest.html
+++ b/gfx/layers/apz/test/mochitest/test_group_hittest.html
@@ -25,16 +25,17 @@ var prefs = [
   // Turns on APZTestData logging which we use to obtain the hit test results.
   ["apz.test.logging_enabled", true]
 ];
 
 var subtests = [
   {'file': 'helper_hittest_basic.html', 'prefs': prefs},
   {'file': 'helper_hittest_subframe_float.html', 'prefs': prefs},
   {'file': 'helper_hittest_checkerboard.html', 'prefs': prefs},
+  {'file': 'helper_hittest_backface_hidden.html', 'prefs': prefs}
 ];
 
 if (isApzEnabled()) {
   SimpleTest.waitForExplicitFinish();
   window.onload = function() {
     runSubtestsSeriallyInFreshWindows(subtests)
     .then(SimpleTest.finish, SimpleTest.finish);
   };