[webkit-changes] [WebKit/WebKit] 7a57a9: Stop using various SPI methods on UIKeyboard and U...

Wenson Hsieh noreply at github.com
Tue Nov 14 19:08:47 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7a57a9b53df0d39626b5aa7f2b2213cfc21c503c
      https://github.com/WebKit/WebKit/commit/7a57a9b53df0d39626b5aa7f2b2213cfc21c503c
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-11-14 (Tue, 14 Nov 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm
    M Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm

  Log Message:
  -----------
  Stop using various SPI methods on UIKeyboard and UIKeyboardImpl
https://bugs.webkit.org/show_bug.cgi?id=264820
rdar://118404384

Reviewed by Megan Gardner.

Remove uses of the following keyboard SPI methods:

```
+[UIKeyboard defaultSizeForInterfaceOrientation:]
-[UIKeyboardImpl isCallingInputDelegate]
```

...as well as several unused declarations on these two classes. See below for more details.

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

Instead of using `-isCallingInputDelegate` to determine whether or not we're currently inserting
text due to the user pressing a key, keep track of this state ourselves by tracking of `keydown`/
`keyup` and `pressesBegan`/`pressesEnded`. While this isn't perfect (i.e. there is a narrow case
where it's possible for the keyboard to produce text insertion commands right after a keyup), it's
sufficient to address the original use case this was intended to fix: rdar://47902054, wherein we
need to ensure a user gesture token when hitting Return to submit a search query.

(-[WKContentView pressesBegan:withEvent:]):
(-[WKContentView pressesEnded:withEvent:]):
(-[WKContentView pressesCancelled:withEvent:]):

Keep track of a `_isHandlingActivePressesEvent` flag.

(-[WKContentView _internalHandleKeyWebEvent:withCompletionHandler:]):

Keep track of a `_isHandlingActiveKeyEvent` flag.

(-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
(-[WKContentView sizeForLegacyFormControlPickerViews]):

Stop using `+defaultSizeForInterfaceOrientation:`; this was only used to try and make the default
size of the picker views used for multiple select elements and datalists consistent with the default
keyboard size, on apps linked against iOS 14 or older.

However, this is unnecessary in any recent version of iOS, where the keyboard will automatically
override the intrinsic height of the input views anyways, so we can just set 0 for the picker view
height to get the default keyboard height.

I manually tested this by forcing `-_shouldUseContextMenusForFormControls` to return NO on iOS 17.

* Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsPicker initWithInformation:inView:]):
* Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker initWithView:]):

Canonical link: https://commits.webkit.org/270742@main




More information about the webkit-changes mailing list