Skip to content

Commit

Permalink
Bug 1913821 [wpt PR 47670] - Fix dir=auto traversal exclusions to app…
Browse files Browse the repository at this point in the history
…ly to assigned nodes in a slot., a=testonly

Automatic update from web-platform-tests
Fix dir=auto traversal exclusions to apply to assigned nodes in a slot.

This fixes Chromium code and web platform tests to match half of the
spec update in whatwg/html#10488 and
whatwg/html#10561 .  Prior to this change (in
both spec and Chromium implementation) subtrees that were intended to be
excluded from dir=auto traversal were not being excluded if they were an
assigned node in a slot with dir=auto (which has a special traversal to
traverse in the order of the assigned nodes, despite the general
traversal being on the dom tree and not the flat tree).

This fix is behind the DirAutoFixSlotExclusions flag in case we need to
disable it.

This also updates the test for bdi elements to only check for bdi
elements in the HTML namespace.

Bug: 576815, 352191350
Change-Id: I58a3bef05d27ba83a7e6b8e34d7bba74a8e0a482
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5796604
Reviewed-by: Di Zhang <[email protected]>
Commit-Queue: David Baron <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1343841}

--

wpt-commits: 24bea5f38d235db99296614c07bcab105825b6f8
wpt-pr: 47670
  • Loading branch information
dbaron authored and moz-wptsync-bot committed Aug 21, 2024
1 parent 710c731 commit e10b821
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,9 @@ test(() => {
<slot dir=auto></slot>
`);
let slot = shadow.querySelector("slot");
assert_equals(html_direction(slot), "rtl");
let inp = tree.querySelector("input");
inp.value = "abc";
assert_equals(html_direction(slot), "ltr");
tree.remove();
}, 'dir=auto slot is updated by text in value of input element children');
}, 'dir=auto slot is not affected by text in value of input element children');

test(() => {
let [tree, shadow] = setup_tree(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@
let div = tree.querySelector("#root");
assert_equals(html_direction(div), "ltr");
let slot = shadow.querySelector("slot");
assert_equals(html_direction(slot), "rtl");
assert_equals(html_direction(slot), "ltr");
tree.remove();
}, 'dir=auto slot ignores dir attribute of assigned nodes');
}, 'dir=auto slot ignores assigned nodes with dir attribute');

test(() => {
let [tree, shadow] = setup_tree(`
Expand All @@ -188,9 +188,9 @@
<slot dir="auto"></slot>
`);
let slot = shadow.querySelector("slot");
assert_equals(html_direction(slot), "rtl");
assert_equals(html_direction(slot), "ltr");
tree.remove();
}, 'dir=auto slot considers text in bdi assigned nodes');
}, 'dir=auto slot ignores text in bdi assigned nodes');

test(() => {
let [tree, shadow] = setup_tree(`
Expand All @@ -205,13 +205,13 @@
let inp = tree.querySelector("input");
assert_equals(html_direction(inp), "ltr");
let slot = shadow.querySelector("slot");
assert_equals(html_direction(slot), "rtl");
assert_equals(html_direction(slot), "ltr");
tree.remove();

[tree, shadow] = setup_tree(`
<div>
<div id=root>
<input value=" ">
<input value="a">
اختبر
</div>
</div>
Expand All @@ -221,8 +221,8 @@
inp = tree.querySelector("input");
assert_equals(html_direction(inp), "ltr");
slot = shadow.querySelector("slot");
assert_equals(html_direction(slot), "ltr", "no strong character in value counts as ltr");
assert_equals(html_direction(slot), "rtl");
tree.remove();
}, 'dir=auto slot considers text in value of input element children');
}, 'dir=auto slot ignores text in value of input element children');

</script>

0 comments on commit e10b821

Please sign in to comment.