haikuwebkit/LayoutTests/fast/scrolling/keyboard-scrolling-distance...

63 lines
1.7 KiB
HTML
Raw Permalink Normal View History

Start smooth keyboard scrolling animation when pageUp or pageDown key is pressed. https://bugs.webkit.org/show_bug.cgi?id=228156 Patch by Dana Estra <destra@apple.com> on 2021-08-11 Reviewed by Tim Horton. Source/WebCore: UIProcess now no longer handles scrollPageUp and scrollPageDown events. They return to eventHandler as unhandled and the keyboard scroll animation is started. Tests: fast/scrolling/keyboard-scrolling-distance-downArrow.html fast/scrolling/keyboard-scrolling-distance-pageDown.html * page/EventHandler.cpp: (WebCore::EventHandler::defaultKeyboardEventHandler): * platform/KeyboardScrollingAnimator.cpp: (WebCore::KeyboardScrollingAnimator::keyboardScrollForKeyboardEvent const): Source/WebKit: UIProcess now no longer handles scrollPageUp and scrollPageDown events. They return to eventHandler as unhandled and the keyboard scroll animation is started. * UIProcess/API/mac/WKWebViewMac.mm: (-[WKWebView scrollPageDown:]): (-[WKWebView scrollPageUp:]): LayoutTests: Tests check that at least 2 scroll events occur when the downArrow key or pageDown key is pressed, and that with each event, the page's offset from its original position increases. * fast/scrolling/keyboard-scrolling-distance-downArrow-expected.txt: Added. * fast/scrolling/keyboard-scrolling-distance-downArrow.html: Added. * fast/scrolling/keyboard-scrolling-distance-pageDown-expected.txt: Added. * fast/scrolling/keyboard-scrolling-distance-pageDown.html: Added. Canonical link: https://commits.webkit.org/240446@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-11 20:32:32 +00:00
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true EventHandlerDrivenSmoothKeyboardScrollingEnabled=true ] -->
<html>
<head>
<script src="../../resources/ui-helper.js"></script>
<script src="../../resources/js-test-pre.js"></script>
<meta name="viewport" content="initial-scale=1.5, user-scalable=no">
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function checkSuccessfulScroll(scrollObj)
{
if (window.scrollY <= scrollObj.offset) {
debug("Unsuccessful Scroll - offset does not increase with each scroll event.");
testRunner.notifyDone();
}
scrollObj.offset = window.scrollY;
scrollObj.count++;
if (scrollObj.count == 2) {
debug("Successful Scroll");
testRunner.notifyDone();
}
}
async function runTest()
{
if (!window.testRunner || !testRunner.runUIScript)
return;
let scrollObj = {
count: 0,
offset: 0
}
document.addEventListener("scroll", function () {
checkSuccessfulScroll(scrollObj);
});
await UIHelper.keyDown("downArrow");
}
</script>
<style>
#placeholder {
width: 100px;
height: 5000px;
}
</style>
</head>
<body style="margin: 0;" onload="runTest()">
<div id="placeholder">
<div id="console"></div>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>