Commit f6f7597c authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

Revert "[iOS] Change omnibox pre-edit exiting behavior."

This reverts commit 05d76942.

This change was introduced to work around an iOS 13 bug which is now
fixed. Therefore it can be reverted.

Bug: 988431, 875918, 873544
Change-Id: If0d0ecb7a3f22097f662e01a35d631b2a997be9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1807251
Auto-Submit: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarRobbie Gibson <rkgibson@google.com>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#697597}
parent a6757201
...@@ -438,24 +438,13 @@ bool OmniboxViewIOS::OnWillChange(NSRange range, NSString* new_text) { ...@@ -438,24 +438,13 @@ bool OmniboxViewIOS::OnWillChange(NSRange range, NSString* new_text) {
[field_ setClearingPreEditText:YES]; [field_ setClearingPreEditText:YES];
// Exit the pre-editing state in OnWillChange() instead of OnDidChange(), as // Exit the pre-editing state in OnWillChange() instead of OnDidChange(), as
// that allows IME to continue working. // that allows IME to continue working. The following code selects the text
// as if the pre-edit fake selection was real.
[field_ exitPreEditState]; [field_ exitPreEditState];
if (@available(iOS 13, *)) { field_.selectedTextRange =
// Exit pre-edit completely by setting the text to an empty string. [field_ textRangeFromPosition:field_.beginningOfDocument
// On iOS 13, swiping keyboard acquires a lock that UITextField attempts toPosition:field_.endOfDocument];
// to acquire when setSelectedTextRange: is called, causing a deadlock.
// Therefore this workaround is introduced. This probably introduces small
// issues with third-party keyboards, like crbug.com/875918 and
// crbug.com/873544. See crbug.com/988431 for more context.
[field_ setText:@""];
} else {
// The following code selects the text
// as if the pre-edit fake selection was real.
field_.selectedTextRange =
[field_ textRangeFromPosition:field_.beginningOfDocument
toPosition:field_.endOfDocument];
}
// Reset |range| to be of zero-length at location zero, as the field will be // Reset |range| to be of zero-length at location zero, as the field will be
// now cleared. // now cleared.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment