Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: bdc11864605dde11d84cec5713e3d92b1d4763cd https://github.com/WebKit/WebKit/commit/bdc11864605dde11d84cec5713e3d92b1d4763cd Author: Wenson Hsieh <wenson_hs...@apple.com> Date: 2023-10-06 (Fri, 06 Oct 2023)
Changed paths: M Source/WebCore/WebCore.xcodeproj/project.pbxproj M Source/WebCore/platform/ios/WebEvent.mm A Source/WebCore/platform/ios/WebEventPrivate.h M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm Log Message: ----------- [iOS] Adopt UIAsyncTextInput, UIKeyEvent and related APIs https://bugs.webkit.org/show_bug.cgi?id=262017 rdar://116319413 Reviewed by Tim Horton. First pass at adopting new UIKit interfaces for dispatching key events asynchronously and deferring key events to UIKit in the case where the default action was not prevented by the page. This work aims to clean up existing architecture for propagating key events from UIKit to WebKit, which currently requires UIKit to instantiate a `WebEvent` (from the WebCore framework) and hand it to WebKit. In this new architecture, UIKit instead sends `UIKeyEvent`s to WebKit, which (for the time being) are wrapped by `WebEvent`s within WebKit code. This will eventually allow us to break UIKit out of the WebKit "framework layering sandwich", wherein WebKit links UIKit and UIKit currently links WebKitLegacy in order to call directly into the WebCore framework. See below for more details. * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/platform/ios/WebEvent.mm: (webEventType): (webEventModifierFlags): (-[WebEvent initWithUIKeyEvent:]): (-[WebEvent originalUIKeyEvent]): Add an initializer to wrap a `UIKeyEvent` in a `WebEvent`, while keeping a pointer to the original `UIKeyEvent` (accessible via a new property, `-originalUIKeyEvent`). * Source/WebCore/platform/ios/WebEventPrivate.h: Added. Put these new WebCore helpers in a new category on `WebEvent` in a separate private header, `WebEventPrivate.h`. This separation from `WebEvent.h` allows us to use `HAVE(UI_ASYNC_TEXT_INPUT)` consistently throughout WebKit, and avoid expanding the API surface exported through `WebEvent` to system clients, such as UIKit or accessibility. * Source/WebKit/UIProcess/ios/WKContentViewInteraction.h: * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _interpretKeyEvent:isCharEvent:]): Call back into UIKit via `-deferHandlingToSystemForKeyEvent:` when interpreting key events. (-[WKContentView asyncSystemInputDelegate]): (-[WKContentView setAsyncSystemInputDelegate:]): (-[WKContentView handleAsyncKeyEvent:withCompletionHandler:]): Wrap the given `UIKeyEvent` in a `WebEvent`, and just call into the existing `-handleKeyWebEvent:` method. (-[WKContentView textInputView]): Canonical link: https://commits.webkit.org/269010@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes