Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3b564766bf831003582c5bc07c0975854a5478e8
      
https://github.com/WebKit/WebKit/commit/3b564766bf831003582c5bc07c0975854a5478e8
  Author: Richard Robinson <richard_robins...@apple.com>
  Date:   2025-03-18 (Tue, 18 Mar 2025)

  Changed paths:
    A 
LayoutTests/fast/scrolling/ios/keyboard-scrolling-subscrollable-expected.txt
    A LayoutTests/fast/scrolling/ios/keyboard-scrolling-subscrollable.html
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm
    M Source/WebKit/UIProcess/ios/WKBaseScrollView.h
    M Source/WebKit/UIProcess/ios/WKBaseScrollView.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h
    M Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm
    M Source/WebKit/UIProcess/ios/WKPDFView.mm
    M Source/WebKit/UIProcess/ios/WKScrollView.h
    R Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.h
    R Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [iOS] Keyboard scrolling does not work in sub-scrollable regions
https://bugs.webkit.org/show_bug.cgi?id=287721
rdar://131354460

Reviewed by Tim Horton.

Add functionality to allow scrolling in sub-scrollable regions on iOS like 
macOS.

* LayoutTests/fast/scrolling/ios/keyboard-scrolling-subscrollable-expected.txt: 
Added.
* LayoutTests/fast/scrolling/ios/keyboard-scrolling-subscrollable.html: Added.

Layout tests.

* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::focusedScrollableArea const):

Fallback to the last touched node if there is no mouse press node or focused 
node.

* Source/WebCore/page/Page.h:
(WebCore::Page::setLastTouchedNode):
(WebCore::Page::lastTouchedNode const):

Store the last touched node so that EventHandler can later use it.

* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _scrollViewInternal]):
* Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.h: Removed.
* Source/WebKit/UIProcess/ios/WKVelocityTrackingScrollView.mm: Removed.

Remove WKVelocityTrackingScrollView in favor of using WKBaseScrollView directly 
so that all scroll views can track velocities.

* Source/WebKit/UIProcess/ios/WKBaseScrollView.h:
* Source/WebKit/UIProcess/ios/WKBaseScrollView.mm:
(ScrollingDeltaWindow::update):
(ScrollingDeltaWindow::reset):
(ScrollingDeltaWindow::averageVelocity const):
(-[WKBaseScrollView updateInteractiveScrollVelocity]):
(-[WKBaseScrollView interactiveScrollVelocityInPointsPerSecond]):

Give WKBaseScrollView the functionality that WKVelocityTrackingScrollView had.

* 
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate scrollViewDidScroll:]):

For sub-scrollable regions, call `updateInteractiveScrollVelocity` just like 
the main scroll view.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpInteraction]):

Since the scroll view that the scrolling animator uses is now dynamic, don't 
provide a scroll view when creating the animator;
instead, provide it on-demand.

(-[WKContentView _interpretKeyEvent:withContext:]):

Compute the scroll view that should be used for the keyboard scrolling 
animator, based on whichever view was focused/clicked/touched last.
Fallback to the main scroll view if no others are found.

(-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]):

Use the correct scroll view when passing it to `_didFinishScrolling`.

* Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.h:
* Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(-[WKKeyboardScrollViewAnimator init]):
(-[WKKeyboardScrollViewAnimator initWithScrollView:]): Deleted.

Instead of providing a scroll view at the beginning, it is provided on-demand.

(-[WKKeyboardScrollViewAnimator beginWithEvent:scrollView:]):
(-[WKKeyboardScrollViewAnimator beginWithEvent:]): Deleted.

Amend this function to allow specifying the current scroll view that should be 
targeted.
If there is no ongoing scroll, set the ivar _scrollView to the parameter's 
value.
If there is an ongoing scroll on a different scroll view, ignore the request on 
the new scroll view.

(-[WKKeyboardScrollViewAnimator scrollView]):

Allow querying for the current scroll view that the animator is using.

(-[WKKeyboardScrollViewAnimator didFinishScrolling]):

Set _scrollView to nil to indicate that there is now no scroll view that is 
currently keyboard scrolling.

* Source/WebKit/UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_handleKeyEvent:]):
(-[WKPDFView web_initWithFrame:webView:mimeType:]):

Update callsites to use the new functions.

* Source/WebKit/UIProcess/ios/WKScrollView.h:

Change the base class.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/WebPage.h:

Add a new member variable to keep track of the most recently tapped node.

* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleEditingKeyboardEvent):
(WebKit::WebPage::commitPotentialTap):

If there is no click node, then instead do a hit-test to find the relevant node 
that can be tapped, and update the last touched node.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to