mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 05:45:33 +00:00
Bug 1307555 - Mochitest. r=kats
MozReview-Commit-ID: 1e06rX4SQD8 --HG-- extra : rebase_source : 4f2aa932af8c1c8332d49aeaace687c71a4d58bc
This commit is contained in:
parent
674b1aad72
commit
6f01e47daa
@ -0,0 +1,64 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>APZ hit-testing over a checkerboarded area</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"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="scroller" style="width: 300px; height: 300px; overflow:scroll; margin-top: 100px; margin-left: 50px">
|
||||
<!-- Make the contents tall enough to be sure we can checkerboard -->
|
||||
<div id="contents" style="width: 100%; height: 5000px; background-image: linear-gradient(blue,red)">
|
||||
</div>
|
||||
</div>
|
||||
<div id="make_root_scrollable" style="height: 5000px"></div>
|
||||
</body>
|
||||
<script type="application/javascript">
|
||||
|
||||
function centerOf(element) {
|
||||
var bounds = element.getBoundingClientRect();
|
||||
return { x: bounds.x + (bounds.width / 2), y: bounds.y + (bounds.height / 2) };
|
||||
}
|
||||
|
||||
function* test(testDriver) {
|
||||
var config = getHitTestConfig();
|
||||
var utils = config.utils;
|
||||
|
||||
var scroller = document.getElementById('scroller');
|
||||
|
||||
// Activate the scrollframe but keep the main-thread scroll position at 0.
|
||||
// Also apply an async scroll offset in the y-direction such that the
|
||||
// scrollframe scrolls all the way to the bottom of its range, where it's
|
||||
// sure to checkerboard.
|
||||
utils.setDisplayPortForElement(0, 0, 300, 1000, scroller, 1);
|
||||
yield waitForAllPaints(testDriver);
|
||||
var scrollY = scroller.scrollTopMax;
|
||||
utils.setAsyncScrollOffset(scroller, 0, scrollY);
|
||||
if (config.isWebRender) {
|
||||
// Tick the refresh driver once to make sure the compositor has applied the
|
||||
// async scroll offset (for APZ hit-testing this doesn't matter, but for
|
||||
// WebRender hit-testing we need to make sure WR has the latest info).
|
||||
utils.advanceTimeAndRefresh(16);
|
||||
utils.restoreNormalRefresh();
|
||||
}
|
||||
|
||||
var scrollerViewId = utils.getViewId(scroller);
|
||||
|
||||
// Hit-test the middle of the scrollframe, which is now inside the
|
||||
// checkerboarded region, and check that we hit the scrollframe and
|
||||
// not its parent.
|
||||
var {hitInfo, scrollId} = hitTest(centerOf(scroller));
|
||||
is(hitInfo, APZHitResultFlags.VISIBLE,
|
||||
"active scrollframe hit info");
|
||||
is(scrollId, scrollerViewId,
|
||||
"active scrollframe scrollid");
|
||||
|
||||
subtestDone();
|
||||
}
|
||||
|
||||
waitUntilApzStable().then(runContinuation(test));
|
||||
|
||||
</script>
|
||||
</html>
|
@ -20,6 +20,7 @@
|
||||
helper_iframe1.html
|
||||
helper_iframe2.html
|
||||
helper_hittest_basic.html
|
||||
helper_hittest_checkerboard.html
|
||||
helper_hittest_subframe_float.html
|
||||
helper_key_scroll.html
|
||||
helper_long_tap.html
|
||||
|
@ -29,6 +29,7 @@ var prefs = [
|
||||
var subtests = [
|
||||
{'file': 'helper_hittest_basic.html', 'prefs': prefs},
|
||||
{'file': 'helper_hittest_subframe_float.html', 'prefs': prefs},
|
||||
{'file': 'helper_hittest_checkerboard.html', 'prefs': prefs},
|
||||
];
|
||||
|
||||
if (isApzEnabled()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user