[webkit-changes] [WebKit/WebKit] 5e563a: Keyboard smooth scrolling with spacebar doesn't ru...

Richard Robinson noreply at github.com
Wed Nov 30 22:14:29 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5e563a763a1e67bb52d100790d874b2b9c74469e
      https://github.com/WebKit/WebKit/commit/5e563a763a1e67bb52d100790d874b2b9c74469e
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2022-11-30 (Wed, 30 Nov 2022)

  Changed paths:
    M LayoutTests/fast/scrolling/mac/smooth-scroll-recursive-overflow-to-frame.html
    M LayoutTests/fast/scrolling/mac/smooth-scroll-recursive-overflow-to-overflow.html
    M Source/WebCore/platform/KeyboardScrollingAnimator.cpp
    M Source/WebCore/platform/KeyboardScrollingAnimator.h
    M Source/WebCore/platform/ScrollAnimationKeyboard.cpp
    M Source/WebCore/platform/ScrollAnimationKeyboard.h
    M Source/WebCore/platform/ScrollTypes.h

  Log Message:
  -----------
  Keyboard smooth scrolling with spacebar doesn't rubber band at edges like iPad
https://bugs.webkit.org/show_bug.cgi?id=247915
rdar://102012167

Reviewed by Simon Fraser.

Currently, there are two issues which was preventing keyboard smooth scrolling
on macOS from having rubber-banding behavior.

The first issue was that `ScrollAnimation::clamping` was not being overriden
in `ScrollAnimationKeyboard`, and so the clamping behavior was trivially
`Clamped` instead of `Unclamped`, which was preventing the scrolling from
going past the start / end of the page.

With the scroll animation now being `Unclamped`, keyboard scrolling now has
rubber-banding behavior, however continously holding down the arrow key or
space bar caused the page to get stuck in the overflow scroll state. This
was because with every relevant key, `KeyboardScrollingAnimator::beginKeyboardScrollGesture`
is called, and when the offset is overflowing, then
`!scrollableDirections.at(boxSideForDirection(direction))` is `true`, which
caused `KeyboardScrollingAnimator::stopScrollingImmediately` to be called,
which then prevented the scroll from properly rubber-banding back to the start
or end of the page as it should.

This PR fixes these issues by setting the clamping behavior to `Unclamped`,
and by removing the call to `stopScrollingImmediately`, as it was never
actually necessary.

Also refactors some common functions to remove code duplication.

* Source/WebCore/platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
(WebCore::KeyboardScrollingAnimator::scrollableDirectionsFromPosition const): Deleted.
(WebCore::boxSideForDirection): Deleted.
* Source/WebCore/platform/KeyboardScrollingAnimator.h:
* Source/WebCore/platform/ScrollAnimationKeyboard.cpp:
(WebCore::ScrollAnimationKeyboard::animateScroll):
(WebCore::boxSideForDirection): Deleted.
(WebCore::ScrollAnimationKeyboard::scrollableDirectionsFromPosition): Deleted.
* Source/WebCore/platform/ScrollAnimationKeyboard.h:
* Source/WebCore/platform/ScrollTypes.h:
(WebCore::setValueForAxis):
(WebCore::scrollableDirectionsFromPosition):
(WebCore::boxSideForDirection):
* Source/WebCore/platform/ScrollableArea.cpp:
* Source/WebCore/platform/ScrollingEffectsController.cpp:

Canonical link: https://commits.webkit.org/257220@main




More information about the webkit-changes mailing list