Move off of internal SDK, copy webkit spis from opensource

This commit is contained in:
2025-04-11 18:27:59 -07:00
parent 177db26b69
commit 2f4b3c64fe
37 changed files with 2432 additions and 32 deletions

View File

@@ -41,7 +41,7 @@ class FindOnPageViewController: UIViewController, _WKFindDelegate
findOnPageView.textField.addAction(UIAction(handler: { [unowned self] _ in
self.findString = findOnPageView.textField.text
webView?._find(self.findString, options: self.findOptions, maxCount: Int(self.maxCount))
webView?._find(self.findString, options: self.findOptions, maxCount: UInt(self.maxCount))
}), for: .editingChanged)
findOnPageView.prevResultButton.addAction(UIAction(handler: { [unowned self] _ in
@@ -82,24 +82,20 @@ class FindOnPageViewController: UIViewController, _WKFindDelegate
@objc
override func findNext(_ sender: Any?) {
webView?._find(self.findString, options: self.findOptions, maxCount: Int(self.maxCount))
webView?._find(self.findString, options: self.findOptions, maxCount: UInt(self.maxCount))
}
@objc
override func findPrevious(_ sender: Any?) {
let options: _WKFindOptions = self.findOptions.union(.backwards)
webView?._find(self.findString, options: options, maxCount: Int(self.maxCount))
webView?._find(self.findString, options: options, maxCount: UInt(self.maxCount))
}
func _webView(_ webView: WKWebView!, didFailToFind string: String!) {
// ??
}
private func _webView(_ webView: WKWebView!, didCountMatches matches: UInt, for string: String!) {
// TODO: Update a label
}
private func _webView(_ webView: WKWebView!, didFindMatches matches: UInt, for string: String!, withMatch matchIndex: Int) {
internal func _webView(_ webView: WKWebView!, didFindMatches matches: UInt, for string: String!, withMatch matchIndex: Int) {
findOnPageView.nextResultButton.isEnabled = matches > 0
findOnPageView.prevResultButton.isEnabled = matches > 0
}