Bug 1447131 - Mochitest for hit-testing over backface-visibility:hidden element. r=kats
MozReview-Commit-ID: EeQlvluPQD1
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);
};