[webkit-changes] [WebKit/WebKit] cb875e: Refactor TextExtraction support in WKWebView to us...
Wenson Hsieh
noreply at github.com
Sat Feb 24 14:17:59 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cb875ef24116b4a39bab32f2aec4bdb16ebdf16f
https://github.com/WebKit/WebKit/commit/cb875ef24116b4a39bab32f2aec4bdb16ebdf16f
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-02-24 (Sat, 24 Feb 2024)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
M Source/WebKit/UIProcess/Cocoa/WKTextExtractionItem.h
M Source/WebKit/WebKitSwift/TextExtraction/WKTextExtractionItem.swift
Log Message:
-----------
Refactor TextExtraction support in WKWebView to use a promise instead of a Swift block
https://bugs.webkit.org/show_bug.cgi?id=270031
rdar://123542653
Reviewed by Richard Robinson and Abrar Rahman Protyasha.
Refactor this code to use a dedicated object (`WKTextExtractionRequest`) used to represent an
asynchronously-fulfilled promise, rather than taking a completion handler directly. As it turns out,
completion handler blocks in Swift-only API end up getting passed as `nil` into Objective-C methods
expecting blocks, when using `perform(with:…:)` to invoke ObjC-exposed selectors.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTextExtractionForSwift:]):
Wrap the existing call to request text extraction.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/Cocoa/WKTextExtractionItem.h:
* Source/WebKit/WebKitSwift/TextExtraction/WKTextExtractionItem.swift:
(WKTextExtractionRequest.completionHandler):
(WKTextExtractionRequest.fulfill(_:)):
Canonical link: https://commits.webkit.org/275286@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