Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make computation of directionality account for Shadow DOM. #9796

Merged
merged 5 commits into from
Oct 6, 2023

Conversation

dbaron
Copy link
Member

@dbaron dbaron commented Sep 26, 2023

This specifies (with some additional detail) the proposal in #3699 (comment) . This changes three things:

  • the inheritance of directionality
  • the inheritance of language
  • the computation of dir=auto to account for Shadow DOM.

This builds on the work in #9452 and #9554 to refactor this section, and builds on work by Brian Kardell, Eric Meyer, and others in #7424 and in #9166 and work by fantasai, rniwa, smaug, MyIdShin, Brian Kardell, and others in #3699.

Closes #9166.

Fixes #3699.

Some aspects of the PR template are copied from #9166.

(See WHATWG Working Mode: Changes for more details.)


/dom.html ( diff )
/rendering.html ( diff )

This specifies (with some additional detail) the proposal in
whatwg#3699 (comment) .
This changes three things:
 * the inheritance of directionality
 * the inheritance of language
 * the computation of dir=auto
to account for Shadow DOM.

This builds on the work in whatwg#9452 and whatwg#9554 to refactor this section, and
builds on work by Brian Kardell, Eric Meyer, and others in whatwg#7424 and
in whatwg#9166 and work by fantasai, rniwa, smaug, MyIdShin, Brian Kardell,
and others in whatwg#3699.

Closes whatwg#9166.

Fixes whatwg#3699.
@dbaron
Copy link
Member Author

dbaron commented Sep 26, 2023

This PR is a revised version of #9166 based on the refactoring mentioned above. I'm sure there are some edge cases that come out differently. Another thing that I intended to be different is what is described in #3699 (comment) .

One other thing that I noticed while writing this is that the rules for processing text directionality are slightly different for an input or textarea value versus text content -- when processing a value the result is ltr when there is a non-empty string that contains no characters of classes L, AL, or R, but falls back to the parent only when the string is empty. But for processing text nodes, the computation falls back to the parent whenever there are no characters of classes L, AL, or R.

I'm hoping at least some of @fantasai @rniwa @bkardell and @annevk are able to review. (I can't assign reviewers, it seems.)

@dbaron
Copy link
Member Author

dbaron commented Sep 26, 2023

One other review note is that the way I ended up needing to use the concept of "auto directionality", it ended up easier to redefine it so that it can be null if no directionality is computed rather than including the fallback to parent directionality, and the user of the "auto directionality" is now responsible for replacing null with the parent directionality (or, in some new cases, continuing on to the next element or similar).

@dbaron
Copy link
Member Author

dbaron commented Sep 26, 2023

Also adding @smaug---- for review and feedback on implementer interest from Mozilla.

@annevk annevk added addition/proposal New features or enhancements topic: shadow Relates to shadow trees (as defined in DOM) i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. labels Sep 27, 2023
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this reads a lot better! Thanks for paying attention to the style guide too, that helps a lot. I've mainly focused on the editorial aspects in this review, but I can do another pass later trying to fully understand all the semantics.

The main thing that needs improving is the language section as that currently lacks changes to the implementer requirements for determining the language of a node.

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 27, 2023
When dir=auto fails to find text with strong directionality (or a <slot>
element) to determine the directionality of the element, it should fall
back to the directionality that it would have inherited from its parent
(or, for <slot>, its shadow host) rather than falling back to ltr.

This requires updating directionality invalidation to account for the
possibility that elements with dir=auto can inherit directionality.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796

This is one of two changes needed to fix the failure of:
external/wpt/html/dom/elements/global-attributes/dir-shadow-41.html
in the still-unlanded WPT PR at
#29820

Bug: 576815
Change-Id: I9fc7c85875074ad41704ab45ec70c7632c3f8d31
@dbaron
Copy link
Member Author

dbaron commented Sep 27, 2023

Thanks for the review, @annevk. I think I've addressed all of your comments. Two notes:

  • the only one that was somewhat involved was the first one, regarding fixing the implementer requirements for language calculation. I hope this worked out reasonably. I left a somewhat long "Otherwise" clause at the end of the switch, using existing spec text, because splitting it up felt a bit odd, although not splitting it up also feels a bit odd.
  • The suggested <span data-x="concept-tree-root">root</span> didn't work, but <span>root</span> works fine.

@dbaron dbaron requested a review from annevk September 27, 2023 20:36
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 28, 2023
When dir=auto fails to find text with strong directionality (or a <slot>
element) to determine the directionality of the element, it should fall
back to the directionality that it would have inherited from its parent
(or, for <slot>, its shadow host) rather than falling back to ltr.

This requires updating directionality invalidation to account for the
possibility that elements with dir=auto can inherit directionality.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796

This is one of two changes needed to fix the failure of:
external/wpt/html/dom/elements/global-attributes/dir-shadow-41.html
in the still-unlanded WPT PR at
#29820

Bug: 576815
Change-Id: I9fc7c85875074ad41704ab45ec70c7632c3f8d31
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, couple more nits and suggestions.

source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
@dbaron dbaron requested a review from annevk September 28, 2023 14:15
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. It would definitely be good for either @fantasai or @rniwa to sign off and maybe @domenic wants to do an editorial pass as well since he helped out with earlier iterations.

source Outdated Show resolved Hide resolved
namespace</span></span>, and the <code data-x="attr-lang">lang</code> attribute in no namespace
must be <span data-x="ignore">ignored</span> for the purposes of determining the element's
language.</p>
<p>To determine the <dfn export for="Node">language</dfn> of a node, user agents must use the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The alternative way to approach this would be to turn this into a set of steps as well, but I think this is okay for now until we sort out the definitive requirements for the last "Otherwise" in the issue you opened.)

source Outdated Show resolved Hide resolved
aarongable pushed a commit to chromium/chromium that referenced this pull request Sep 28, 2023
When dir=auto fails to find text with strong directionality (or a <slot>
element) to determine the directionality of the element, it should fall
back to the directionality that it would have inherited from its parent
(or, for <slot>, its shadow host) rather than falling back to ltr.

This requires updating directionality invalidation to account for the
possibility that elements with dir=auto can inherit directionality.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796

This is one of two changes needed to fix the failure of:
external/wpt/html/dom/elements/global-attributes/dir-shadow-41.html
in the still-unlanded WPT PR at
web-platform-tests/wpt#29820

Bug: 576815
Change-Id: I9fc7c85875074ad41704ab45ec70c7632c3f8d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4805163
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1202893}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 28, 2023
When dir=auto fails to find text with strong directionality (or a <slot>
element) to determine the directionality of the element, it should fall
back to the directionality that it would have inherited from its parent
(or, for <slot>, its shadow host) rather than falling back to ltr.

This requires updating directionality invalidation to account for the
possibility that elements with dir=auto can inherit directionality.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796

This is one of two changes needed to fix the failure of:
external/wpt/html/dom/elements/global-attributes/dir-shadow-41.html
in the still-unlanded WPT PR at
#29820

Bug: 576815
Change-Id: I9fc7c85875074ad41704ab45ec70c7632c3f8d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4805163
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1202893}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 28, 2023
When dir=auto fails to find text with strong directionality (or a <slot>
element) to determine the directionality of the element, it should fall
back to the directionality that it would have inherited from its parent
(or, for <slot>, its shadow host) rather than falling back to ltr.

This requires updating directionality invalidation to account for the
possibility that elements with dir=auto can inherit directionality.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796

This is one of two changes needed to fix the failure of:
external/wpt/html/dom/elements/global-attributes/dir-shadow-41.html
in the still-unlanded WPT PR at
#29820

Bug: 576815
Change-Id: I9fc7c85875074ad41704ab45ec70c7632c3f8d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4805163
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1202893}
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 30, 2023
…auto and descendant directionality to consider non-HTML elements., a=testonly

Automatic update from web-platform-tests
Fix :dir() selector and updates for dir=auto and descendant directionality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

Bug: 576815
Change-Id: I57323aeda8850f382756cd36b3717d34e8911f5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4908695
Commit-Queue: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1204886}

--

wpt-commits: 9c46bae54706a175a99a9f127a4a8065704c2cc2
wpt-pr: 42315

UltraBlame original commit: 28cd492bf06128adefbd727f510e3773c4c531ab
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 30, 2023
…rees., a=testonly

Automatic update from web-platform-tests
Add test for lang attribute and shadow trees. (#42364)

This tests the lang attribute changes in whatwg/html#9796.  It replaces
the lang attribute tests from #29820.

Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: 3538a9f3031846a83f95f9c514388fc4f35437fc
wpt-pr: 42364

UltraBlame original commit: d4a31b5d4e9c6e85c5d6072481fd42108b885857
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 30, 2023
…auto and descendant directionality to consider non-HTML elements., a=testonly

Automatic update from web-platform-tests
Fix :dir() selector and updates for dir=auto and descendant directionality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

Bug: 576815
Change-Id: I57323aeda8850f382756cd36b3717d34e8911f5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4908695
Commit-Queue: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1204886}

--

wpt-commits: 9c46bae54706a175a99a9f127a4a8065704c2cc2
wpt-pr: 42315

UltraBlame original commit: 28cd492bf06128adefbd727f510e3773c4c531ab
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 30, 2023
…rees., a=testonly

Automatic update from web-platform-tests
Add test for lang attribute and shadow trees. (#42364)

This tests the lang attribute changes in whatwg/html#9796.  It replaces
the lang attribute tests from #29820.

Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: 3538a9f3031846a83f95f9c514388fc4f35437fc
wpt-pr: 42364

UltraBlame original commit: d4a31b5d4e9c6e85c5d6072481fd42108b885857
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 1, 2023
…ots-directionality.html., a=testonly

Automatic update from web-platform-tests
Remove tentative from filename of dir-slots-directionality.html.

whatwg/html#9796 has landed, so this is now
specified, and the test no longer should be labeled as tentative.

Bug: 576815
Change-Id: Ica2371532c761da678c38237e4bdd9b991388f1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4948050
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1210887}

--

wpt-commits: f84c5af86a97af47983ec10ec6b56b905692d8e6
wpt-pr: 42583
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Nov 2, 2023
…ots-directionality.html., a=testonly

Automatic update from web-platform-tests
Remove tentative from filename of dir-slots-directionality.html.

whatwg/html#9796 has landed, so this is now
specified, and the test no longer should be labeled as tentative.

Bug: 576815
Change-Id: Ica2371532c761da678c38237e4bdd9b991388f1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4948050
Auto-Submit: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1210887}

--

wpt-commits: f84c5af86a97af47983ec10ec6b56b905692d8e6
wpt-pr: 42583
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 7, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
Give <slot> element default unicode-bidi: isolate style.

This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.

This implements a part of the behavior described in:
whatwg/html#3699 (comment)
which has been specified in:
whatwg/html#9554
whatwg/html#9796

Bug: 576815
Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 7, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> Reviewed-by: Di Zhang <dizhangg@chromium.org>
> Commit-Queue: David Baron <dbaron@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdr@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this pull request Nov 7, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
Give <slot> element default unicode-bidi: isolate style.

This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.

This implements a part of the behavior described in:
whatwg/html#3699 (comment)
which has been specified in:
whatwg/html#9554
whatwg/html#9796

Bug: 576815
Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this pull request Nov 7, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> Reviewed-by: Di Zhang <dizhangg@chromium.org>
> Commit-Queue: David Baron <dbaron@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdr@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaron@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 8, 2023
…ots-directionality.html., a=testonly

Automatic update from web-platform-tests
Remove tentative from filename of dir-slots-directionality.html.

whatwg/html#9796 has landed, so this is now
specified, and the test no longer should be labeled as tentative.

Bug: 576815
Change-Id: Ica2371532c761da678c38237e4bdd9b991388f1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4948050
Auto-Submit: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1210887}

--

wpt-commits: f84c5af86a97af47983ec10ec6b56b905692d8e6
wpt-pr: 42583

UltraBlame original commit: 91728099be29f0ec62e88282bc45515c61b4ac7c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 8, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
Give <slot> element default unicode-bidi: isolate style.

This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.

This implements a part of the behavior described in:
whatwg/html#3699 (comment)
which has been specified in:
whatwg/html#9554
whatwg/html#9796

Bug: 576815
Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
Reviewed-by: Chris Harrelson <chrishtrchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717

UltraBlame original commit: c1d0594b7c2341b1247e69987405d8038e57308b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 8, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtrchromium.org>
> Reviewed-by: Di Zhang <dizhanggchromium.org>
> Commit-Queue: David Baron <dbaronchromium.org>
> Cr-Commit-Position: refs/heads/main{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdrchromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Philip Rogers <pdrchromium.org>
Cr-Commit-Position: refs/heads/main{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746

UltraBlame original commit: 4f46a8fcb456fa55fd784b0714da59ad7b206c79
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 8, 2023
…ots-directionality.html., a=testonly

Automatic update from web-platform-tests
Remove tentative from filename of dir-slots-directionality.html.

whatwg/html#9796 has landed, so this is now
specified, and the test no longer should be labeled as tentative.

Bug: 576815
Change-Id: Ica2371532c761da678c38237e4bdd9b991388f1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4948050
Auto-Submit: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1210887}

--

wpt-commits: f84c5af86a97af47983ec10ec6b56b905692d8e6
wpt-pr: 42583

UltraBlame original commit: 91728099be29f0ec62e88282bc45515c61b4ac7c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 8, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
Give <slot> element default unicode-bidi: isolate style.

This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.

This implements a part of the behavior described in:
whatwg/html#3699 (comment)
which has been specified in:
whatwg/html#9554
whatwg/html#9796

Bug: 576815
Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
Reviewed-by: Chris Harrelson <chrishtrchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717

UltraBlame original commit: c1d0594b7c2341b1247e69987405d8038e57308b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 8, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtrchromium.org>
> Reviewed-by: Di Zhang <dizhanggchromium.org>
> Commit-Queue: David Baron <dbaronchromium.org>
> Cr-Commit-Position: refs/heads/main{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdrchromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Philip Rogers <pdrchromium.org>
Cr-Commit-Position: refs/heads/main{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746

UltraBlame original commit: 4f46a8fcb456fa55fd784b0714da59ad7b206c79
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 8, 2023
…ots-directionality.html., a=testonly

Automatic update from web-platform-tests
Remove tentative from filename of dir-slots-directionality.html.

whatwg/html#9796 has landed, so this is now
specified, and the test no longer should be labeled as tentative.

Bug: 576815
Change-Id: Ica2371532c761da678c38237e4bdd9b991388f1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4948050
Auto-Submit: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1210887}

--

wpt-commits: f84c5af86a97af47983ec10ec6b56b905692d8e6
wpt-pr: 42583

UltraBlame original commit: 91728099be29f0ec62e88282bc45515c61b4ac7c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 8, 2023
…: isolate style., a=testonly

Automatic update from web-platform-tests
Give <slot> element default unicode-bidi: isolate style.

This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.

This implements a part of the behavior described in:
whatwg/html#3699 (comment)
which has been specified in:
whatwg/html#9554
whatwg/html#9796

Bug: 576815
Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
Reviewed-by: Chris Harrelson <chrishtrchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Cr-Commit-Position: refs/heads/main{#1214439}

--

wpt-commits: a79306e06659bde55be85c3af5c1d7d4a51c0cbd
wpt-pr: 42717

UltraBlame original commit: c1d0594b7c2341b1247e69987405d8038e57308b
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 8, 2023
…ode-bidi: isolate style.", a=testonly

Automatic update from web-platform-tests
Revert "Give <slot> element default unicode-bidi: isolate style."

This reverts commit 198d41cfd6eac5fd9ee34e6314e34f938b6d31b5.

Reason for revert: This reverts a change that was the first of two closely related changes.  Given that the other change, in https://crrev.com/c/4973701, turned out to have problems (and I haven't attempted to land it), I've proposed reverting both in the HTML spec at whatwg/html#9880.  I'm therefore reverting this (the first half) until the HTML spec discussion is sorted out.

Original change's description:
> Give <slot> element default unicode-bidi: isolate style.
>
> This is behind the RuntimeEnabledFeatures::CSSPseudoDirEnabled() flag.
>
> This implements a part of the behavior described in:
> whatwg/html#3699 (comment)
> which has been specified in:
> whatwg/html#9554
> whatwg/html#9796
>
> Bug: 576815
> Change-Id: Ice471838c7251fc69d87abfa723f3eef1a4c455a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4800075
> Reviewed-by: Chris Harrelson <chrishtrchromium.org>
> Reviewed-by: Di Zhang <dizhanggchromium.org>
> Commit-Queue: David Baron <dbaronchromium.org>
> Cr-Commit-Position: refs/heads/main{#1214439}

Bug: 576815
Change-Id: I0f52b30c345d4962a36a36e5d2651221db96bcde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974023
Reviewed-by: Philip Rogers <pdrchromium.org>
Bot-Commit: Rubber Stamper <rubber-stamperappspot.gserviceaccount.com>
Auto-Submit: David Baron <dbaronchromium.org>
Commit-Queue: Philip Rogers <pdrchromium.org>
Cr-Commit-Position: refs/heads/main{#1215009}

--

wpt-commits: 8cc01fc73b14dcbc92109574c26d85b25f5cfba0
wpt-pr: 42746

UltraBlame original commit: 4f46a8fcb456fa55fd784b0714da59ad7b206c79
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this pull request Dec 11, 2023
When dir=auto fails to find text with strong directionality (or a <slot>
element) to determine the directionality of the element, it should fall
back to the directionality that it would have inherited from its parent
(or, for <slot>, its shadow host) rather than falling back to ltr.

This requires updating directionality invalidation to account for the
possibility that elements with dir=auto can inherit directionality.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796

This is one of two changes needed to fix the failure of:
external/wpt/html/dom/elements/global-attributes/dir-shadow-41.html
in the still-unlanded WPT PR at
web-platform-tests#29820

Bug: 576815
Change-Id: I9fc7c85875074ad41704ab45ec70c7632c3f8d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4805163
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1202893}
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this pull request Dec 11, 2023
…ality to consider non-HTML elements.

This changes behavior only when the CSSPseudoDir flag is enabled.

This is based on the proposed behavior described in:
whatwg/html#3699 (comment)
which is in the process of being specified in:
whatwg/html#9554
whatwg/html#9796
and on the behavior specified in:
https://drafts.csswg.org/selectors-4/#the-dir-pseudo

Bug: 576815
Change-Id: I57323aeda8850f382756cd36b3717d34e8911f5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4908695
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204886}
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this pull request Dec 11, 2023
This tests the lang attribute changes in whatwg/html#9796.  It replaces
the lang attribute tests from web-platform-tests#29820.

Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
dbaron added a commit to dbaron/html that referenced this pull request Dec 19, 2023
In whatwg#9796 I refactored the term "auto directionality" to move the
fallback to the parent directionality out of the definition of "auto
directionality", since I needed the null result in one case to continue
a tree traversal rather than returning.

However, I missed fixing up one of the references to the term (should I
blame the line break?), leaving a case where the spec could define the
directionality of a <bdi> element as null.

This fixes that case, and converts the <ol> to a <dl class="switch">.
dbaron added a commit to dbaron/html that referenced this pull request Dec 19, 2023
In whatwg#9796 I refactored the term "auto directionality" to move the
fallback to the parent directionality out of the definition of "auto
directionality", since I needed the null result in one case to continue
a tree traversal rather than returning.

However, I missed fixing up one of the references to the term (should I
blame the line break?), leaving a case where the spec could define the
directionality of a <bdi> element as null.

This fixes that case, and converts the <ol> to a <dl class="switch">.
annevk pushed a commit that referenced this pull request Jan 9, 2024
In #9796 I refactored the term "auto directionality" to move the
fallback to the parent directionality out of the definition of "auto
directionality", since I needed the null result in one case to continue
a tree traversal rather than returning.

However, I missed fixing up one of the references to the term (should I
blame the line break?), leaving a case where the spec could define the
directionality of a <bdi> element as null.

This fixes that case, and converts the <ol> to a <dl class="switch">.

Tests: web-platform-tests/wpt#43896.
annevk pushed a commit that referenced this pull request Jan 24, 2024
As well as some of the corresponding changes to its directionality and language.

This reverts recent changes to the rendering section for the slot
element that I made recently in 1dc4c7557f5a4c879c1ce65b9cb59b91310bbf5
(PR #9796, fixing #3699). These changes had specified that all slot
elements, even those without a dir attribute, specify the direction and
unicode-bidi properties.

When I attempted to implement these changes, I discovered that they
broke a significant number of web-platform-tests, due to a pattern that
makes me suspect they would pose a compatibility problem. In
particular, specifying the CSS direction property for all slot elements
breaks inheritance of CSS direction into slotted elements, including
those in user-agent shadow DOM. (This makes a clearly visible change
when elements are implemented in terms of user-agent shadow DOM, which
probably is not intended.)

While I realize that the recommended practice is to specify the HTML dir
attribute rather than the CSS direction property, I believe the CSS
direction property is used enough that this is not acceptable.
(https://chromestatus.com/metrics/css/timeline/popularity/3 says the
property is used on around 40% of page loads. While the number of
interesting uses is probably substantially lower, it's also probably
still significant.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. topic: shadow Relates to shadow trees (as defined in DOM)
Development

Successfully merging this pull request may close these issues.

It is unclear how directionality should be inherited into Shadow DOM
4 participants