Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a6f68ea69e73ae1619a17c2a6f4abc4eb8de8105
      
https://github.com/WebKit/WebKit/commit/a6f68ea69e73ae1619a17c2a6f4abc4eb8de8105
  Author: Richard Robinson <[email protected]>
  Date:   2025-04-06 (Sun, 06 Apr 2025)

  Changed paths:
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
    M Source/WebKit/UIProcess/Cocoa/WebPageWebView.swift
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/_WebKit_SwiftUI/Implementation/WebViewRepresentable.swift
    M Tools/TestWebKitAPI/Tests/mac/ScrollingCoordinatorTests.mm

  Log Message:
  -----------
  [SwiftUI] Scrolling to a particular scroll position does not work when 
specifying a single axis value
https://bugs.webkit.org/show_bug.cgi?id=291161
rdar://148700838

Reviewed by Abrar Rahman Protyasha.

Currently, when using the `.webViewScrollPosition` view modifier on WebView, 
the following functions
on `ScrollPosition` work properly:

* `.scrollTo(x:y:)`
* `.scrollTo(point:)`
* `.scrollTo(edge:)`

This implements support for the functions that only affect a specific axis:

* `.scrollTo(x:)`
* `.scrollTo(y:)`

so that clients can scroll to a particualr point on one axis and have the other 
axis unaffected.

* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::setScrollOffsetWithOptions):
* Source/WebCore/page/LocalFrameView.h:

Implement the main logic to handle reconciling the resolved scroll offset using 
the specified values,
falling back to the current scroll offset for any axis value that is not 
specified.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _setContentOffsetX:y:animated:]):
(-[WKWebView _setContentOffset:animated:]): Deleted.

Adjust this function to take seperate optional x and y values in the form of 
nullable NSNumbers with double
values, which are then converted to `std::optional<int>`s.

* Source/WebKit/UIProcess/Cocoa/WebPageWebView.swift:
(WebPageWebView.setContentOffset(_:y:animated:)):
(WebPageWebView.setContentOffset(_:animated:)): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setContentOffset):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setContentOffset):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/_WebKit_SwiftUI/Implementation/WebViewRepresentable.swift:
(WebViewCoordinator.updateScrollPosition(_:context:)):

Propogate the values from the API to the web process.

Canonical link: https://commits.webkit.org/293345@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