Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8bc5e1f0082a8335d68cfb2dd0913255e7cab7cd
      
https://github.com/WebKit/WebKit/commit/8bc5e1f0082a8335d68cfb2dd0913255e7cab7cd
  Author: Richard Robinson <[email protected]>
  Date:   2025-02-17 (Mon, 17 Feb 2025)

  Changed paths:
    M LayoutTests/resources/ui-helper.js
    A 
LayoutTests/scrollingcoordinator/mac/rubberbanding-always-bounce-short-content-expected.txt
    A 
LayoutTests/scrollingcoordinator/mac/rubberbanding-always-bounce-short-content.html
    A 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-short-content-expected.txt
    A 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-short-content.html
    A 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-tall-content-expected.txt
    A 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-tall-content.html
    M Source/WebCore/page/scrolling/ScrollingTree.cpp
    M Source/WebCore/page/scrolling/ScrollingTree.h
    M Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
    M Source/WebCore/platform/ScrollTypes.cpp
    M Source/WebCore/platform/ScrollTypes.h
    M Source/WebCore/platform/ScrollTypes.serialization.in
    M Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
    M 
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxyInternals.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp
    M Source/WebKit/WebProcess/WebPage/EventDispatcher.h
    M Source/WebKit/WebProcess/WebPage/EventDispatcher.messages.in
    M Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp
    M Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h
    M Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
    M Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
    M Tools/WebKitTestRunner/mac/UIScriptControllerMac.h
    M Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm

  Log Message:
  -----------
  [SwiftUI] (macOS) Add support for disabling rubber-banding if the content 
size is less than that of the scroll view size
https://bugs.webkit.org/show_bug.cgi?id=287763
rdar://144929647

Reviewed by Simon Fraser.

On iOS, clients may use the `alwaysBounceVertical` and `alwaysBounceHorizontal` 
properties on `WKWebView.scrollView`
to customize if rubber-banding/bouncing should be enabled if the content size 
is less than the scroll view size. The
default value of these properties in WebKit is `true`.

This PR brings support for this functionality to macOS by adding likewise, 
internal methods to WKWebView on macOS.

To facilitate this, the concept of "rubber-bandable edges" is slightly changed; 
instead of a particular edge being
either rubber-bandable or not, an edge now has three possible states: never 
rubber-bandable, always rubber-bandable,
and rubber-bandable only if the content size is greater than that of the scroll 
view size.

* LayoutTests/resources/ui-helper.js:
(window.UIHelper.async setAlwaysBounceVertical):
(window.UIHelper.async setAlwaysBounceHorizontal):
* Tools/DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::setScrollBounceBehavior):
* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::setScrollBounceBehavior):
(WTR::UIScriptController::setAlwaysBounceVertical):
(WTR::UIScriptController::setAlwaysBounceHorizontal):
* Tools/WebKitTestRunner/mac/UIScriptControllerMac.h:
* Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptControllerMac::setAlwaysBounceVertical):
(WTR::UIScriptControllerMac::setAlwaysBounceHorizontal):

Test infrastructure.

* 
LayoutTests/scrollingcoordinator/mac/rubberbanding-always-bounce-short-content-expected.txt:
 Added.
* 
LayoutTests/scrollingcoordinator/mac/rubberbanding-always-bounce-short-content.html:
 Added.
* 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-short-content-expected.txt:
 Added.
* 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-short-content.html:
 Added.
* 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-tall-content-expected.txt:
 Added.
* 
LayoutTests/scrollingcoordinator/mac/rubberbanding-bounce-based-on-size-tall-content.html:
 Added.

Several new layout tests are added.

* Source/WebCore/page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::setClientAllowedMainFrameRubberBandableEdges):
(WebCore::ScrollingTree::clientAllowsMainFrameRubberBandingOnSide):
(WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
* Source/WebCore/page/scrolling/ScrollingTree.h:

Change the relevant boolean values to the new multiple-state enum value.

* Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::shouldRubberBandOnSide const):

This contains the actual logic that resolves the three possible states into a 
binary decision of if
an edge should rubber-band while consulting if the content is scrollable.

* Source/WebCore/platform/ScrollTypes.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/ScrollTypes.h:
* Source/WebCore/platform/ScrollTypes.serialization.in:
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

Add a new enum type to represent the new multiple states.

* Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp:

Unified sources fix.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _alwaysBounceVertical]):
(-[WKWebView _setAlwaysBounceVertical:]):
(-[WKWebView _alwaysBounceHorizontal]):
(-[WKWebView _setAlwaysBounceHorizontal:]):

Exposes the new functionality in the internal WKWebView header interface.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp:
(WebKit::RemoteLayerTreeEventDispatcher::handleWheelEvent):
(WebKit::RemoteLayerTreeEventDispatcher::scrollingThreadHandleWheelEvent):
(WebKit::RemoteLayerTreeEventDispatcher::determineWheelEventProcessing):
(WebKit::RemoteLayerTreeEventDispatcher::handleSyntheticWheelEvent):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm:
(WebKit::RemoteScrollingCoordinatorProxyMac::handleWheelEvent):

Change the relevant boolean values to the new multiple-state enum value.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::resolvedScrollBounceBehaviorEdges):
(WebKit::WebPageProxy::handleWheelEvent):
(WebKit::WebPageProxy::continueWheelEventHandling):
(WebKit::WebPageProxy::sendWheelEvent):
(WebKit::WebPageProxy::alwaysBounceVertical const):
(WebKit::WebPageProxy::setAlwaysBounceVertical):
(WebKit::WebPageProxy::alwaysBounceHorizontal const):
(WebKit::WebPageProxy::setAlwaysBounceHorizontal):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::colorSpace):
(WebKit::WebViewImpl::alwaysBounceVertical):
(WebKit::WebViewImpl::setAlwaysBounceVertical):
(WebKit::WebViewImpl::alwaysBounceHorizontal):
(WebKit::WebViewImpl::setAlwaysBounceHorizontal):
* Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::internalWheelEvent):
(WebKit::EventDispatcher::wheelEvent):
(WebKit::EventDispatcher::handleSyntheticWheelEvent):
* Source/WebKit/WebProcess/WebPage/EventDispatcher.h:
* Source/WebKit/WebProcess/WebPage/EventDispatcher.messages.in:
* Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp:
(WebKit::MomentumEventDispatcher::handleWheelEvent):
* Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h:

Change the relevant boolean values to the new multiple-state enum value, and 
propogate the values from the UI process to the web process.

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



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

Reply via email to