Skip to content

Commit

Permalink
KeyboardScrollingAnimator::updateKeyboardScrollPosition is called i…
Browse files Browse the repository at this point in the history
…ndefinitely when using keyboard smooth scrolling

https://bugs.webkit.org/show_bug.cgi?id=245403
rdar://100146415

Reviewed by Tim Horton and Simon Fraser.

When the `EventHandler driven smooth scrolling` flag is enabled,
`KeyboardScrollingAnimator::updateKeyboardScrollPosition` is called indefinitely,
causing the scroll to never terminate.

Regression from 8c822fa
which accidentally removed the logic of settng `m_scrollTriggeringKeyIsPressed` to `false`.

* Source/WebCore/platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::handleKeyUpEvent):

Canonical link: https://commits.webkit.org/254685@main
  • Loading branch information
rr-codes authored and pxlcoder committed Sep 20, 2022
1 parent 274a272 commit 3ed0f4e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
@@ -0,0 +1,4 @@
PASS successfullyParsed is true

TEST COMPLETE

36 changes: 36 additions & 0 deletions LayoutTests/fast/scrolling/mac/keyboard-scrolling-terminates.html
@@ -0,0 +1,36 @@
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true EventHandlerDrivenSmoothKeyboardScrollingEnabled=true ] -->

<html>

<head>
<script src="../../../resources/ui-helper.js"></script>
<script src="../../../resources/js-test.js"></script>
<meta name="viewport" content="initial-scale=1.5, user-scalable=no">
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}

async function runTest()
{
if (window.eventSender) {
eventSender.monitorWheelEvents();
eventSender.keyDown("downArrow");

setTimeout(function() {
eventSender.callAfterScrollingCompletes(() => {
testRunner.notifyDone();
});
}, 0);
}
}
</script>
</head>

<body onload="runTest()">
<div style="height: 5000px;">
</div>
</body>

</html>
1 change: 1 addition & 0 deletions Source/WebCore/platform/KeyboardScrollingAnimator.cpp
Expand Up @@ -343,6 +343,7 @@ void KeyboardScrollingAnimator::handleKeyUpEvent()
return;

stopKeyboardScrollAnimation();
m_scrollTriggeringKeyIsPressed = false;
}

void KeyboardScrollingAnimator::stopScrollingImmediately()
Expand Down

0 comments on commit 3ed0f4e

Please sign in to comment.