Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: afde8413c9cc455c9b63a26cc2bc56e4de28a5f4
https://github.com/WebKit/WebKit/commit/afde8413c9cc455c9b63a26cc2bc56e4de28a5f4
Author: Anne van Kesteren <[email protected]>
Date: 2026-10-04 (Sun, 04 Oct 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-dir-invalidation-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-dir-invalidation-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-dir-invalidation.html
A
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-optgroup-dir-invalidation-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-optgroup-dir-invalidation-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-optgroup-dir-invalidation.html
M
LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/w3c-import.log
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/select-insertion-inherited-style-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/select-insertion-inherited-style.html
M
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/w3c-import.log
M Source/WebCore/html/shadow/SelectFallbackButtonElement.cpp
Log Message:
-----------
<select> computes its selected option's style from outdated ancestor styles
https://bugs.webkit.org/show_bug.cgi?id=326092
rdar://189109118
Reviewed by Ryosuke Niwa.
SelectFallbackButtonElement::resolveCustomStyle() copies direction and
unicode-bidi from the selected option. The popover holding the options
comes after the button slot in the shadow tree, so style resolution has
not reached the option at that point, and options have no renderer
unless a base appearance picker is open. The button therefore resolved
the option's style on demand through computedStyleForEditability(),
which starts from the existing styles of the option's ancestors.
Before 306393@main RenderMenuList did that outside of style resolution.
Since then it happens during style resolution, where those styles are
out of date: new styles only reach the renderers once the whole tree is
resolved, so elements inserted since the last update have no style yet
and the others still have their old one. The option's style was thus
computed from an old ancestor style and cached on every element in
between, including ones style resolution had already passed. As those
caches take precedence over renderer styles, getComputedStyle() returned
old values for the select and its ancestors up to the inserted subtree's
root until they were restyled, and so did anything reading the select's
existingComputedStyle(), such as usesBaseAppearancePicker(). When an
ancestor's direction changed, the fallback button ended up with the
previous direction.
Instead resolve the option's style starting from the host style passed
to resolveCustomStyle(), through the option's composed tree ancestors
below the select, without caching anything. That costs at least three
style resolutions each time the button is resolved: the popover, its
slot and the option. A dir change on the root element already restyles
6+N elements of a select with N options.
Tests:
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-dir-invalidation-ref.html
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-dir-invalidation.html
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-optgroup-dir-invalidation-ref.html
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/select-optgroup-dir-invalidation.html
imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/select-insertion-inherited-style.html
Canonical link: https://commits.webkit.org/322665@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications