[Extra zoom mode] Injected bundle form client should be notified when editing text...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 22:21:54 +0000 (22:21 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 22:21:54 +0000 (22:21 +0000)
commit10e201bfb5e097e366b85ec1ec8fe5f6516905ef
tree39fbd93bdd142220a7850fba4ce1b92bcd8afee2
parent43852f2ec4ca2d9aca0a14c13edcf4ca2b691948
[Extra zoom mode] Injected bundle form client should be notified when editing text fields
https://bugs.webkit.org/show_bug.cgi?id=184822
<rdar://problem/38807319>

Reviewed by Tim Horton.

Source/WebCore:

Export the constructor and destructor of UserTypingGestureIndicator for use in WebKit (see WebPage.cpp).

Test: fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html

* dom/UserTypingGestureIndicator.h:

Source/WebKit:

Fixes the bug by making a couple of tweaks: (1) don't use a separate codepath for inserting text in text inputs,
and (2) force a user typing gesture when inserting text using this codepath (i.e. WKTextInputListViewController).
Also adds plumbing to enable testing text entry with WKTextInputListViewController in extra zoom mode.

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

Introduce testing SPI to simulate text entry. Additionally, add a missing availability annotation around testing
SPI added in 2017 to help test drag and drop for iOS 11.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _simulateTextEntered:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setTextAsync):

Tools:

Add WebKitTestRunner support for listening to form editing SPI hooks in the injected bundle. The new layout test
installs callbacks that listen for "begin editing", "end editing", and "text changed" calls to injected bundle
SPI. See other ChangeLogs for more detail.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::enterText):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:

Add UIScriptController support for simulating text entry in the currently focused element.

* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::enterText):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:

Add TestRunner bindings for registering injected bundle form client callbacks.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::handleTextDidChangeInTextField):
(WTR::handleTextFieldDidBeginEditing):
(WTR::handleTextFieldDidEndEditing):
(WTR::InjectedBundle::didCreatePage):

Set the injected bundle form editor client.

(WTR::InjectedBundle::setUpInjectedBundleClients):
(WTR::InjectedBundle::textDidChangeInTextField):
(WTR::InjectedBundle::textFieldDidBeginEditing):
(WTR::InjectedBundle::textFieldDidEndEditing):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::installTextDidChangeInTextFieldCallback):
(WTR::TestRunner::textDidChangeInTextFieldCallback):
(WTR::TestRunner::installTextFieldDidBeginEditingCallback):
(WTR::TestRunner::textFieldDidBeginEditingCallback):
(WTR::TestRunner::installTextFieldDidEndEditingCallback):
(WTR::TestRunner::textFieldDidEndEditingCallback):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::enterText):

LayoutTests:

Add a new layout test that focuses an input field, simulates text entry, and verifies that the injected bundle
form client's textDidChangeInTextField, textFieldDidBeginEditing and textFieldDidEndEditing functions are called.

* TestExpectations:

Skip tests in fast/forms/extrazoom by default.

* fast/forms/extrazoom/edit-text-field-calls-injected-bundle-expected.txt: Added.
* fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html: Added.
* resources/ui-helper.js:
(window.UIHelper.enterText):

Introduce a new UIHelper method to simulate text entry in the currently focused element.

(window.UIHelper):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230860 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/forms/extrazoom/edit-text-field-calls-injected-bundle-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html [new file with mode: 0644]
LayoutTests/resources/ui-helper.js
Source/WebCore/ChangeLog
Source/WebCore/dom/UserTypingGestureIndicator.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm