Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b35e6240cfc8c5496fe7c9fc8eecdfe018d892f5
https://github.com/WebKit/WebKit/commit/b35e6240cfc8c5496fe7c9fc8eecdfe018d892f5
Author: Anne van Kesteren <[email protected]>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
M LayoutTests/TestExpectations
M LayoutTests/fast/forms/ios/select-menulist-text-align-chevron-padding.html
M LayoutTests/fast/forms/ios/select-multiple-button-text-updates.html
M
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-label-appearance-expected.html
M
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-label-appearance-ref.html
M
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-label-appearance.html
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button-mutation-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button-mutation-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button-mutation.html
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button.html
M
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/w3c-import.log
M Source/WebCore/css/html.css
M Source/WebCore/html/HTMLButtonElement.cpp
M Source/WebCore/html/HTMLButtonElement.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/html/shadow/SelectFallbackButtonElement.cpp
M Source/WebCore/rendering/RenderMenuList.cpp
Log Message:
-----------
Support <button> in <select>'s native appearance
https://bugs.webkit.org/show_bug.cgi?id=315900
rdar://178876621
Reviewed by Ryosuke Niwa.
As the <button> element takes over the function of the <select>'s button
text, it should be supported regardless of appearance value. This gets a
little involved as the native appearance of <select> renders as wide as
the widest option, but now the button text can depend on the option
through the <selectedcontent> element.
With native appearance the author <button> is not rendered and the select
fallback button text is, which is the reverse of base appearance.
Assigning the author <button> to a different slot per appearance cannot
express that: appearance is only known after style resolution, and
invalidating slot assignment from didRecalcStyle() changes the flat tree
and tears down renderers while the tree resolver is walking it. So the
shadow tree has to be the same for both appearances.
The author <button>, if any, is assigned to the button slot in both
appearances, as before. Since the select fallback button text is no
longer the slot's fallback content, it is still rendered when the slot
has an assigned node, and SelectFallbackButtonElement's
resolveCustomStyle() gives it display:none for base appearance with an
author <button>.
Its text is the author <button>'s text when there is one, collected the
way <option> text is. RenderMenuList::updateOptionsWidth() sizes the
<select> to the widest such text over all options, plus over no option
being selected, since <selectedcontent> is what makes it depend on the
selection.
HTMLButtonElement::childrenChanged() invalidates both, matching what
HTMLOptionElement::childrenChanged() already does for <option>.
The user agent stylesheet no longer excludes the multiple attribute from
giving the author <button> display:contents, matching the HTML standard.
That only affects platforms where a <select multiple> is a dropdown box,
where it would otherwise render both the <button> and the select fallback
button text.
Since the select fallback button text is no longer inside the button slot,
childShouldCreateRenderer() has to exclude it for a base appearance list
box explicitly, where excluding the slot used to be enough.
HTMLSelectedContentElement::childrenChanged() invalidates the button text,
since the <selectedcontent> element's contents reflect into it. That
covers both overloads of updateSelectedContent() as well as the contents
being changed by script.
select-multiple-button-text-updates.html and
select-menulist-text-align-chevron-padding.html look for the select
fallback button text next to the button slot rather than inside it.
Tests:
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-label-appearance.html
imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button-mutation.html
imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/select-appearance-auto-button.html
Canonical link: https://commits.webkit.org/322716@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications