haikuwebkit/LayoutTests/fast/forms/ios
Aditya Keerthi 25f0818f30 [iOS] <select> picker value committed to incorrect element after programmatic focus change
https://bugs.webkit.org/show_bug.cgi?id=228556
rdar://81222952

Reviewed by Wenson Hsieh.

Source/WebKit:

The old <select> picker is a UIPickerView that only commits any value
changes to the WebProcess once the user dismisses the picker, or focus
is lost programmatically. Currently, the value change is committed by
sending a message to the WebProcess, telling it to update the value of
the currently focused element. However, when focus is changed
programmatically, the focused element in the WebProcess is updated
before the commit, and the incorrect element's value can be changed.

To fix, update all methods which commit value changes to the focused
element to take an ElementContext parameter representing the element
that needs its value modified. Then, in the WebProcess, rather than
commit the value change to the currently focused element, retrieve the
element from the ElementContext, ensuring the correct element is
updated.

Note that this bug only surfaces in the old <select> picker, on apps
linked before iOS 13, since the new picker commits value changes
immediately and dismisses itself.

Test: fast/forms/ios/select-picker-change-and-focus-another-select-programmatically.html

* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView accessoryClear]):
(-[WKContentView updateFocusedElementValueAsNumber:]):
(-[WKContentView updateFocusedElementValue:]):
(-[WKContentView updateFocusedElementValueAsColor:]):
(-[WKContentView updateFocusedElementSelectedIndex:allowsMultipleSelection:]):
(-[WKContentView insertTextSuggestion:]):
(-[WKContentView selectMenu:didSelectItemAtIndex:]):
(-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setFocusedElementValue):
(WebKit::WebPageProxy::setFocusedElementValueAsNumber):
(WebKit::WebPageProxy::setFocusedElementSelectedIndex):
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker reset:]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker pickerView:row:column:checked:]):
(-[WKSelectSinglePicker controlEndEditing]):
(-[WKSelectPicker didSelectOptionIndex:]):
(-[WKSelectPickerTableViewController tableView:didSelectRowAtIndexPath:]):
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setFocusedElementValue):
(WebKit::WebPage::setFocusedElementValueAsNumber):
(WebKit::WebPage::setFocusedElementSelectedIndex):

LayoutTests:

Added a test to verify that changing focus programmatically, while changes
in the <select> picker have not been committed, updates the value of the
correct element.

* fast/forms/ios/select-picker-change-and-focus-another-select-programmatically-expected.txt: Added.
* fast/forms/ios/select-picker-change-and-focus-another-select-programmatically.html: Added.


Canonical link: https://commits.webkit.org/240039@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280398 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-28 20:21:30 +00:00
..
form-control-refresh [iOS] REGRESSION: Tapping a <select> element does not show a menu on many websites 2021-07-27 23:30:41 +00:00
ipad REGRESSION: fast/forms/ios/ipad/open-picker-using-keyboard.html is timing out 2021-04-26 18:12:16 +00:00
resources
accessory-bar-navigation-expected.txt
accessory-bar-navigation-obscured-input-expected.txt [iOS] Obscured elements should not be focusable using the accessory bar 2021-01-25 22:51:56 +00:00
accessory-bar-navigation-obscured-input.html [iOS] Obscured elements should not be focusable using the accessory bar 2021-01-25 22:51:56 +00:00
accessory-bar-navigation.html REGRESSION (r271861): [iOS] Accessory bar navigation to elements outside the viewport fails 2021-04-26 17:35:13 +00:00
autocapitalize-words-expected.txt autocapitalize="words" capitalizes every word's second character 2020-07-08 17:08:22 +00:00
autocapitalize-words.html autocapitalize="words" capitalizes every word's second character 2020-07-08 17:08:22 +00:00
choose-color-from-color-picker-expected.txt [iOS][FCR] Use UIColorPickerViewController for color inputs 2021-02-09 19:25:04 +00:00
choose-color-from-color-picker.html [iOS][FCR] Use UIColorPickerViewController for color inputs 2021-02-09 19:25:04 +00:00
choose-select-option-expected.txt
choose-select-option.html [iOS][FCR] Enable the new appearance by default 2021-02-19 19:44:03 +00:00
click-should-not-suppress-misspelling-expected.txt
click-should-not-suppress-misspelling.html
constant-scroll-area-when-moving-focus-between-fields-expected.txt [iOS] Blurring a text input and focusing a date input changes the scrollable area 2020-10-08 15:10:06 +00:00
constant-scroll-area-when-moving-focus-between-fields.html [iOS] Adopt new date picker presentation SPI 2021-06-23 20:02:35 +00:00
delete-in-input-in-iframe-expected.txt
delete-in-input-in-iframe.html
disabled-options-in-multi-select-picker-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
disabled-options-in-multi-select-picker.html [iOS][FCR] Enable the new appearance by default 2021-02-19 19:44:03 +00:00
dismiss-picker-using-keyboard-expected.txt
dismiss-picker-using-keyboard.html REGRESSION (r259840): Pressing Esc or ⌘+"." does not dismiss time picker on iOS 2020-07-09 19:46:09 +00:00
drag-range-thumb-expected.txt
drag-range-thumb.html
file-upload-panel-accept-expected.txt [iOS] Refactor WKFileUploadPanel to use UniformTypeIdentifiers 2021-03-17 20:10:46 +00:00
file-upload-panel-accept.html [iOS] Refactor WKFileUploadPanel to use UniformTypeIdentifiers 2021-03-17 20:10:46 +00:00
file-upload-panel-capture-expected.txt
file-upload-panel-capture.html
file-upload-panel-expected.txt [iOS] Update strings and icons in the file upload panel 2021-03-19 02:56:02 +00:00
file-upload-panel.html [iOS] Update strings and icons in the file upload panel 2021-03-19 02:56:02 +00:00
focus-button-expected-mismatch.html
focus-button.html
focus-checkbox-expected-mismatch.html
focus-checkbox.html
focus-checked-checkbox-expected-mismatch.html
focus-checked-checkbox.html
focus-checked-radio-expected-mismatch.html
focus-checked-radio.html
focus-input-in-fixed-expected.txt
focus-input-in-fixed.html
focus-input-in-iframe-expected.txt
focus-input-in-iframe.html
focus-input-via-button-expected.txt
focus-input-via-button-no-scaling-expected.txt
focus-input-via-button-no-scaling.html
focus-input-via-button.html
focus-long-textarea-expected.txt
focus-long-textarea.html
focus-radio-expected-mismatch.html
focus-radio.html
focus-reset-button-expected-mismatch.html
focus-reset-button.html
focus-ring-size-expected.html REGRESSION (r276945): [iOS] Focus rings are too large 2021-05-13 21:53:00 +00:00
focus-ring-size.html REGRESSION (r276945): [iOS] Focus rings are too large 2021-05-13 21:53:00 +00:00
focus-search-field-expected-mismatch.html
focus-search-field.html
focus-select-and-switch-tabs-expected.txt [iPadOS] Do not present custom input peripherals when switching back to a tab with a focused element 2021-05-10 16:26:17 +00:00
focus-select-and-switch-tabs.html [iPadOS] Do not present custom input peripherals when switching back to a tab with a focused element 2021-05-10 16:26:17 +00:00
focus-submit-button-expected-mismatch.html
focus-submit-button.html
focus-text-field-expected-mismatch.html
focus-text-field.html
focus-textarea-expected-mismatch.html
focus-textarea.html
force-gregorian-calendar-for-credit-card-expiry-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
force-gregorian-calendar-for-credit-card-expiry.html REGRESSION (r259840): Pressing Esc or ⌘+"." does not dismiss time picker on iOS 2020-07-09 19:46:09 +00:00
hide-keyboard-on-node-removal-expected.txt
hide-keyboard-on-node-removal.html
input-peripherals-with-validation-message-expected.txt [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message 2020-10-22 15:55:54 +00:00
input-peripherals-with-validation-message.html [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message 2020-10-22 15:55:54 +00:00
inputmode-change-update-keyboard-after-pointerup-expected.txt
inputmode-change-update-keyboard-after-pointerup.html
inputmode-change-update-keyboard-expected.txt
inputmode-change-update-keyboard.html
inputmode-none-expected.txt
inputmode-none-with-hardware-keyboard-expected.txt
inputmode-none-with-hardware-keyboard.html
inputmode-none.html
inputmode-removing-none-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
inputmode-removing-none.html
keyboard-stability-when-refocusing-element-expected.txt
keyboard-stability-when-refocusing-element.html
large-radio-button-is-round-expected.html
large-radio-button-is-round.html
no-scrolling-when-moving-focus-between-adjacent-fields-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
no-scrolling-when-moving-focus-between-adjacent-fields.html [Testing] Rename test header commands to match names in WebPreferences*.yaml 2020-10-13 17:16:15 +00:00
no-stale-checked-items-in-select-picker-expected.txt Single selection <select> with <optgroups> shows multiple selected options 2020-05-18 16:23:30 +00:00
no-stale-checked-items-in-select-picker.html [iOS][FCR] Enable the new appearance by default 2021-02-19 19:44:03 +00:00
programmatic-focus-input-in-iframe-expected.txt
programmatic-focus-input-in-iframe.html
remove-and-add-view-during-focus-expected.txt
remove-and-add-view-during-focus.html
render-indeterminate-checkbox-expected-mismatch.html
render-indeterminate-checkbox.html
repeatedly-focus-offscreen-select-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
repeatedly-focus-offscreen-select.html [iPadOS] Two taps are required to choose a country/region when creating an account on ea.com 2020-07-30 23:31:59 +00:00
scroll-to-reveal-focused-select-expected.txt
scroll-to-reveal-focused-select.html REGRESSION (r273154): fast/forms/ios/scroll-to-reveal-focused-select.html is timing out 2021-04-27 22:46:11 +00:00
select-picker-change-and-focus-another-select-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
select-picker-change-and-focus-another-select-programmatically-expected.txt [iOS] <select> picker value committed to incorrect element after programmatic focus change 2021-07-28 20:21:30 +00:00
select-picker-change-and-focus-another-select-programmatically.html [iOS] <select> picker value committed to incorrect element after programmatic focus change 2021-07-28 20:21:30 +00:00
select-picker-change-and-focus-another-select.html [iOS][FCR] Enable the new appearance by default 2021-02-19 19:44:03 +00:00
show-and-dismiss-date-input-expected.txt [iOS] Occasional crash under -[UIView _setViewDelegate:] when presenting date and time pickers 2020-07-09 15:15:29 +00:00
show-and-dismiss-date-input.html Remove several unnecessary timeouts in layout tests 2020-08-17 01:48:06 +00:00
suppress-software-keyboard-while-focusing-input-expected.txt REGRESSION (r279310): Occasional crash when focusing login fields on iPad with a software keyboard 2021-06-29 03:11:28 +00:00
suppress-software-keyboard-while-focusing-input.html REGRESSION (r279310): Occasional crash when focusing login fields on iPad with a software keyboard 2021-06-29 03:11:28 +00:00
time-picker-value-change-expected.txt REGRESSION (r259840): Pressing Esc or ⌘+"." does not dismiss time picker on iOS 2020-07-09 19:46:09 +00:00
time-picker-value-change.html REGRESSION (r259840): Pressing Esc or ⌘+"." does not dismiss time picker on iOS 2020-07-09 19:46:09 +00:00
typing-in-input-in-iframe-expected.txt
typing-in-input-in-iframe.html
user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale-expected.txt
user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html
user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no-expected.txt
user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html
user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale-expected.txt
user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html
validation-bubble-dismiss-on-tap-expected.txt
validation-bubble-dismiss-on-tap.html
zoom-after-input-tap-expected.txt
zoom-after-input-tap-wide-input-expected.txt Tapping to focus editable elements should start caret selection at word boundary 2020-05-05 02:45:24 +00:00
zoom-after-input-tap-wide-input.html
zoom-after-input-tap.html