Bug 1794070 - Add "overscrolled" state in APZTestData.additionalData. r=botond

We'd like to use this for testing overscroll state in mochitests.

Differential Revision: https://phabricator.services.mozilla.com/D160433
This commit is contained in:
Hiroyuki Ikezoe 2022-11-21 03:10:05 +00:00
Родитель 4b63d269b4
Коммит 7ad2ff3232
3 изменённых файлов: 37 добавлений и 1 удалений

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

@ -3559,6 +3559,9 @@ bool APZCTreeManager::GetAPZTestData(LayersId aLayersId,
if (apzc->GetCheckerboardMagnitude(clippedBounds)) {
apzcState += "checkerboarding,";
}
if (apzc->IsOverscrolled()) {
apzcState += "overscrolled,";
}
aOutData->RecordAdditionalData(viewId, apzcState);
}
}

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

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0">
<title>A simple test checks "overscrolled" info in APZTestData</title>
<title>Tests scroll anchoring updates in-progress wheel scrolling __relatively__</title>
<script src="apz_test_utils.js"></script>
<script src="apz_test_native_event_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<div style="height: 300vh; background-color: blue;"></div><!-- Make the root scrollable -->
<script>
async function test() {
// Try to overscroll by using setAsyncScrollOffset to avoid race conditions
// that APZTestData haven't been arrived on the main-thread.
SpecialPowers.DOMWindowUtils.setAsyncScrollOffset(document.scrollingElement, 0, -100);
const scrollId =
SpecialPowers.DOMWindowUtils.getViewId(document.scrollingElement);
const data = SpecialPowers.DOMWindowUtils.getCompositorAPZTestData();
for (apzcData of data.additionalData) {
if (apzcData.key == scrollId) {
ok(apzcData.value.split(",").includes("overscrolled"));
}
}
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>

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

@ -15,7 +15,11 @@ var subtests = [
{"file": "helper_bug1669625.html", "dp_suppression": false},
{"file": "helper_touch_drag_root_scrollbar.html", "prefs": [["apz.allow_zooming", true]]},
{"file": "helper_touch_drag_root_scrollbar.html", "prefs": [["apz.allow_zooming", false]]},
{"file": "helper_overscroll_in_apz_test_data.html", "prefs": [
["apz.overscroll.enabled", true],
["apz.overscroll.test_async_scroll_offset.enabled", true],
["apz.test.logging_enabled", true],
]},
// 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.