Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8984da7400104156ff59e1b95adee4349f22a451
      
https://github.com/WebKit/WebKit/commit/8984da7400104156ff59e1b95adee4349f22a451
  Author: Richard Robinson <richard_robins...@apple.com>
  Date:   2023-01-20 (Fri, 20 Jan 2023)

  Changed paths:
    M Source/WebCore/editing/EditorCommand.cpp
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h
    M Source/WebCore/platform/KeyboardScrollingAnimator.cpp
    M Source/WebCore/platform/KeyboardScrollingAnimator.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm

  Log Message:
  -----------
  Page scrolls more than one screenful when pressing Space or Fn+Down
https://bugs.webkit.org/show_bug.cgi?id=250598
rdar://104152802

Reviewed by Simon Fraser.

Before event handler driven smooth keyboard scrolling, pressing and holding the
spacebar or page up/down keys would do the following sequence of actions:

1. Scroll down the page by a "screenful".
2. On Cocoa platforms, the scrolling mechanism would wait until the 
`keyRepeatInterval`
has passed.
3. After the interval has passed, it would continue consistently page scrolling 
until
the key is released.

With the introduction of event handler driven smooth keyboard scrolling, step 
two
was omitted. However, because smooth scrolling was slower than previously, the 
behavior
was effectively unchanged, as the slowness of the scrolling compensated for 
what would
have been the key repeat interval.

After https://github.com/WebKit/WebKit/pull/8318, smooth scrolling was adjusted 
which
caused its velocity to increase. As a result, the lack of a delay was now 
noticable,
and page scrolling would scroll more than a "screenful" unless preisely one key 
event was sent.

This PR adjusts smooth scrolling such that the smooth keyboard scroll animation 
only
starts after the `keyRepeatInterval`, with the first part of the entire scroll 
behaving the
same as it did prior to smooth keyboard scrolling.

Note that this will apply to only spacebar and page up / down scrolling, and 
not arrow key
scrolling.

* Source/WebCore/editing/EditorCommand.cpp:
(WebCore::executeScrollPageBackward):
(WebCore::executeScrollPageForward):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::defaultKeyboardEventHandler):
(WebCore::EventHandler::defaultKeyboardScrollEventHandler):
(WebCore::EventHandler::defaultPageUpDownEventHandler):
(WebCore::EventHandler::defaultSpaceEventHandler):
(WebCore::EventHandler::beginKeyboardScrollGesture):
(WebCore::EventHandler::startKeyboardScrollAnimationOnDocument):
(WebCore::EventHandler::startKeyboardScrollAnimationOnRenderBoxLayer):
(WebCore::EventHandler::startKeyboardScrollAnimationOnRenderBoxAndItsAncestors):
(WebCore::EventHandler::startKeyboardScrollAnimationOnEnclosingScrollableContainer):
(WebCore::EventHandler::keyboardScrollRecursively):
(WebCore::EventHandler::keyboardScroll):
* Source/WebCore/page/EventHandler.h:
* Source/WebCore/platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
* Source/WebCore/platform/KeyboardScrollingAnimator.h:

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to