Title: [261815] trunk
Revision
261815
Author
wenson_hs...@apple.com
Date
2020-05-18 09:23:30 -0700 (Mon, 18 May 2020)

Log Message

Single selection <select> with <optgroups> shows multiple selected options
https://bugs.webkit.org/show_bug.cgi?id=199485
<rdar://problem/52757531>

Reviewed by Megan Gardner.

Source/WebKit:

Fixes a long-standing bug in WKMultipleSelectPicker. Prior to this patch, we rely on the delegate method
`-pickerView:row:column:checked:` to be called twice whenever an item is selected: one time for the item that is
no longer checked, and another for the newly checked item. This method is responsible for updating the cached
`FocusedElementInformation` that determines the data model for the select menu, with the expectation that the
unchecked item would be updated to have `isSelected = false;`, and the new checked item would have `isSelected`
`= true;`.

However, `-pickerView:row:column:checked:` is only called for visible item cells. This means that if the user
checks an item, scrolls the select menu items down so that the checked item is offscreen, and then checks a
different item, we only get notified that the new item is checked, and as a result, fail to uncheck the previous
item.

To address this, tweak our logic for handling a single select so that when an item is checked, we additionally
update the previously checked item to not be selected. Also, fix what seems to be a bug in the logic for
updating `_singleSelectionIndex`, which is currently updated even when the item is unchecked. It seems to work
out at the moment, because `-pickerView:row:column:checked:` seems to be called with `checked := YES` after the
previous item was unchecked (assuming that it was visible).

Test: fast/forms/ios/no-stale-checked-items-in-select-picker.html

* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView selectFormAccessoryHasCheckedItemAtRow:]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView selectFormAccessoryHasCheckedItemAtRow:]):

Add plumbing for a new testing hook.

* UIProcess/ios/forms/WKFormSelectControl.h:
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl selectFormAccessoryHasCheckedItemAtRow:]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
(-[WKMultipleSelectPicker pickerView:row:column:checked:]):
(-[WKMultipleSelectPicker selectRow:inComponent:extendingSelection:]):

Also, fix an existing bug in this testing helper method that crashed the test runner due to calling an
unimplemented selector. Instead of trying to invoke `-pickerView:didSelectRow:inComponent:`, we should be using
`-pickerView:row:column:checked:` instead for multiple select pickers (which, somewhat confusingly, are still
used for single select elements that have `optgroup`s.)

(-[WKMultipleSelectPicker selectFormAccessoryHasCheckedItemAtRow:]):

Tools:

Add a new helper method to check whether the currently presented form accessory is a select menu, and has a
checked menu item at the given row.

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

LayoutTests:

Add a layout test to verify that we don't leave behind a checked select item after scrolling it offscreen and
then checking a different item.

* fast/forms/ios/no-stale-checked-items-in-select-picker-expected.txt: Added.
* fast/forms/ios/no-stale-checked-items-in-select-picker.html: Added.
* platform/ipad/TestExpectations:
* resources/ui-helper.js:
(window.UIHelper.selectFormAccessoryPickerRow):
(window.UIHelper.selectFormAccessoryHasCheckedItemAtRow):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261814 => 261815)


--- trunk/LayoutTests/ChangeLog	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/LayoutTests/ChangeLog	2020-05-18 16:23:30 UTC (rev 261815)
@@ -1,3 +1,21 @@
+2020-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Single selection <select> with <optgroups> shows multiple selected options
+        https://bugs.webkit.org/show_bug.cgi?id=199485
+        <rdar://problem/52757531>
+
+        Reviewed by Megan Gardner.
+
+        Add a layout test to verify that we don't leave behind a checked select item after scrolling it offscreen and
+        then checking a different item.
+
+        * fast/forms/ios/no-stale-checked-items-in-select-picker-expected.txt: Added.
+        * fast/forms/ios/no-stale-checked-items-in-select-picker.html: Added.
+        * platform/ipad/TestExpectations:
+        * resources/ui-helper.js:
+        (window.UIHelper.selectFormAccessoryPickerRow):
+        (window.UIHelper.selectFormAccessoryHasCheckedItemAtRow):
+
 2020-05-18  Youenn Fablet  <you...@apple.com>
 
         webrtc/datachannel/bufferedAmountLowThreshold.html is failing flakily

Added: trunk/LayoutTests/fast/forms/ios/no-stale-checked-items-in-select-picker-expected.txt (0 => 261815)


--- trunk/LayoutTests/fast/forms/ios/no-stale-checked-items-in-select-picker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/no-stale-checked-items-in-select-picker-expected.txt	2020-05-18 16:23:30 UTC (rev 261815)
@@ -0,0 +1,11 @@
+This test verifies that checking items in a single-select menu with option groups does not leave behind checked select items. To manually run the test using iPhone, focus the select element, scroll down to the bottom, select an option, then scroll back up to the top. The first option ('One') should not appear checked.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS hasCheckedItemAtIndex0 is false
+PASS hasCheckedItemAtIndex13 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/ios/no-stale-checked-items-in-select-picker.html (0 => 261815)


--- trunk/LayoutTests/fast/forms/ios/no-stale-checked-items-in-select-picker.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/no-stale-checked-items-in-select-picker.html	2020-05-18 16:23:30 UTC (rev 261815)
@@ -0,0 +1,60 @@
+<!DOCTYPE html> <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <script src=""
+    <script src=""
+    <style>
+        select {
+            width: 100px;
+            height: 100px;
+        }
+    </style>
+</head>
+<body>
+    <select>
+        <optgroup label="A">
+            <option value="1">One</option>
+            <option value="2">Two</option>
+            <option value="3">Three</option>
+        </optgroup>
+        <optgroup label="B">
+            <option value="4">Four</option>
+            <option value="5">Five</option>
+            <option value="6">Six</option>
+            <option value="7">Seven</option>
+            <option value="8">Eight</option>
+            <option value="9">Nine</option>
+        </optgroup>
+        <optgroup label="C">
+            <option value="10">Ten</option>
+            <option value="11">Eleven</option>
+            <option value="12">Twelve</option>
+            <option value="13">Thirteen</option>
+        </optgroup>
+    </select>
+</body>
+<script>
+jsTestIsAsync = true;
+
+addEventListener("load", async () => {
+    description("This test verifies that checking items in a single-select menu with option groups does not leave behind checked select items. To manually run the test using iPhone, focus the select element, scroll down to the bottom, select an option, then scroll back up to the top. The first option ('One') should not appear checked.");
+
+    const select = document.querySelector("select");
+    await UIHelper.activateElementAndWaitForInputSession(select);
+
+    const swipeGesture = new UIHelper.EventStreamBuilder().begin(160, 500).move(160, 200, 0.5).end().takeResult();
+    await UIHelper.sendEventStream(swipeGesture);
+    await UIHelper.selectFormAccessoryPickerRow(13);
+
+    hasCheckedItemAtIndex0 = await UIHelper.selectFormAccessoryHasCheckedItemAtRow(0);
+    hasCheckedItemAtIndex13 = await UIHelper.selectFormAccessoryHasCheckedItemAtRow(13);
+    shouldBeFalse("hasCheckedItemAtIndex0");
+    shouldBeTrue("hasCheckedItemAtIndex13");
+
+    select.blur();
+    await UIHelper.waitForKeyboardToHide();
+    finishJSTest();
+});
+</script>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ipad/TestExpectations (261814 => 261815)


--- trunk/LayoutTests/platform/ipad/TestExpectations	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/LayoutTests/platform/ipad/TestExpectations	2020-05-18 16:23:30 UTC (rev 261815)
@@ -8,6 +8,9 @@
 fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html [ Skip ]
 fast/visual-viewport/ios/caret-after-focus-in-fixed.html [ Skip ]
 
+# The select picker input view is not displayed on iPad.
+fast/forms/ios/no-stale-checked-items-in-select-picker.html
+
 # These tests are designed for iPhone and crash on iPad
 media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html [ Skip ]
 media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html [ Skip ]

Modified: trunk/LayoutTests/resources/ui-helper.js (261814 => 261815)


--- trunk/LayoutTests/resources/ui-helper.js	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/LayoutTests/resources/ui-helper.js	2020-05-18 16:23:30 UTC (rev 261815)
@@ -722,10 +722,17 @@
 
     static selectFormAccessoryPickerRow(rowIndex)
     {
-        const selectRowScript = `(() => uiController.selectFormAccessoryPickerRow(${rowIndex}))()`;
+        const selectRowScript = `uiController.selectFormAccessoryPickerRow(${rowIndex})`;
         return new Promise(resolve => testRunner.runUIScript(selectRowScript, resolve));
     }
 
+    static selectFormAccessoryHasCheckedItemAtRow(rowIndex)
+    {
+        return new Promise(resolve => testRunner.runUIScript(`uiController.selectFormAccessoryHasCheckedItemAtRow(${rowIndex})`, result => {
+            resolve(result === "true");
+        }));
+    }
+
     static selectFormPopoverTitle()
     {
         return new Promise(resolve => {

Modified: trunk/Source/WebKit/ChangeLog (261814 => 261815)


--- trunk/Source/WebKit/ChangeLog	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/ChangeLog	2020-05-18 16:23:30 UTC (rev 261815)
@@ -1,5 +1,57 @@
 2020-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
 
+        Single selection <select> with <optgroups> shows multiple selected options
+        https://bugs.webkit.org/show_bug.cgi?id=199485
+        <rdar://problem/52757531>
+
+        Reviewed by Megan Gardner.
+
+        Fixes a long-standing bug in WKMultipleSelectPicker. Prior to this patch, we rely on the delegate method
+        `-pickerView:row:column:checked:` to be called twice whenever an item is selected: one time for the item that is
+        no longer checked, and another for the newly checked item. This method is responsible for updating the cached
+        `FocusedElementInformation` that determines the data model for the select menu, with the expectation that the
+        unchecked item would be updated to have `isSelected = false;`, and the new checked item would have `isSelected`
+        `= true;`.
+
+        However, `-pickerView:row:column:checked:` is only called for visible item cells. This means that if the user
+        checks an item, scrolls the select menu items down so that the checked item is offscreen, and then checks a
+        different item, we only get notified that the new item is checked, and as a result, fail to uncheck the previous
+        item.
+
+        To address this, tweak our logic for handling a single select so that when an item is checked, we additionally
+        update the previously checked item to not be selected. Also, fix what seems to be a bug in the logic for
+        updating `_singleSelectionIndex`, which is currently updated even when the item is unchecked. It seems to work
+        out at the moment, because `-pickerView:row:column:checked:` seems to be called with `checked := YES` after the
+        previous item was unchecked (assuming that it was visible).
+
+        Test: fast/forms/ios/no-stale-checked-items-in-select-picker.html
+
+        * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+        * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+        (-[WKWebView selectFormAccessoryHasCheckedItemAtRow:]):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView selectFormAccessoryHasCheckedItemAtRow:]):
+
+        Add plumbing for a new testing hook.
+
+        * UIProcess/ios/forms/WKFormSelectControl.h:
+        * UIProcess/ios/forms/WKFormSelectControl.mm:
+        (-[WKFormSelectControl selectFormAccessoryHasCheckedItemAtRow:]):
+        * UIProcess/ios/forms/WKFormSelectPicker.mm:
+        (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
+        (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
+        (-[WKMultipleSelectPicker selectRow:inComponent:extendingSelection:]):
+
+        Also, fix an existing bug in this testing helper method that crashed the test runner due to calling an
+        unimplemented selector. Instead of trying to invoke `-pickerView:didSelectRow:inComponent:`, we should be using
+        `-pickerView:row:column:checked:` instead for multiple select pickers (which, somewhat confusingly, are still
+        used for single select elements that have `optgroup`s.)
+
+        (-[WKMultipleSelectPicker selectFormAccessoryHasCheckedItemAtRow:]):
+
+2020-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
         [iOS] Unexpected capitalization of next word after repositioning caret
         https://bugs.webkit.org/show_bug.cgi?id=211969
         <rdar://problem/62605526>

Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h (261814 => 261815)


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h	2020-05-18 16:23:30 UTC (rev 261815)
@@ -48,6 +48,7 @@
 - (void)dismissFormAccessoryView;
 - (void)_dismissFilePicker;
 - (void)selectFormAccessoryPickerRow:(int)rowIndex;
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex;
 
 - (BOOL)_mayContainEditableElementsInRect:(CGRect)rect;
 - (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void (^)(NSArray<_WKTextInputContext *> *))completionHandler;

Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm (261814 => 261815)


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm	2020-05-18 16:23:30 UTC (rev 261815)
@@ -144,6 +144,11 @@
     [_contentView selectFormAccessoryPickerRow:rowIndex];
 }
 
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex
+{
+    return [_contentView selectFormAccessoryHasCheckedItemAtRow:rowIndex];
+}
+
 - (NSString *)selectFormPopoverTitle
 {
     return [_contentView selectFormPopoverTitle];

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (261814 => 261815)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-05-18 16:23:30 UTC (rev 261815)
@@ -619,6 +619,7 @@
 - (void)_simulateLongPressActionAtLocation:(CGPoint)location;
 - (void)_simulateTextEntered:(NSString *)text;
 - (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex;
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex;
 - (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute;
 - (double)timePickerValueHour;
 - (double)timePickerValueMinute;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (261814 => 261815)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-05-18 16:23:30 UTC (rev 261815)
@@ -8757,6 +8757,15 @@
 #endif
 }
 
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex
+{
+#if !PLATFORM(WATCHOS)
+    if ([_inputPeripheral isKindOfClass:[WKFormSelectControl self]])
+        return [(WKFormSelectControl *)_inputPeripheral selectFormAccessoryHasCheckedItemAtRow:rowIndex];
+#endif
+    return NO;
+}
+
 - (NSString *)textContentTypeForTesting
 {
 #if PLATFORM(WATCHOS)

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.h (261814 => 261815)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.h	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.h	2020-05-18 16:23:30 UTC (rev 261815)
@@ -41,6 +41,7 @@
 
 @interface WKFormSelectControl(WKTesting)
 - (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection;
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex;
 @property (nonatomic, readonly) NSString *selectFormPopoverTitle;
 @end
 
@@ -47,6 +48,7 @@
 @protocol WKSelectTesting
 @optional
 - (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection;
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex;
 @end
 
 #endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm (261814 => 261815)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm	2020-05-18 16:23:30 UTC (rev 261815)
@@ -101,6 +101,12 @@
     return [(WKSelectPopover *)self.control tableViewController].title;
 }
 
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex
+{
+    return [self.control respondsToSelector:@selector(selectFormAccessoryHasCheckedItemAtRow:)]
+        && [id<WKSelectTesting>(self.control) selectFormAccessoryHasCheckedItemAtRow:rowIndex];
+}
+
 @end
 
 #endif  // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm (261814 => 261815)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm	2020-05-18 16:23:30 UTC (rev 261815)
@@ -219,8 +219,8 @@
 
 - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)rowIndex forComponent:(NSInteger)columnIndex reusingView:(UIView *)view
 {
-    const OptionItem& item = [_view focusedSelectElementOptions][rowIndex];
-    UIPickerContentView* pickerItem = item.isGroup ? [[[WKOptionGroupPickerCell alloc] initWithOptionItem:item] autorelease] : [[[WKOptionPickerCell alloc] initWithOptionItem:item] autorelease];
+    auto& item = [_view focusedSelectElementOptions][rowIndex];
+    UIPickerContentView *pickerItem = item.isGroup ? [[[WKOptionGroupPickerCell alloc] initWithOptionItem:item] autorelease] : [[[WKOptionPickerCell alloc] initWithOptionItem:item] autorelease];
 
     // The cell starts out with a null frame. We need to set its frame now so we can find the right font size.
     UITableView *table = [pickerView tableViewForColumn:0];
@@ -272,10 +272,11 @@
 
 - (void)pickerView:(UIPickerView *)pickerView row:(int)rowIndex column:(int)columnIndex checked:(BOOL)isChecked
 {
-    if ((size_t)rowIndex >= [_view focusedSelectElementOptions].size())
+    auto numberOfOptions = static_cast<NSUInteger>([_view focusedSelectElementOptions].size());
+    if (numberOfOptions <= static_cast<NSUInteger>(rowIndex))
         return;
 
-    OptionItem& item = [_view focusedSelectElementOptions][rowIndex];
+    auto& item = [_view focusedSelectElementOptions][rowIndex];
 
     // FIXME: Remove this workaround once <rdar://problem/18745253> is fixed.
     // Group rows should not be checkable, but we are getting this delegate for
@@ -291,18 +292,19 @@
     if ([self allowsMultipleSelection]) {
         [_view page]->setFocusedElementSelectedIndex([self findItemIndexAt:rowIndex], true);
         item.isSelected = isChecked;
-    } else {
+    } else if (isChecked) {
         // Single selection.
-        item.isSelected = NO;
+        if (_singleSelectionIndex < numberOfOptions)
+            [_view focusedSelectElementOptions][_singleSelectionIndex].isSelected = false;
+
         _singleSelectionIndex = rowIndex;
 
         // This private delegate often gets called for multiple rows in the picker,
         // so we only activate and set as selected the checked item in single selection.
-        if (isChecked) {
-            [_view page]->setFocusedElementSelectedIndex([self findItemIndexAt:rowIndex]);
-            item.isSelected = YES;
-        }
-    }
+        [_view page]->setFocusedElementSelectedIndex([self findItemIndexAt:rowIndex]);
+        item.isSelected = true;
+    } else
+        item.isSelected = false;
 }
 
 // WKSelectTesting
@@ -311,9 +313,18 @@
     // FIXME: handle extendingSelection.
     [self selectRow:rowIndex inComponent:0 animated:NO];
     // Progammatic selection changes don't call the delegate, so do that manually.
-    [self.delegate pickerView:self didSelectRow:rowIndex inComponent:0];
+    [self pickerView:self row:rowIndex column:0 checked:YES];
 }
 
+- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex
+{
+    auto numberOfRows = [self numberOfRowsInComponent:0];
+    if (rowIndex >= numberOfRows)
+        return NO;
+
+    return [(UIPickerContentView *)[self viewForRow:rowIndex forComponent:0] isChecked];
+}
+
 @end
 
 @implementation WKSelectSinglePicker {

Modified: trunk/Tools/ChangeLog (261814 => 261815)


--- trunk/Tools/ChangeLog	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Tools/ChangeLog	2020-05-18 16:23:30 UTC (rev 261815)
@@ -1,5 +1,23 @@
 2020-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
 
+        Single selection <select> with <optgroups> shows multiple selected options
+        https://bugs.webkit.org/show_bug.cgi?id=199485
+        <rdar://problem/52757531>
+
+        Reviewed by Megan Gardner.
+
+        Add a new helper method to check whether the currently presented form accessory is a select menu, and has a
+        checked menu item at the given row.
+
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        (WTR::UIScriptController::selectFormAccessoryHasCheckedItemAtRow const):
+        * WebKitTestRunner/ios/UIScriptControllerIOS.h:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptControllerIOS::selectFormAccessoryHasCheckedItemAtRow const):
+
+2020-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
         [iOS] Unexpected capitalization of next word after repositioning caret
         https://bugs.webkit.org/show_bug.cgi?id=211969
         <rdar://problem/62605526>

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (261814 => 261815)


--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2020-05-18 16:23:30 UTC (rev 261815)
@@ -212,6 +212,7 @@
 
     // <select> picker
     void selectFormAccessoryPickerRow(long rowIndex);
+    boolean selectFormAccessoryHasCheckedItemAtRow(long rowIndex);
     readonly attribute DOMString selectFormPopoverTitle;
     readonly attribute DOMString formInputLabel;
 

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (261814 => 261815)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2020-05-18 16:23:30 UTC (rev 261815)
@@ -205,6 +205,7 @@
     virtual void dismissFilePicker(JSValueRef callback) { notImplemented(); }
     virtual void dismissFormAccessoryView() { notImplemented(); }
     virtual void selectFormAccessoryPickerRow(long) { notImplemented(); }
+    virtual bool selectFormAccessoryHasCheckedItemAtRow(long) const { return false; }
     virtual JSRetainPtr<JSStringRef> textContentType() const { notImplemented(); return nullptr; }
     virtual JSRetainPtr<JSStringRef> selectFormPopoverTitle() const { notImplemented(); return nullptr; }
     virtual JSRetainPtr<JSStringRef> formInputLabel() const { notImplemented(); return nullptr; }

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h (261814 => 261815)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h	2020-05-18 16:23:30 UTC (rev 261815)
@@ -88,6 +88,7 @@
     JSRetainPtr<JSStringRef> textContentType() const override;
     JSRetainPtr<JSStringRef> formInputLabel() const override;
     void selectFormAccessoryPickerRow(long rowIndex) override;
+    bool selectFormAccessoryHasCheckedItemAtRow(long rowIndex) const override;
     void setTimePickerValue(long hour, long minute) override;
     double timePickerValueHour() const override;
     double timePickerValueMinute() const override;

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (261814 => 261815)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-05-18 16:20:08 UTC (rev 261814)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-05-18 16:23:30 UTC (rev 261815)
@@ -606,6 +606,11 @@
     [webView() selectFormAccessoryPickerRow:rowIndex];
 }
 
+bool UIScriptControllerIOS::selectFormAccessoryHasCheckedItemAtRow(long rowIndex) const
+{
+    return [webView() selectFormAccessoryHasCheckedItemAtRow:rowIndex];
+}
+
 void UIScriptControllerIOS::setTimePickerValue(long hour, long minute)
 {
     [webView() setTimePickerValueToHour:hour minute:minute];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to