Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6b4b5fc1f0f6b969bf48e016f64c81f7b26387b7
      
https://github.com/WebKit/WebKit/commit/6b4b5fc1f0f6b969bf48e016f64c81f7b26387b7
  Author: Aditya Keerthi <akeer...@apple.com>
  Date:   2023-01-23 (Mon, 23 Jan 2023)

  Changed paths:
    A LayoutTests/fast/forms/select-optgroup-set-value-expected.txt
    A LayoutTests/fast/forms/select-optgroup-set-value.html
    M Source/WebCore/html/HTMLSelectElement.cpp

  Log Message:
  -----------
  REGRESSION (254522@main): HTMLSelectElement's value setter sets incorrect 
values if there are grouped options
https://bugs.webkit.org/show_bug.cgi?id=251024
rdar://103520364

Reviewed by Ryosuke Niwa.

While updating `HTMLSelectElement::listItems` to use `WeakPtr`, 254522@main
also modified `HTMLSelectElement::setValue` to use `Vector::findIf` to
obtain the index of the selected option. However, `listItems` includes
`<optgroup>` elements, resulting in the index of the selected option being
offset by the number of `<optgroup>` elements before it. `<optgroup>` elements
should be ignored when determining the index of the selected option.

To fix, restore the range-based for loop that was used prior to 254522@main.

* LayoutTests/fast/forms/select-optgroup-set-value-expected.txt: Added.
* LayoutTests/fast/forms/select-optgroup-set-value.html: Added.
* Source/WebCore/html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::setValue):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to