[webkit-changes] [WebKit/WebKit] 6b4b5f: REGRESSION (254522 at main): HTMLSelectElement's valu...
Aditya Keerthi
noreply at github.com
Mon Jan 23 16:13:50 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6b4b5fc1f0f6b969bf48e016f64c81f7b26387b7
https://github.com/WebKit/WebKit/commit/6b4b5fc1f0f6b969bf48e016f64c81f7b26387b7
Author: Aditya Keerthi <akeerthi at 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 at 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 at 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 at 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
More information about the webkit-changes
mailing list