Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ecfa592149003e3c0e9f15b1802de6b580a0ec3b
https://github.com/WebKit/WebKit/commit/ecfa592149003e3c0e9f15b1802de6b580a0ec3b
Author: Ahmad Saleem <[email protected]>
Date: 2026-10-12 (Mon, 12 Oct 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/dir-bdi-dynamic-ancestor-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/dir-bdi-dynamic-ancestor.html
M Source/WebCore/dom/ElementTextDirection.cpp
Log Message:
-----------
:dir() of a <bdi> without a dir attribute takes its ancestor's direction when
the ancestor's dir changes
https://bugs.webkit.org/show_bug.cgi?id=326761
rdar://189472957
Reviewed by Chris Dumez.
This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.
When an element's dir attribute changes,
updateEffectiveTextDirectionOfDescendants()
propagates the new direction to its descendants, stopping only at elements
whose dir
attribute is in a valid state. A <bdi> element with no dir attribute behaves as
dir=auto, so its directionality comes from its own contents, not from its
parent.
Because the walk didn't stop at it, the <bdi> and its subtree took the
ancestor's
direction and matched the wrong :dir() pseudo-class.
updateHasDirAutoFlagForSubtree()
already skips <bdi> elements for this reason.
Skip <bdi> elements and their subtrees in
updateEffectiveTextDirectionOfDescendants().
Test:
imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/dir-bdi-dynamic-ancestor.html
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/dir-bdi-dynamic-ancestor-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/dir-bdi-dynamic-ancestor.html:
Added.
* Source/WebCore/dom/ElementTextDirection.cpp:
(WebCore::updateEffectiveTextDirectionOfDescendants):
Canonical link: https://commits.webkit.org/323439@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications