[webkit-changes] [WebKit/WebKit] 4d943d: [iOS] <option> elements outside of an <optgroup> a...

Aditya Keerthi noreply at github.com
Sat Nov 4 18:20:37 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4d943d6f341e8a1d5f76e171805e7add1c4e9af9
      https://github.com/WebKit/WebKit/commit/4d943d6f341e8a1d5f76e171805e7add1c4e9af9
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-11-04 (Sat, 04 Nov 2023)

  Changed paths:
    A LayoutTests/fast/forms/ios/select-multiple-options-after-optgroup-expected.txt
    A LayoutTests/fast/forms/ios/select-multiple-options-after-optgroup.html
    A LayoutTests/fast/forms/ios/select-options-after-optgroup-expected.txt
    A LayoutTests/fast/forms/ios/select-options-after-optgroup.html
    M Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [iOS] <option> elements outside of an <optgroup> are added to the preceding group
https://bugs.webkit.org/show_bug.cgi?id=264192
rdar://117930480

Reviewed by Wenson Hsieh.

<option> elements are displayed in the UI process by sending over a vector of
options that includes a minimal data representation of <optgroup> and <option>
elements. Currently, <options> are associated with an <optgroup> by incrementing
a counter whenever an <optgroup> is encountered, and then storing the current
counter value on the <option> representation.

The current approach is flawed when an <optgroup> terminates, and is followed by
<option> elements outside of a group. In this case, the counter is not incremented,
and the options are associated with the preceding group.

To fix, keep track of the current <optgroup> element, and when an option that no
longer belongs to the current <optgroup> is encountered, insert a "fake" group and
increment the counter. This approach ensures that trailing <options> do not appear
as part of the preceding group. This fix is not applied for the picker wheel UI
used in bincompat scenarios, as the UI does not allow for ungrouped options to be
distinguished.

Additionally, fix the appearance of groups with no items and groups missing a title,
to exclude a disclosure button, and remove padding, respectively.

* LayoutTests/fast/forms/ios/select-multiple-options-after-optgroup-expected.txt: Added.
* LayoutTests/fast/forms/ios/select-multiple-options-after-optgroup.html: Added.
* LayoutTests/fast/forms/ios/select-options-after-optgroup-expected.txt: Added.
* LayoutTests/fast/forms/ios/select-options-after-optgroup.html: Added.
* Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker createMenu]):
(-[WKSelectPickerGroupHeaderView initWithGroupName:section:isCollapsible:]):
(-[WKSelectPickerGroupHeaderView setCollapsed:animated:]):
(-[WKSelectPickerTableViewController tableView:heightForHeaderInSection:]):

Groups without a title should appear as a smaller amount of padding, rather
than a full size header.

(-[WKSelectPickerTableViewController tableView:viewForHeaderInSection:]):

Empty groups are not collapsible, and should not show a disclosure button.

(-[WKSelectPickerTableViewController didTapSelectPickerGroupHeaderView:]):
(-[WKSelectPickerGroupHeaderView initWithGroupName:section:]): Deleted.
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::focusedElementInformation):

Keep track of the current <optgroup> element when one is encountered. If the
next <option> does not belong to the same group, make it part of a new group
with an empty title.

Canonical link: https://commits.webkit.org/270235@main




More information about the webkit-changes mailing list