[Extra zoom mode] Missing label when focusing a <select> with a title attribute but...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2018 16:43:53 +0000 (16:43 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2018 16:43:53 +0000 (16:43 +0000)
commit7d7e8b1aee540788d98dfc7d9ddb8ebacef886de
treee9b5c7d1a78a860dbb01609428eec091457a1f45
parentdda80a939d9f3ed917fb8f910e7248380826a811
[Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label>
https://bugs.webkit.org/show_bug.cgi?id=184352
<rdar://problem/39237683>

Reviewed by Andy Estes.

Source/WebKit:

Currently, AssistedNodeInformation only sends the `title` of input elements to the UI process. This means that
any information requested in the UI process that is dependent on the `title` of the focused element is broken
in the case of select elements. An existing example of this is the title of the table view controller used to
present select menus on iPad.

To fix this, we simply send the `title` of the focused element across, as long as the focused element is an
HTMLElement. This ensures that there's label text when focusing unlabeled select elements with titles in extra
zoom mode, and also fixes a currenly broken codepath where we show the title of the select in the presented view
controller's title.

Test: fast/forms/ios/ipad/select-with-title.html

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

Add new testing SPI to fetch the title of the UITableViewController presented for the currently focused select
element.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView selectFormPopoverTitle]):
* UIProcess/ios/forms/WKFormSelectControl.h:
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl selectFormPopoverTitle]):
* UIProcess/ios/forms/WKFormSelectPopover.h:
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectPopover initWithView:hasGroups:]):
(-[WKSelectPopover tableViewController]):
* WebProcess/WebPage/ios/WebPageIOS.mm:

Always send the title across if the focused node is an HTMLElement.

(WebKit::WebPage::getAssistedNodeInformation):

Tools:

Add support for UIScriptController::selectFormPopoverTitle, which returns the title of the current select
popover's UITableViewController (for testing purposes).

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::selectFormPopoverTitle const):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::selectFormPopoverTitle const):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::selectFormPopoverTitle const):

LayoutTests:

Add a new layout test to check that the title of select elements is propagated to the UI process upon focus.
This title is used for several purposes, one of them being the title of select menus in the table view
controller presented when tapping on a select on an iPad, so the test checks that the title of the select is
shown here.

Also moves a select-related helper into UIHelper from basic-gestures.js (since this doesn't involve user gesture
simulation in any way) and also introduces a new UIHelper method for querying the title of the select menu that
is currently being presented.

* fast/forms/ios/ipad/multiple-select-updates-renderer.html:
* fast/forms/ios/ipad/select-with-title-expected.txt: Added.
* fast/forms/ios/ipad/select-with-title.html: Copied from LayoutTests/fast/forms/ios/ipad/multiple-select-updates-renderer.html.
* resources/basic-gestures.js:
* resources/ui-helper.js:
(window.UIHelper.selectFormAccessoryPickerRow):
(window.UIHelper.selectFormPopoverTitle):
(window.UIHelper):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/ipad/multiple-select-updates-renderer.html
LayoutTests/fast/forms/ios/ipad/select-with-title-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/ios/ipad/select-with-title.html [new file with mode: 0644]
LayoutTests/resources/basic-gestures.js
LayoutTests/resources/ui-helper.js
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/UIProcess/ios/forms/WKFormSelectControl.h
Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm
Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.h
Source/WebKit/UIProcess/ios/forms/WKFormSelectPopover.mm
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
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/ios/UIScriptControllerIOS.mm