Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 276ff916b54c07e8a3b69ab6c509899a10fa9976
https://github.com/WebKit/WebKit/commit/276ff916b54c07e8a3b69ab6c509899a10fa9976
Author: Anne van Kesteren <[email protected]>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
A LayoutTests/fast/forms/select/selectedcontent-multiple/clones-expected.txt
A LayoutTests/fast/forms/select/selectedcontent-multiple/clones.html
A
LayoutTests/fast/forms/select/selectedcontent-multiple/option-list-changes-expected.txt
A
LayoutTests/fast/forms/select/selectedcontent-multiple/option-list-changes.html
A LayoutTests/fast/forms/select/selectedcontent-multiple/picker-expected.txt
A LayoutTests/fast/forms/select/selectedcontent-multiple/picker.html
A
LayoutTests/fast/forms/select/selectedcontent-multiple/rendering-expected.html
A LayoutTests/fast/forms/select/selectedcontent-multiple/rendering.html
A
LayoutTests/fast/forms/select/selectedcontent-multiple/selectedness-expected.txt
A LayoutTests/fast/forms/select/selectedcontent-multiple/selectedness.html
A LayoutTests/fast/forms/select/selectedcontent-multiple/style-expected.txt
A LayoutTests/fast/forms/select/selectedcontent-multiple/style.html
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/CMakeLists.txt
M Source/WebCore/DerivedSources-input.xcfilelist
M Source/WebCore/DerivedSources.make
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/css/selectMultipleSelectedContent.css
M Source/WebCore/html/HTMLOptionElement.cpp
M Source/WebCore/html/HTMLOptionElement.h
M Source/WebCore/html/HTMLSelectElement.cpp
M Source/WebCore/html/HTMLSelectElement.h
M Source/WebCore/html/HTMLSelectedContentElement.cpp
M Source/WebCore/html/HTMLSelectedContentElement.h
M Source/WebCore/style/UserAgentStyle.cpp
M Source/WebCore/style/UserAgentStyle.h
Log Message:
-----------
Multi-select <selectedcontent> prototype
https://bugs.webkit.org/show_bug.cgi?id=325127
rdar://188889366
Reviewed by Ryosuke Niwa.
With the new HTMLEnhancedSelectMultipleSelectedContentEnabled preference, every
selectedcontent element of a select element with the multiple attribute holds a
clone of each option in the select's list of options, including the option
element itself. A clone is selected, and therefore matches :checked, when its
option is selected, and a new user agent stylesheet does not display the clones
that do not match :checked.
So that the clones do not become options of the select, a selectedcontent
element
now ends both the list of options and the search for an option's nearest
ancestor
select. That applies to select elements without the multiple attribute too.
The options are cloned when a selectedcontent element is inserted, when the
multiple attribute is added, when the select element is done parsing, and in a
microtask after an option is inserted, removed, or moved within the select. That
microtask is coalesced, so inserting many options clones them once. Each clone
remembers the option it was cloned from, which lets a change in selectedness
update the clones in place, without mutating the selectedcontent element.
Caveats:
* The attributes of an option are cloned as well, and the clones come first in
tree order, so getElementById() and querySelector() return a clone rather than
the option.
* The clones do not follow changes to the attributes or children of their option
until the list of options changes.
* Restoring form state does not update the clones, just as it does not update
selectedcontent for a select element without the multiple attribute.
Tests: fast/forms/select/selectedcontent-multiple/clones.html
fast/forms/select/selectedcontent-multiple/option-list-changes.html
fast/forms/select/selectedcontent-multiple/picker.html
fast/forms/select/selectedcontent-multiple/rendering.html
fast/forms/select/selectedcontent-multiple/selectedness.html
fast/forms/select/selectedcontent-multiple/style.html
Canonical link: https://commits.webkit.org/322696@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications