Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling by pressing space bar has regressed in trunk, is choppy (not 120Hz) #5541

Merged
merged 1 commit into from Nov 3, 2022

Conversation

rr-codes
Copy link
Contributor

@rr-codes rr-codes commented Oct 19, 2022

cb5925e

Scrolling by pressing space bar has regressed in trunk, is choppy (not 120Hz)
https://bugs.webkit.org/show_bug.cgi?id=246878
rdar://101052130

Reviewed by Simon Fraser.

Moves keyboard smooth scrolling onto the scrolling thread instead of the main thread.

A new `ScrollAnimation` is created to facilitate this, `ScrollAnimationKeyboard`. Most
of the changes are to allow the state to propogate through the various classes and
the scrolling tree.

Since keyboard scrolling is now on a different thread, some tests had to be modified to
enable the `AsyncOverflowScrollingEnabled` and `AsyncFrameScrollingEnabled` settings.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::requestStartKeyboardAnimation):
(WebCore::FrameView::requestFinishKeyboardAnimation):
* Source/WebCore/page/FrameView.h:
* Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::requestStartKeyboardAnimation):
(WebCore::AsyncScrollingCoordinator::requestFinishKeyboardAnimation):
* Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h:
* Source/WebCore/page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::requestStartKeyboardAnimation):
(WebCore::ScrollingCoordinator::requestFinishKeyboardAnimation):
* Source/WebCore/page/scrolling/ScrollingStateNode.h:
* Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setKeyboardScrollData):
(WebCore::ScrollingStateScrollingNode::setKeyboardScrollEndData):
* Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::keyboardScrollData const):
(WebCore::ScrollingStateScrollingNode::keyboardScrollEndData const):
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
(WebCore::ScrollingTreeScrollingNode::handleKeyboardScrollRequest):
(WebCore::ScrollingTreeScrollingNode::handleKeyboardScrollEndRequest):
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h:
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
(WebCore::ScrollingTreeScrollingNodeDelegate::handleKeyboardScrollRequest):
(WebCore::ScrollingTreeScrollingNodeDelegate::handleKeyboardScrollEndRequest):
* Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::handleKeyboardScrollRequest):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::handleKeyboardScrollEndRequest):
* Source/WebCore/platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::KeyboardScrollingAnimator):
(WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
(WebCore::KeyboardScrollingAnimator::handleKeyUpEvent):
(WebCore::KeyboardScrollingAnimator::stopScrollingImmediately):
(WebCore::perpendicularAbsoluteUnitVector): Deleted.
(WebCore::KeyboardScrollingAnimator::updateKeyboardScrollPosition): Deleted.
(WebCore::farthestPointInDirection): Deleted.
(WebCore::KeyboardScrollingAnimator::stopKeyboardScrollAnimation): Deleted.
* Source/WebCore/platform/KeyboardScrollingAnimator.h:
* Source/WebCore/platform/ScrollAnimation.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/ScrollAnimation.h:
* Source/WebCore/platform/ScrollAnimationKeyboard.cpp: Added.
(WebCore::perpendicularAbsoluteUnitVector):
(WebCore::boxSideForDirection):
(WebCore::farthestPointInDirection):
(WebCore::ScrollAnimationKeyboard::scrollableDirectionsFromPosition):
(WebCore::ScrollAnimationKeyboard::ScrollAnimationKeyboard):
(WebCore::ScrollAnimationKeyboard::retargetActiveAnimation):
(WebCore::ScrollAnimationKeyboard::serviceAnimation):
(WebCore::ScrollAnimationKeyboard::startKeyboardScroll):
(WebCore::ScrollAnimationKeyboard::stopKeyboardScrollAnimation):
(WebCore::ScrollAnimationKeyboard::finishKeyboardScroll):
(WebCore::ScrollAnimationKeyboard::animateScroll):
(WebCore::ScrollAnimationKeyboard::debugDescription const):
* Source/WebCore/platform/ScrollAnimationKeyboard.h: Copied from Source/WebCore/platform/ScrollAnimation.cpp.
* Source/WebCore/platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator):
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::beginKeyboardScroll):
(WebCore::ScrollableArea::endKeyboardScroll):
* Source/WebCore/platform/ScrollableArea.h:
(WebCore::ScrollableArea::requestStartKeyboardAnimation):
(WebCore::ScrollableArea::requestFinishKeyboardAnimation):
* Source/WebCore/platform/ScrollingEffectsController.cpp:
(WebCore::ScrollingEffectsController::animationCallback):
(WebCore::ScrollingEffectsController::startKeyboardScroll):
(WebCore::ScrollingEffectsController::finishKeyboardScroll):
(WebCore::ScrollingEffectsController::updateKeyboardScrollingAnimatingState):
(WebCore::ScrollingEffectsController::scrollAnimationWillStart):
* Source/WebCore/platform/ScrollingEffectsController.h:
(WebCore::ScrollingEffectsControllerClient::updateKeyboardScrollPosition): Deleted.
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::requestStartKeyboardAnimation):
(WebCore::RenderLayerScrollableArea::requestFinishKeyboardAnimation):
* Source/WebCore/rendering/RenderLayerScrollableArea.h:

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

fc8ff7d

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@rr-codes rr-codes requested a review from cdumez as a code owner October 19, 2022 17:34
@rr-codes rr-codes self-assigned this Oct 19, 2022
@rr-codes rr-codes added the Scrolling Bugs related to main thread and off-main thread scrolling label Oct 19, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 19, 2022
@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Oct 19, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 20, 2022
@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Oct 20, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 20, 2022
@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Oct 21, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 21, 2022
@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Oct 21, 2022
Source/WebCore/page/FrameView.h Outdated Show resolved Hide resolved
Source/WebCore/page/FrameView.h Outdated Show resolved Hide resolved
Source/WebCore/platform/KeyboardScrollingAnimator.h Outdated Show resolved Hide resolved
m_velocity = { };
}

return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This return value is unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is because animateScroll overrides a virtual function, so it is forced to return a value, and in the case of ScrollAnimationKeyboard, the value doesn't need to be used

Source/WebCore/platform/ScrollAnimationKeyboard.h Outdated Show resolved Hide resolved
Source/WebCore/platform/ScrollAnimationKeyboard.h Outdated Show resolved Hide resolved
Source/WebCore/platform/ScrollableArea.h Outdated Show resolved Hide resolved
@rr-codes rr-codes force-pushed the eng/101052130-2 branch 3 times, most recently from e503278 to 4800b95 Compare October 25, 2022 23:25
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 26, 2022
@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Oct 26, 2022
@rr-codes rr-codes requested a review from smfr October 26, 2022 20:38
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 27, 2022
@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Nov 1, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 1, 2022
@rr-codes rr-codes requested a review from smfr November 1, 2022 16:43
@@ -199,6 +200,13 @@ void ScrollingStateScrollingNode::setSynchronousScrollingReasons(OptionSet<Synch
}
#endif


void ScrollingStateScrollingNode::setKeyboardScrollData(const RequestedKeyboardScrollData& scrollData)
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be use RequestedKeyboardScrollData&& with WTFMove at the call site and WTFMove into the member variable.

@rr-codes rr-codes removed the merging-blocked Applied to prevent a change from being merged label Nov 2, 2022
@rr-codes rr-codes added the merge-queue Applied to send a pull request to merge-queue label Nov 3, 2022
…t 120Hz)

https://bugs.webkit.org/show_bug.cgi?id=246878
rdar://101052130

Reviewed by Simon Fraser.

Moves keyboard smooth scrolling onto the scrolling thread instead of the main thread.

A new `ScrollAnimation` is created to facilitate this, `ScrollAnimationKeyboard`. Most
of the changes are to allow the state to propogate through the various classes and
the scrolling tree.

Since keyboard scrolling is now on a different thread, some tests had to be modified to
enable the `AsyncOverflowScrollingEnabled` and `AsyncFrameScrollingEnabled` settings.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::requestStartKeyboardAnimation):
(WebCore::FrameView::requestFinishKeyboardAnimation):
* Source/WebCore/page/FrameView.h:
* Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::requestStartKeyboardAnimation):
(WebCore::AsyncScrollingCoordinator::requestFinishKeyboardAnimation):
* Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h:
* Source/WebCore/page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::requestStartKeyboardAnimation):
(WebCore::ScrollingCoordinator::requestFinishKeyboardAnimation):
* Source/WebCore/page/scrolling/ScrollingStateNode.h:
* Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setKeyboardScrollData):
(WebCore::ScrollingStateScrollingNode::setKeyboardScrollEndData):
* Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::keyboardScrollData const):
(WebCore::ScrollingStateScrollingNode::keyboardScrollEndData const):
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
(WebCore::ScrollingTreeScrollingNode::handleKeyboardScrollRequest):
(WebCore::ScrollingTreeScrollingNode::handleKeyboardScrollEndRequest):
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h:
* Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
(WebCore::ScrollingTreeScrollingNodeDelegate::handleKeyboardScrollRequest):
(WebCore::ScrollingTreeScrollingNodeDelegate::handleKeyboardScrollEndRequest):
* Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::handleKeyboardScrollRequest):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::handleKeyboardScrollEndRequest):
* Source/WebCore/platform/KeyboardScrollingAnimator.cpp:
(WebCore::KeyboardScrollingAnimator::KeyboardScrollingAnimator):
(WebCore::KeyboardScrollingAnimator::beginKeyboardScrollGesture):
(WebCore::KeyboardScrollingAnimator::handleKeyUpEvent):
(WebCore::KeyboardScrollingAnimator::stopScrollingImmediately):
(WebCore::perpendicularAbsoluteUnitVector): Deleted.
(WebCore::KeyboardScrollingAnimator::updateKeyboardScrollPosition): Deleted.
(WebCore::farthestPointInDirection): Deleted.
(WebCore::KeyboardScrollingAnimator::stopKeyboardScrollAnimation): Deleted.
* Source/WebCore/platform/KeyboardScrollingAnimator.h:
* Source/WebCore/platform/ScrollAnimation.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/ScrollAnimation.h:
* Source/WebCore/platform/ScrollAnimationKeyboard.cpp: Added.
(WebCore::perpendicularAbsoluteUnitVector):
(WebCore::boxSideForDirection):
(WebCore::farthestPointInDirection):
(WebCore::ScrollAnimationKeyboard::scrollableDirectionsFromPosition):
(WebCore::ScrollAnimationKeyboard::ScrollAnimationKeyboard):
(WebCore::ScrollAnimationKeyboard::retargetActiveAnimation):
(WebCore::ScrollAnimationKeyboard::serviceAnimation):
(WebCore::ScrollAnimationKeyboard::startKeyboardScroll):
(WebCore::ScrollAnimationKeyboard::stopKeyboardScrollAnimation):
(WebCore::ScrollAnimationKeyboard::finishKeyboardScroll):
(WebCore::ScrollAnimationKeyboard::animateScroll):
(WebCore::ScrollAnimationKeyboard::debugDescription const):
* Source/WebCore/platform/ScrollAnimationKeyboard.h: Copied from Source/WebCore/platform/ScrollAnimation.cpp.
* Source/WebCore/platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator):
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::beginKeyboardScroll):
(WebCore::ScrollableArea::endKeyboardScroll):
* Source/WebCore/platform/ScrollableArea.h:
(WebCore::ScrollableArea::requestStartKeyboardAnimation):
(WebCore::ScrollableArea::requestFinishKeyboardAnimation):
* Source/WebCore/platform/ScrollingEffectsController.cpp:
(WebCore::ScrollingEffectsController::animationCallback):
(WebCore::ScrollingEffectsController::startKeyboardScroll):
(WebCore::ScrollingEffectsController::finishKeyboardScroll):
(WebCore::ScrollingEffectsController::updateKeyboardScrollingAnimatingState):
(WebCore::ScrollingEffectsController::scrollAnimationWillStart):
* Source/WebCore/platform/ScrollingEffectsController.h:
(WebCore::ScrollingEffectsControllerClient::updateKeyboardScrollPosition): Deleted.
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::requestStartKeyboardAnimation):
(WebCore::RenderLayerScrollableArea::requestFinishKeyboardAnimation):
* Source/WebCore/rendering/RenderLayerScrollableArea.h:

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

Committed 256266@main (cb5925e): https://commits.webkit.org/256266@main

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

@webkit-early-warning-system webkit-early-warning-system merged commit cb5925e into WebKit:main Nov 3, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Nov 3, 2022
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
5 participants