From e1fa89b2ee3ed2f8611fefedd9261d2f242248e2 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Mon, 19 Feb 2024 21:53:49 +0000 Subject: [PATCH] Bug 1880577 [wpt PR 44621] - Make dir=auto elements without strong characters ltr (rather than inheriting)., a=testonly Automatic update from web-platform-tests Make dir=auto elements without strong characters ltr (rather than inheriting). This reverts (conditioned on a new DirAutoNoInheritance flag) a previous change from https://crrev.com/c4557b863d101826932f33757e9398e7fca056c9 and makes it so that dir=auto elements never inherit directionality from their parent. Instead, when no strong characters are present, they have LTR directionality, as we did before. Reverting to our old behavior (and reverting the relevant test to its old state) seems like the best option given the discussion in https://github.com/whatwg/html/issues/10097 . Once this ships to stable we can remove the mechanisms used to support that inheritance. The changes in html/dom/elements/global-attributes/dir_auto-N-EN.html and its reference are a direct revert of the prior test change in the CL above. The changes in bdi-auto-dir-default.html and bdi-dir-default-to-auto.html are reverting a newer test change from https://crrev.com/4278cdb00ac4e727c1123e5eb4aba86509e87c0b . The new dir-shadow-42 test is a version of dir-shadow-41 with the directions swapped, to make sure things are tested more thoroughly. Fixed: 41494751 Bug: 576815 Change-Id: I68b36a1fc19a0553f582fdf2fd02a94d6e633686 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5302287 Commit-Queue: David Baron Commit-Queue: Di Zhang Auto-Submit: David Baron Reviewed-by: Di Zhang Cr-Commit-Position: refs/heads/main@{#1261442} -- wpt-commits: 9630591d607ac18d6572602cf0f1ba5129fe9954 wpt-pr: 44621 --- .../dom/elements/global-attributes/dir-assorted.window.js | 5 +++-- .../dom/elements/global-attributes/dir-shadow-41-ref.html | 2 +- .../{dir-shadow-41-ref.html => dir-shadow-42-ref.html} | 7 ++++--- .../{dir-shadow-41-ref.html => dir-shadow-42.html} | 15 ++++++++++++--- .../dom/elements/global-attributes/dir_auto-N-EN-ref.html | 6 +++--- .../dom/elements/global-attributes/dir_auto-N-EN.html | 4 ++-- .../the-bdi-element/bdi-auto-dir-default.html | 4 ++-- 7 files changed, 27 insertions(+), 16 deletions(-) copy testing/web-platform/tests/html/dom/elements/global-attributes/{dir-shadow-41-ref.html => dir-shadow-42-ref.html} (76%) copy testing/web-platform/tests/html/dom/elements/global-attributes/{dir-shadow-41-ref.html => dir-shadow-42.html} (52%) diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js index 0d4e4b82d9b9..2017269f0bdf 100644 --- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js +++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js @@ -90,10 +90,11 @@ for (const bdi_test of [ { markup: "", expected: "rtl", desc: "dir=rtl empty" }, { markup: "A", expected: "ltr", desc: "dir=auto with LTR contents" }, { markup: "\u05d0", expected: "rtl", desc: "dir=auto with RTL contents" }, - { markup: "", expected: "parent", desc: "dir=auto empty" }, + { markup: "", expected: "ltr", desc: "dir=auto empty" }, + { markup: "123", expected: "ltr", desc: "dir=auto numbers" }, { markup: "A", expected: "ltr", desc: "no dir attribute with LTR contents" }, { markup: "\u05d0", expected: "rtl", desc: "no dir attribute with RTL contents" }, - { markup: "", expected: "parent", desc: "no dir attribute empty" }, + { markup: "", expected: "ltr", desc: "no dir attribute empty" }, ]) { for (const parent_dir of [ "ltr", "rtl" ]) { test(() => { diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html index b52e08df20e8..79b844edbe51 100644 --- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html +++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html @@ -18,7 +18,7 @@ span {border: 1px solid silver;}

`dir=rtl` on a div in the shadow tree, `dir=ltr` on the shadow host, no slotted text in the light or dark trees

-

The HTML direction / computed CSS `direction` value is: rtl / rtl (on the slot).

+

The HTML direction / computed CSS `direction` value is: ltr / ltr (on the slot).

diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42-ref.html similarity index 76% copy from testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html copy to testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42-ref.html index b52e08df20e8..8ea110024600 100644 --- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html +++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42-ref.html @@ -4,6 +4,7 @@ [dir] and shadow slots: dir=ltr on a div in the shadow tree, dir=rtl on the shadow host, no slotted text in the light or dark trees + @@ -16,9 +17,9 @@ span {border: 1px solid silver;} -

`dir=rtl` on a div in the shadow tree, `dir=ltr` on the shadow host, no slotted text in the light or dark trees

-
-

The HTML direction / computed CSS `direction` value is: rtl / rtl (on the slot).

+

`dir=ltr` on a div in the shadow tree, `dir=rtl` on the shadow host, no slotted text in the light or dark trees

+
+

The HTML direction / computed CSS `direction` value is: ltr / ltr (on the slot).

diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42.html similarity index 52% copy from testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html copy to testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42.html index b52e08df20e8..b9697678cbc7 100644 --- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html +++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42.html @@ -4,21 +4,30 @@ [dir] and shadow slots: dir=ltr on a div in the shadow tree, dir=rtl on the shadow host, no slotted text in the light or dark trees + + + -

`dir=rtl` on a div in the shadow tree, `dir=ltr` on the shadow host, no slotted text in the light or dark trees

-
-

The HTML direction / computed CSS `direction` value is: rtl / rtl (on the slot).

+

`dir=ltr` on a div in the shadow tree, `dir=rtl` on the shadow host, no slotted text in the light or dark trees

+
+

The HTML direction / computed CSS `direction` value is:

+ + diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html index 0d938b2e168b..496d699d73c7 100644 --- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html +++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html @@ -10,7 +10,7 @@ + If there is no strong character, as in this test, the direction defaults to LTR." />