Bug 1425603 - APZ mochitest for obeying overscroll-behavior when scrolling over a checkerboarded area. r=kats

MozReview-Commit-ID: JMWBVf2bKKP

--HG--
rename : gfx/layers/apz/test/mochitest/helper_scroll_overscroll_behavior.html => gfx/layers/apz/test/mochitest/helper_overscroll_behavior_bug1425573.html
extra : rebase_source : be9f67885ef2fd13b6e3bc377903da7878d53ed1
This commit is contained in:
Botond Ballo 2018-03-21 18:59:38 -04:00
Родитель eaa4aed34f
Коммит af24ea01cd
4 изменённых файлов: 83 добавлений и 3 удалений

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

@ -0,0 +1,78 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Scrolling over checkerboarded area respects overscroll-behavior</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>
#subframe {
width: 100px;
height: 100px;
overflow: scroll;
margin-top: 10px;
margin-left: 10px;
overscroll-behavior: contain;
}
#contents {
width: 100%;
height: 1000px;
background-image: linear-gradient(red, blue);
}
</style>
</head>
<body>
<div id="subframe">
<div id="contents"></div>
</div>
<div id="make_root_scrollable" style="height: 5000px"></div>
</body>
<script type="application/javascript">
function* test(testDriver) {
var config = getHitTestConfig();
var utils = config.utils;
var subframe = document.getElementById('subframe');
// Activate the scrollframe but keep the main-thread scroll position at 0.
// Also apply an async scroll offset in the y-direction large enough
// to make the scrollframe checkerboard.
// Note: We have to be careful with the numbers here.
// moveMouseAndScrollWheelOver() relies on the main thread receiving
// the synthesized mouse-move and wheel events. However, the async
// transform created by setAsyncScrollOffset() will cause an untransform
// to be applied to the synthesized events' coordinates before they're
// passed to the main thread. We have to make sure the transform is
// large enough to cause the scroll frame to checkerboard, but not so
// large that the untransformed coordinates hit-test out of bounds for
// the browser's content area. This is why we make the scroll frame
// small (100x100), and give it a display port that's also just 100x100,
// so we can keep the async scroll offset small enough (300 in this case)
// that the untransformed coordinates are still in-bounds for the window.
utils.setDisplayPortForElement(0, 0, 100, 100, subframe, 1);
yield waitForAllPaints(testDriver);
var scrollY = 300;
utils.setAsyncScrollOffset(subframe, 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();
}
// Scroll over the subframe, and make sure that the page does not scroll,
// i.e. overscroll-behavior is respected.
var waitForScroll = false; // don't wait for a scroll event, it will never come
yield moveMouseAndScrollWheelOver(subframe, 50, 50, testDriver, waitForScroll);
ok(window.scrollY == 0, "overscroll-behavior was respected");
subtestDone();
}
waitUntilApzStable().then(runContinuation(test));
</script>
</html>

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

@ -28,11 +28,12 @@
helper_long_tap.html helper_long_tap.html
helper_override_root.html helper_override_root.html
helper_override_subdoc.html helper_override_subdoc.html
helper_overscroll_behavior_bug1425573.html
helper_overscroll_behavior_bug1425603.html
helper_scroll_inactive_perspective.html helper_scroll_inactive_perspective.html
helper_scroll_inactive_zindex.html helper_scroll_inactive_zindex.html
helper_scroll_on_position_fixed.html helper_scroll_on_position_fixed.html
helper_scroll_over_scrollbar.html helper_scroll_over_scrollbar.html
helper_scroll_overscroll_behavior.html
helper_scroll_tables_perspective.html helper_scroll_tables_perspective.html
helper_scrollto_tap.html helper_scrollto_tap.html
helper_subframe_style.css helper_subframe_style.css

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

@ -26,7 +26,7 @@ var prefs = [
var scrollbar_prefs = prefs.slice(); // make a copy var scrollbar_prefs = prefs.slice(); // make a copy
scrollbar_prefs.push(["layout.scrollbars.always-layerize-track", true]); scrollbar_prefs.push(["layout.scrollbars.always-layerize-track", true]);
// For helper_scroll_overscroll_behavior, we need to set the APZ content // For helper_overscroll_behavior_bug1425573, we need to set the APZ content
// response timeout to 0, so we exercise the fallback codepath. // response timeout to 0, so we exercise the fallback codepath.
var timeout_prefs = prefs.slice(); // make a copy var timeout_prefs = prefs.slice(); // make a copy
timeout_prefs.push(["apz.content_response_timeout", 0]); timeout_prefs.push(["apz.content_response_timeout", 0]);
@ -34,11 +34,12 @@ timeout_prefs.push(["apz.content_response_timeout", 0]);
var subtests = [ var subtests = [
{'file': 'helper_scroll_on_position_fixed.html', 'prefs': prefs}, {'file': 'helper_scroll_on_position_fixed.html', 'prefs': prefs},
{'file': 'helper_bug1271432.html', 'prefs': prefs}, {'file': 'helper_bug1271432.html', 'prefs': prefs},
{'file': 'helper_overscroll_behavior_bug1425573.html', 'prefs': timeout_prefs},
{'file': 'helper_overscroll_behavior_bug1425603.html', 'prefs': prefs},
{'file': 'helper_scroll_inactive_perspective.html', 'prefs': prefs}, {'file': 'helper_scroll_inactive_perspective.html', 'prefs': prefs},
{'file': 'helper_scroll_inactive_zindex.html', 'prefs': prefs}, {'file': 'helper_scroll_inactive_zindex.html', 'prefs': prefs},
{'file': 'helper_scroll_over_scrollbar.html', 'prefs': scrollbar_prefs}, {'file': 'helper_scroll_over_scrollbar.html', 'prefs': scrollbar_prefs},
{'file': 'helper_scroll_tables_perspective.html', 'prefs': prefs}, {'file': 'helper_scroll_tables_perspective.html', 'prefs': prefs},
{'file': 'helper_scroll_overscroll_behavior.html', 'prefs': timeout_prefs},
]; ];
if (isApzEnabled()) { if (isApzEnabled()) {