[webkit-changes] [WebKit/WebKit] c3e1a1: [SwiftUI] Support the `.scrollBounceBehavior` view...
Richard Robinson
noreply at github.com
Mon Feb 17 21:51:09 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c3e1a196e805cbc5014c5545930665766600ef0d
https://github.com/WebKit/WebKit/commit/c3e1a196e805cbc5014c5545930665766600ef0d
Author: Richard Robinson <richard_robinson2 at apple.com>
Date: 2025-02-17 (Mon, 17 Feb 2025)
Changed paths:
M Source/WebKit/UIProcess/API/Swift/WebPage.swift
M Source/WebKit/_WebKit_SwiftUI/WebViewRepresentable.swift
M Tools/SwiftBrowser/Source/ViewModel/AppStorageKeys.swift
M Tools/SwiftBrowser/Source/Views/ContentView.swift
M Tools/SwiftBrowser/Source/Views/SettingsView.swift
Log Message:
-----------
[SwiftUI] Support the `.scrollBounceBehavior` view modifier on WebView
https://bugs.webkit.org/show_bug.cgi?id=287849
rdar://145027003
Reviewed by Aditya Keerthi.
Add support to make the `.scrollBounceBehavior` view modifier work for WebView, and use the functionality in SwiftBrowser.
For the implementation, the existing `verticalScrollBounceBehavior` and `horizontalScrollBounceBehavior` environment values
are used, both of which are `ScrollBounceBehavior` values. This type is an enum-like struct which does not conform to the
`Equatable` protocol. Consequently, a temporary workaround to test equality is used instead.
Platform-agnostic properties are added to `WebPageWebView` to propogate the values from the environment to either the UIScrollView
(iOS) or the WKWebView directly (macOS).
* Source/WebKit/UIProcess/API/Swift/WebPage.swift:
(WebPageWebView.alwaysBounceVertical):
(WebPageWebView.alwaysBounceHorizontal):
(WebPageWebView.bouncesVertically):
(WebPageWebView.bouncesHorizontally):
* Source/WebKit/_WebKit_SwiftUI/WebViewRepresentable.swift:
(WebViewRepresentable.updatePlatformView(_:context:)):
(WebViewRepresentable.sizeThatFits(_:platformView:context:)):
(WebViewRepresentable.sizeThatFits(_:uiView:context:)):
(WebViewRepresentable.sizeThatFits(_:nsView:context:)):
* Tools/SwiftBrowser/Source/ViewModel/AppStorageKeys.swift:
* Tools/SwiftBrowser/Source/Views/ContentView.swift:
(ContentView.scrollBounceBehaviorBasedOnSize):
(ContentView.body):
* Tools/SwiftBrowser/Source/Views/SettingsView.swift:
(ScrollBounceBehaviorPicker.basedOnSize):
(ScrollBounceBehaviorPicker.body):
(GeneralSettingsView.body):
Canonical link: https://commits.webkit.org/290524@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list