Differential Revision: https://phabricator.services.mozilla.com/D92891
This commit is contained in:
Timothy Nikkel 2020-10-10 03:00:36 +00:00
Родитель 68865466cc
Коммит dafb74eec8
4 изменённых файлов: 126 добавлений и 1 удалений

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

@ -0,0 +1,73 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Scrolling doesn't cause extra SchedulePaint calls</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
function startTest() {
if (SpecialPowers.getBoolPref("apz.force_disable_desktop_zooming_scrollbars")) {
setTimeout(subtestDone,0);
return;
}
if (window.scrollY == 0) {
// the scrollframe is not yet marked as APZ-scrollable. Mark it so and
// start over.
window.scrollTo(0, 1000);
waitForApzFlushedRepaints(startTest);
return;
}
window.synthesizeKey("KEY_ArrowDown");
// This is really tricky. We want to check that during the main part of
// scrolling after this we don't get any SchedulePaint calls. The way that we
// test that is to use checkAndClearDisplayListState on the document element
// to make sure it didn't have display list building ran for it. The
// synthesizeKey calls above will end up in ScrollFrameHelper::ScrollBy,
// which calls SchedulePaint in order to pass the scroll to the compositor to
// perform. That SchedulePaint will result in display list building for the
// document element, and that's okay, but we want to call
// checkAndClearDisplayListState (to clear the display list building state)
// right after that display list building, so that we can observe if any
// display list building happens after it. That way that we do that is a rAF,
// which runs immediately before painting, and then a setTimeout from the
// rAF, which should run almost immediately after painting. Then we wait for
// a scroll event, this scroll event is triggered by the compositor updating
// the main thread scroll position. And here is where we finally get to what
// we want to actually test. The original bug came about when the main
// thread, while processing the repaint request from the compositor, called
// SchedulePaint, and hence caused display list building. So we want to check
// that the refresh driver tick after the scroll event does not do any
// display list building. We again use a setTimeout from a rAF to run right
// after the paint and check that there was no display list building.
window.requestAnimationFrame(() => { setTimeout(next, 0); });
}
function next() {
var utils = window.opener.SpecialPowers.getDOMWindowUtils(window);
var elem = document.documentElement;
utils.checkAndClearDisplayListState(elem);
window.addEventListener("scroll", function () {
window.requestAnimationFrame(() => {
setTimeout(function() {
is(utils.checkAndClearDisplayListState(elem), false, "Document element didn't get display list");
setTimeout(subtestDone,0);
},0);
});
}, {once: true});
}
waitUntilApzStable().then(startTest);
</script>
</head>
<body style="height: 5000px">
<div style="height: 50px">spacer</div>
<button id="b" style="width: 10px; height: 10px"></button>
</body>
</html>

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

@ -42,6 +42,8 @@
skip-if = (verify && debug && (os == 'win'))
[test_group_touchevents-4.html]
skip-if = (verify && debug && (os == 'win'))
[test_group_touchevents-5.html]
skip-if = (verify && debug && (os == 'win'))
[test_group_wheelevents.html]
skip-if = (toolkit == 'android') # wheel events not supported on mobile
[test_group_zoom.html]

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

@ -23,10 +23,15 @@ var subtests = [
{"file": "helper_bug1638458_contextmenu.html", "prefs": [["apz.allow_zooming", true]]},
{"file": "helper_bug1638441_fixed_pos_hit_test.html", "prefs": [["apz.allow_zooming", true]]},
{"file": "helper_bug1637135_narrow_viewport.html", "prefs": [["apz.allow_zooming", true],
["dom.meta-viewport.enabled", true]]}
["dom.meta-viewport.enabled", true]]},
// Add new subtests here. If this starts timing out because it's taking too
// long, create a test_group_touchevents-5.html file. Refer to 1423011#c57
// for more details.
// test_group_touchevents-5.html already exists because a new test would
// timeout (without making any process) with fission x-origin tests if added
// here. So you can add tests here or in test_group_touchevents-5.html until
// they start timing out.
];
if (isApzEnabled()) {

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

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Various touch tests that spawn in new windows (5)</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
var subtests = [
// tests that scrolling doesn't cause extra SchedulePaint calls
{"file": "helper_bug1669625.html", "dp_suppression": false},
// Add new subtests here. If this starts timing out because it's taking too
// long, create a test_group_touchevents-6.html file. Refer to 1423011#c57
// for more details.
// You can still add tests to test_group_touchevents-4.html, it hasn't gotten
// too long yet, but this file was created because adding a specific test to
// test_group_touchevents-5.html would timeout (without making any progress)
// with fission x-origin tests. So you can add tests here or in
// test_group_touchevents-4.html until they start timing out.
];
if (isApzEnabled()) {
ok(window.TouchEvent, "Check if TouchEvent is supported (it should be, the test harness forces it on everywhere)");
if (getPlatform() == "android") {
// This has a lot of subtests, and Android emulators are slow.
SimpleTest.requestLongerTimeout(2);
}
SimpleTest.waitForExplicitFinish();
window.onload = function() {
runSubtestsSeriallyInFreshWindows(subtests)
.then(SimpleTest.finish, SimpleTest.finish);
};
}
</script>
</head>
<body>
</body>
</html>