[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