Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 31f53890413ab604b438db03c40f219b25f3ced1
      
https://github.com/WebKit/WebKit/commit/31f53890413ab604b438db03c40f219b25f3ced1
  Author: Richard Robinson <[email protected]>
  Date:   2024-12-22 (Sun, 22 Dec 2024)

  Changed paths:
    M Source/WebKit/UIProcess/API/Swift/View+WebViewModifiers.swift
    M Source/WebKit/UIProcess/API/Swift/WebPage.swift
    M Source/WebKit/UIProcess/API/Swift/WebView.swift
    A Source/WebKit/UIProcess/Cocoa/Foundation+Extras.swift
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/SwiftBrowser/Source/ContentView.swift

  Log Message:
  -----------
  [SwiftUI] Find-in-Page integration (iOS)
https://bugs.webkit.org/show_bug.cgi?id=284715
rdar://141503364

Reviewed by Wenson Hsieh.

Add support to enable "Find in Page" integration, on iOS only for now due to 
the many platform differences
between UIKit and AppKit.

* Source/WebKit/UIProcess/API/Swift/View+WebViewModifiers.swift:
(EnvironmentValues.webViewFindContext):
(View.webViewFindNavigator(_:)):
(View.webViewFindDisabled(_:)):
(View.webViewReplaceDisabled(_:)):
(FindContext.isPresented):

Add several view modifiers which correspond to their native SwiftUI 
counterparts. The main modifier is
`webViewFindNavigator` which actually presents the find navigator when the 
binding value is true. The
`webViewFindDisabled` and `webViewReplaceDisabled` modifiers are used to 
control specific functionality
of the find navigator.

* Source/WebKit/UIProcess/API/Swift/WebPage.swift:
(WebPageWebView.delegate):
(WebPageWebView.findInteraction(_:didBegin:)):
(WebPageWebView.findInteraction(_:didEnd:)):
(WebPageWebView.supportsTextReplacement):
(Delegate.findInteraction(_:didBegin:)):
(Delegate.findInteraction(_:didEnd:)):
(Delegate.supportsTextReplacement):

Add a delegate protocol to override and propogate some find interaction methods 
from WKWebView to WebView.

* Source/WebKit/UIProcess/API/Swift/WebView.swift:
(WebViewWrapper.findContext):
(WebViewWrapper.webView):
(WebViewWrapper.findInteraction(_:didBegin:)):
(WebViewWrapper.findInteraction(_:didEnd:)):
(WebViewWrapper.supportsTextReplacement):

Update the environment state's find context when the delegate methods are 
called.

(WebViewRepresentable.updatePlatformView(_:context:)):
(WebViewRepresentable.makeCoordinator):
(WebViewCoordinator.configuration):
(WebViewCoordinator.update(_:configuration:environment:)):
(WebViewCoordinator.updateFindInteraction(_:environment:)):

Present or dismiss the find navigator according to the find context state.

* Source/WebKit/UIProcess/Cocoa/Foundation+Extras.swift: Copied from 
Source/WebKit/UIProcess/API/Swift/View+WebViewModifiers.swift.
(onNextMainRunLoop(do:)):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

* Tools/SwiftBrowser/Source/ContentView.swift:
(ContentView.body):

Update SwiftBrowser to use this new functionality.

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