Bug 1692708 - Add scrollTo and scrollTop test cases in helper_relative_scroll_smoothness.html. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D129595
This commit is contained in:
Hiroyuki Ikezoe 2021-11-12 07:54:18 +00:00
parent b11e8dcd33
commit 7243be3f7a
3 changed files with 25 additions and 4 deletions

View File

@ -45,7 +45,20 @@ window.addEventListener("scroll", () => {
document.documentElement.style.backgroundPosition = `0px ${offset}px`;
document.body.style.height = `${initialBodyHeight + offset}px`;
window.scrollBy(0, 10);
switch (searchParams.get("scroll-method")) {
case "scrollBy":
window.scrollBy(0, 10);
break;
case "scrollTop":
document.scrollingElement.scrollTop += 10;
break;
case "scrollTo":
window.scrollTo(0, window.scrollY + 10);
break;
default:
ok(false, "Unsupported scroll method: " + searchParams.get("scroll-method"));
break;
}
// Simulate some jank.
var freezeDurationInMilliseconds = 100;

View File

@ -26,8 +26,14 @@ var subtests = [
{"file": "helper_key_scroll.html", prefs: [["apz.test.logging_enabled", true],
["test.events.async.enabled", true]]},
{"file": "helper_bug1674935.html", prefs: []},
{"file": "helper_relative_scroll_smoothness.html?input-type=key", prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=native-key", prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=key&scroll-method=scrollBy",
prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=native-key&scroll-method=scrollBy",
prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=native-key&scroll-method=scrollTo",
prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=native-key&scroll-method=scrollTop",
prefs: smoothness_prefs }
];
if (isKeyApzEnabled()) {

View File

@ -55,7 +55,9 @@ var subtests = [
{"file": "helper_scroll_tables_perspective.html", "prefs": prefs},
{"file": "helper_wheelevents_handoff_on_iframe.html", "prefs": prefs},
{"file": "helper_wheelevents_handoff_on_non_scrollable_iframe.html", "prefs": prefs},
{"file": "helper_relative_scroll_smoothness.html?input-type=wheel", prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=wheel&scroll-method=scrollBy", prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=wheel&scroll-method=scrollTo", prefs: smoothness_prefs },
{"file": "helper_relative_scroll_smoothness.html?input-type=wheel&scroll-method=scrollTop", prefs: smoothness_prefs },
];
// Only Windows has the test api implemented for this test.