Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4977821844cb9aefdea657ead8c65921bc8b93b6
https://github.com/WebKit/WebKit/commit/4977821844cb9aefdea657ead8c65921bc8b93b6
Author: Chris Dumez <[email protected]>
Date: 2026-04-15 (Wed, 15 Apr 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window.js
M
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir-slots-directionality-expected.txt
M Source/WebCore/dom/Element.cpp
M Source/WebCore/dom/ElementTextDirection.cpp
Log Message:
-----------
dir=auto on slot elements should update when slotted content changes
https://bugs.webkit.org/show_bug.cgi?id=312240
Reviewed by Ryosuke Niwa.
Fix several issues with dir=auto directionality on slot elements in shadow DOM:
1. When text changes in slotted content triggered an ancestor dir=auto
recomputation, updateEffectiveTextDirectionOfDescendants would skip slot
elements with dir=auto (treating them like dir=ltr/rtl). Now recompute
their direction since it depends on slotted content that may have changed.
2. When no light DOM dir=auto ancestor exists
(selfOrPrecedingNodesAffectDirAuto
is false), text changes in slotted elements had no path to notify a
dir=auto
slot. Now Element::childrenChanged walks up to find an assigned slot and
updates it.
3. computeAutoDirectionality would use an input element's value for
directionality even when the input didn't have dir=auto. Per spec, the
value
should only be used when the element has dir=auto.
No new tests, rebaselined existing WPT test.
*
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window.js:
Resync test from upstream and rebaseline now that all subtests are passing.
Firefox and Chrome were already passing this whole test so this aligns
our havior with them.
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::childrenChanged):
Walk up to find assigned dir=auto slot when selfOrPrecedingNodesAffectDirAuto
is false.
* Source/WebCore/dom/ElementTextDirection.cpp:
(WebCore::computeAutoDirectionality):
Recompute dir=auto slot elements instead of skipping them.
(WebCore::updateEffectiveTextDirectionOfDescendants):
Only use form control value when the element has dir=auto.
Canonical link: https://commits.webkit.org/311325@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications