Skip to content
Permalink
Browse files
keyboard scrolling spring damping animation doesn't finish and leads …
…to endless flickering scrolling

https://bugs.webkit.org/show_bug.cgi?id=229697

Reviewed by Tim Horton.

The damped oscillation animation of the smooth keyboard scrolling
went into divergent vibration if the frameDuration isn't short
enough. It happened with debug builds with enabling debug
loggings.

Stop the spring if it reaches the ideal position.

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

Canonical link: https://commits.webkit.org/255306@main
  • Loading branch information
fujii committed Oct 8, 2022
1 parent f8b4d27 commit 367b4c1a2c7fdc28e51ca7460ea40e5cb15b8f34
Showing 1 changed file with 7 additions and 0 deletions.
@@ -218,6 +218,13 @@ void KeyboardScrollingAnimator::updateKeyboardScrollPosition(MonotonicTime curre

m_scrollAnimator.scrollToPositionWithoutAnimation(newPosition);

// Stop the spring if it reaches the ideal position.
FloatSize newDisplacement = newPosition - idealPosition;
if (axesToApplySpring.width() && displacement.width() * newDisplacement.width() < 0)
m_velocity.setWidth(0);
if (axesToApplySpring.height() && displacement.height() * newDisplacement.height() < 0)
m_velocity.setHeight(0);

if (!m_scrollTriggeringKeyIsPressed && m_velocity.diagonalLengthSquared() < 1) {
m_scrollController.didStopKeyboardScrolling();
m_velocity = { };

0 comments on commit 367b4c1

Please sign in to comment.