[webkit-changes] [WebKit/WebKit] 8feab8: [iOS] [Safari] Contact AutoFill fails to insert te...

Wenson Hsieh noreply at github.com
Thu Jan 25 14:37:57 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8feab814181a193b22ed4b7a8825a5e6b6b7963d
      https://github.com/WebKit/WebKit/commit/8feab814181a193b22ed4b7a8825a5e6b6b7963d
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-01-25 (Thu, 25 Jan 2024)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Tools/TestWebKitAPI/Tests/ios/TestInputDelegate.h
    M Tools/TestWebKitAPI/Tests/ios/TestInputDelegate.mm
    M Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm

  Log Message:
  -----------
  [iOS] [Safari] Contact AutoFill fails to insert text after adopting BETextInput/BETextSuggestion
https://bugs.webkit.org/show_bug.cgi?id=268099
rdar://121604196

Reviewed by Tim Horton.

When receiving a `BETextSuggestion` in `-insertTextSuggestion:`, we currently integrate with our SPI
clients by asking for the `-inputText`, creating a `UITextSuggestion` from this text, and passing it
back to the client in `-_webView:insertTextSuggestion:inInputSession:`. However, this discards any
custom classes provided by the SPI client (in this case, Safari's `SFTextSuggestion`). Safari's
logic performs a class check on the text suggestion handed back to them in the input delegate SPI,
and drops the text suggestion on the floor in the case where the suggestion isn't a subclass of
`SFTextSuggestion`.

Simply fix this by unwrapping the `BETextSuggestion` to get the backing `UITextSuggestion` to
preserve bincompat with SPI clients.

Test: WKWebViewAutoFillTests.AutoFillPreservesTextSuggestion

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView insertTextSuggestion:]):
* Tools/TestWebKitAPI/Tests/ios/TestInputDelegate.mm:
(-[TestInputDelegate _webView:insertTextSuggestion:inInputSession:]):

Add an API test and test infrastructure to exercise this fix.

* Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:

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




More information about the webkit-changes mailing list