[iOS] Keyboard becomes unresponsive after pressing delete while pressing down on...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 18:32:22 +0000 (18:32 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 18:32:22 +0000 (18:32 +0000)
commit07fc6c2e2ade9d254f53e18cb408029a1eea271c
tree694e7041ea17b402159eed86b8f06fd2d663bbda
parent1bdd01bc5b25c3a86f649249e87c5699fa019ef4
[iOS] Keyboard becomes unresponsive after pressing delete while pressing down on a character key with accents
https://bugs.webkit.org/show_bug.cgi?id=188251
<rdar://problem/37842108>

Reviewed by Tim Horton.

Source/WebKit:

Fixes a bug in key event handling where invoking -handleKeyWebEvent:withCompletionHandler: from within the
completion callback of a previous call to -handleKeyWebEvent:withCompletionHandler: would cause the completion
callback to be cleared out prematurely. In some cases (as described in the title of this bug), UIKit exercises
this codepath and subsequently hangs due to their completion block never getting invoked by WebKit.

Test: KeyboardInputTests.CanHandleKeyEventInCompletionHandler

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
(-[WKContentView _didHandleKeyEvent:eventWasHandled:]):

Tools:

Adds a new API test to verify that clients (in this case, UIKit) is allowed to invoke
-handleKeyWebEvent:withCompletionHandler: within the completion block of a prior invocation.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm: Added.
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/ios/TestInputDelegate.h: Added.

Pull some logic used to force an input session to start out from an existing API test file
(WKWebViewAutofillTests) and into a separate helper class that is used by both the existing API tests and the
new keyboard input test.

* TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:
(-[AutofillTestView initWithFrame:]):
(TestWebKitAPI::TEST):
(-[TestInputDelegate init]): Deleted.
(-[TestInputDelegate _webView:focusShouldStartInputSession:]): Deleted.
* TestWebKitAPI/ios/UIKitSPI.h:

Add some UIKit SPI utilized by the new API test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/ios/TestInputDelegate.h [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/ios/TestInputDelegate.mm [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm
Tools/TestWebKitAPI/ios/UIKitSPI.h