Skip to content

Page Up/Down scrolling feels too slow#8318

Merged
webkit-early-warning-system merged 1 commit intoWebKit:mainfrom
rr-codes:eng/101651891-2
Jan 7, 2023
Merged

Page Up/Down scrolling feels too slow#8318
webkit-early-warning-system merged 1 commit intoWebKit:mainfrom
rr-codes:eng/101651891-2

Conversation

@rr-codes
Copy link
Contributor

@rr-codes rr-codes commented Jan 6, 2023

@rr-codes rr-codes self-assigned this Jan 6, 2023
@rr-codes rr-codes added the Scrolling Bugs related to main thread and off-main thread scrolling label Jan 6, 2023
@rr-codes rr-codes requested review from hortont424 and smfr January 6, 2023 21:01
Copy link
Contributor

@hortont424 hortont424 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this changing the constants for iOS too? Are you sure we want to do that?

@rr-codes rr-codes requested a review from cdumez as a code owner January 6, 2023 22:13
@rr-codes rr-codes requested a review from hortont424 January 6, 2023 22:14
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 6, 2023
@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Jan 6, 2023
@rr-codes rr-codes added the merge-queue Applied to send a pull request to merge-queue label Jan 7, 2023
https://bugs.webkit.org/show_bug.cgi?id=250224
rdar://101651891

Reviewed by Tim Horton.

Adjusts the keyboard scrolling parameters so that it feels faster.

* Source/WebCore/platform/KeyboardScroll.h:

Canonical link: https://commits.webkit.org/258598@main
@webkit-commit-queue
Copy link
Collaborator

Committed 258598@main (f7ad74a): https://commits.webkit.org/258598@main

Reviewed commits have been landed. Closing PR #8318 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit f7ad74a into WebKit:main Jan 7, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jan 7, 2023
webkit-early-warning-system pushed a commit to rr-codes/WebKit that referenced this pull request Jan 20, 2023
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 WebKit#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
alancoon pushed a commit that referenced this pull request Jan 23, 2023
    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 #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

Canonical link: https://commits.webkit.org/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scrolling Bugs related to main thread and off-main thread scrolling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants