Skip to content

Commit

Permalink
[UIAsyncTextInput] Use the superclass implementation of a couple of i…
Browse files Browse the repository at this point in the history
…nternal UIResponder methods

https://bugs.webkit.org/show_bug.cgi?id=265464

Reviewed by Megan Gardner.

Call directly into the superclass implementation when the `UIAsyncTextInput` codepath is enabled,
instead of relying on custom logic in WebKit for the following two internal `UIResponder`
subclassing hooks.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _requiresKeyboardWhenFirstResponder]):
(-[WKContentView _requiresKeyboardResetOnReload]):

Canonical link: https://commits.webkit.org/271230@main
  • Loading branch information
whsieh committed Nov 28, 2023
1 parent 82bd651 commit 39d8ed0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/WebKit/Platform/spi/ios/UIKitSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,11 @@ typedef NS_ENUM(NSInteger, UIShiftKeyState) {

#endif

@interface UIResponder (Internal)
- (BOOL)_requiresKeyboardWhenFirstResponder;
- (BOOL)_requiresKeyboardResetOnReload;
@end

WTF_EXTERN_C_BEGIN

BOOL UIKeyboardEnabledInputModesAllowOneToManyShortcuts(void);
Expand Down
11 changes: 11 additions & 0 deletions Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2699,12 +2699,23 @@ - (BOOL)_requiresKeyboardWhenFirstResponder
{
if ([_webView _isEditable] && !self._disableAutomaticKeyboardUI)
return YES;

#if HAVE(UI_ASYNC_TEXT_INTERACTION)
if (self.shouldUseAsyncInteractions)
return [super _requiresKeyboardWhenFirstResponder];
#endif

// FIXME: We should add the logic to handle keyboard visibility during focus redirects.
return [self _shouldShowAutomaticKeyboardUIIgnoringInputMode] || _seenHardwareKeyDownInNonEditableElement;
}

- (BOOL)_requiresKeyboardResetOnReload
{
#if HAVE(UI_ASYNC_TEXT_INTERACTION)
if (self.shouldUseAsyncInteractions)
return [super _requiresKeyboardResetOnReload];
#endif

return YES;
}

Expand Down

0 comments on commit 39d8ed0

Please sign in to comment.