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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2019-03-13 20:07:31 +00:00
Родитель 7086fcdc94
Коммит 6abae80411
2 изменённых файлов: 85 добавлений и 0 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -36,6 +36,7 @@ var subtests = [
{"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()) {