[webkit-changes] [WebKit/WebKit] 2a6ce5: [AsyncTextInput] Pressing space twice after accept...

Wenson Hsieh noreply at github.com
Wed Jan 17 18:09:45 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2a6ce5d4b0c461264eab28f28c7856460a83e465
      https://github.com/WebKit/WebKit/commit/2a6ce5d4b0c461264eab28f28c7856460a83e465
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-01-17 (Wed, 17 Jan 2024)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

  Log Message:
  -----------
  [AsyncTextInput] Pressing space twice after accepting an inline prediction no longer inserts a full stop
https://bugs.webkit.org/show_bug.cgi?id=267653
rdar://120847806

Reviewed by Megan Gardner.

When `UIAsyncTextInput` is enabled, most calls to `-deleteBackward` and `-_deleteForwardAndNotify:`
have been merged into `-deleteInDirection:toGranularity:`, with `UITextGranularityCharacter` as the
given granularity. However, there was a subtle behavior change here: we now notify the system input
delegate (i.e. `UIKeyboardImpl`) by calling into `-selectionWillChange:` / `-selectionDidChange:`
when deleting backwards by a single character, whereas we didn't before.

Notifying the system delegate causes the keyboard to clear out some cached keyboard input state,
including a member that's used to determine whether or not the last inserted character was a space:
`m_previousInputString`. This previous input string is consulted by UIKit when deciding whether to
insert a space or to replace a recently-inserted space with a period character; because of the new
delegate notifications, we now always choose the former instead of the latter when performing a
double-space.

To limit risk, we address this regression by restoring shipping behavior, and avoid notifying the
keyboard about selection changes when performing the equivalent of `-deleteBackward`.

Unfortunately, I couldn't figure out a reliable way to write a test for this bug. For now, I filed
<https://webkit.org/b/267654> for this.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _executeEditCommand:]):
(-[WKContentView _executeEditCommand:notifyDelegate:]):
(-[WKContentView deleteInDirection:toGranularity:]):

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




More information about the webkit-changes mailing list