Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1854720 [wpt PR 42030] - Rewrite (behind a flag) HTML direction i…
…nheritance and invalidation for dir=auto, a=testonly Automatic update from web-platform-tests Rewrite (behind a flag) HTML direction inheritance and invalidation for dir=auto This rewrites significant aspects of inheritance of HTML direction (which affects the unshipped :dir() selector and also the shipped dirname attribute), including its invalidation, to match current spec proposals regarding how the inheritance operates on Shadow DOM, and to improve invalidation in response to dynamic changes. Inheritance of direction now operates on the node tree, except that shadow roots and slots both inherit from the shadow host. It previously operated on the flat tree. This change should not affect the computed values of the CSS direction property, since the HTML direction is only mapped to CSS direction on elements where the HTML direction is not inherited. This also restructures the shadow tree-related invalidation code for dir=auto to match the changes implemented in https://crrev.com/26b1b30268b7af4f0e44f298c10338a65e656f40 , which made dir=auto operate on the node tree, and the additional behavior implemented in https://crrev.com/6abc9cbde67c0700be364c7aab86cb29188c7d5d that implemented special rules (looking at slotted children) for <slot dir=auto>. Certain text-like form controls also have similar special rules in which they look at their value. This change can affect the computed values of the CSS direction property when the direction computed by dir=auto is different. The invalidation code for these two distinct things was (in the old code) too tied together to cleanly separate these changes. The reason these changes are the next step of work is because they change (when CSSPseudoDirEnabled) the one caller that passed a stay_within parameter to CalculateAndAdjustAutoDirectionality that is different from this; this enables further (smaller) refactoring that I believe will be needed to fix the failure of external/wpt/shadow-dom/directionality/dir-shadow-41.html in the still-unlanded WPT PR at web-platform-tests/wpt#29820 . I believe this existing using of stay_within does not make sense; it doesn't make sense to try to partially traverse the descendants of a dir=auto element with a different termination point. The traversal of a dir=auto element should always start at its start and should terminate at the first strong character or the end of the contents that should influence the dir=auto. (There are cases where the interaction of the stay_within and the use of NodeTraversal/FlatTreeTraversal meant that the stay_within parameter was missed entirely and the tree was searched beyond the contents that should be; this is a step towards the refactoring needed to fix that.) This is based on the proposed behavior described in: whatwg/html#3699 (comment) which is in the process of being specified in: whatwg/html#9166 whatwg/html#9452 whatwg/html#9554 Bug: 576815 Change-Id: Ic31a3f801f64042a3b4979afdc4e141f45e3b228 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4811757 Reviewed-by: Di Zhang <dizhanggchromium.org> Commit-Queue: David Baron <dbaronchromium.org> Cr-Commit-Position: refs/heads/main{#1199647} -- wpt-commits: ce9459e524221bf8f2b7ba04bc21af109a89eb14 wpt-pr: 42030 UltraBlame original commit: aec4219a5821fe2ff388eb0d57bc1783df7e5eb0
- Loading branch information