[Cocoa] No way for clients to tell whether the content view is in the responder chain...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2018 03:32:06 +0000 (03:32 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2018 03:32:06 +0000 (03:32 +0000)
commit3e60472f6a22605bc008e3c7c35d03f8c648fbcd
tree20454f1e14f0cd937bc561f3b744a7383c85c8dc
parentd745b3288adef3df56a4954b0a174d26249157f6
[Cocoa] No way for clients to tell whether the content view is in the responder chain when the web view is
https://bugs.webkit.org/show_bug.cgi?id=169212
<rdar://problem/30899656>

Reviewed by Tim Horton.

Source/WebKit:

Add an SPI hook to allow internal WKWebView clients to determine whether the WKWebView's content view is the
first responder. Intended for use by clients, such as Mail, that embed native text input views and other views
that may become first responder within the view hierarchy of the WKWebView.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _contentViewIsFirstResponder]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Tools:

Add an API test to exercise the behavior of `-_contentViewIsFirstResponder` when an embedded text input becomes
and resigns first responder.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewFirstResponderTests.mm: Added.
(-[FirstResponderTestingView initWithFrame:]):
(-[FirstResponderTestingView inputField]):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewFirstResponderTests.mm [new file with mode: 0644]