Fix the traversal for dir=auto handling on <slot> to traverse what was intended. [chromium/src : main]

0 views
Skip to first unread message

David Baron (Gerrit)

unread,
Sep 27, 2023, 3:25:07 PM9/27/23
to Di Zhang, blink-rev...@chromium.org, blink-...@chromium.org, David Baron

Attention is currently required from: Di Zhang.

David Baron would like Di Zhang to review this change.

View Change

Fix the traversal for dir=auto handling on <slot> to traverse what was intended.

The use of Traversal and FlatTreeTraversal for handling <slot dir=auto>,
prior to this change, starts from the first flat-tree slotted child of
the slot, and from there traverses potentially the entire rest of the
document, ignoring the stay_within argument to the function and the
slotting of children. This change fixes the traversal to traverse the
children slotted into the <slot> and their light dom descendants.

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
https://github.com/web-platform-tests/wpt/pull/29820

Bug: 576815
Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
---
M third_party/blink/renderer/core/html/html_element.cc
D third_party/blink/web_tests/external/wpt/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window-expected.txt
2 files changed, 41 insertions(+), 13 deletions(-)


To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
Gerrit-Change-Number: 4805164
Gerrit-PatchSet: 5
Gerrit-Owner: David Baron <dba...@chromium.org>
Gerrit-Reviewer: Di Zhang <dizh...@chromium.org>
Gerrit-Attention: Di Zhang <dizh...@chromium.org>

David Baron (Gerrit)

unread,
Sep 27, 2023, 3:25:12 PM9/27/23
to David Baron, blink-rev...@chromium.org, blink-...@chromium.org, Di Zhang, chromium...@chromium.org

Attention is currently required from: Di Zhang.

    To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
    Gerrit-Change-Number: 4805164
    Gerrit-PatchSet: 5
    Gerrit-Owner: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Di Zhang <dizh...@chromium.org>
    Gerrit-Attention: Di Zhang <dizh...@chromium.org>
    Gerrit-Comment-Date: Wed, 27 Sep 2023 19:25:03 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No

    Di Zhang (Gerrit)

    unread,
    Sep 27, 2023, 4:50:46 PM9/27/23
    to David Baron, blink-rev...@chromium.org, blink-...@chromium.org, chromium...@chromium.org

    Attention is currently required from: David Baron.

    View Change

    2 comments:

    • File third_party/blink/renderer/core/html/html_element.cc:

      • Patch Set #5, Line 2493: CHECK(!RuntimeEnabledFeatures::CSSPseudoDirEnabled() || this == stay_within);

        Add to TODO that once flag is removed, this function should only be called with self as stay_within (or remove this arg).

      • Patch Set #5, Line 2509: if (slotted_node->IsTextNode()) {

        Should this be calling `element->ShouldAutoDirUseValue()` instead?

    To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
    Gerrit-Change-Number: 4805164
    Gerrit-PatchSet: 5
    Gerrit-Owner: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Di Zhang <dizh...@chromium.org>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    Gerrit-Comment-Date: Wed, 27 Sep 2023 20:50:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    David Baron (Gerrit)

    unread,
    Sep 27, 2023, 8:29:15 PM9/27/23
    to David Baron, blink-rev...@chromium.org, blink-...@chromium.org

    Attention is currently required from: David Baron.

    David Baron uploaded patch set #6 to this change.

    View Change

    Fix the traversal for dir=auto handling on <slot> to traverse what was intended.

    The use of Traversal and FlatTreeTraversal for handling <slot dir=auto>,
    prior to this change, starts from the first flat-tree slotted child of
    the slot, and from there traverses potentially the entire rest of the
    document, ignoring the stay_within argument to the function and the
    slotting of children. This change fixes the traversal to traverse the
    children slotted into the <slot> and their light dom descendants.

    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
    https://github.com/web-platform-tests/wpt/pull/29820

    Bug: 576815
    Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
    ---
    M third_party/blink/renderer/core/html/html_element.cc
    D third_party/blink/web_tests/external/wpt/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window-expected.txt
    2 files changed, 43 insertions(+), 13 deletions(-)

    To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
    Gerrit-Change-Number: 4805164
    Gerrit-PatchSet: 6

    David Baron (Gerrit)

    unread,
    Sep 27, 2023, 8:29:58 PM9/27/23
    to David Baron, blink-rev...@chromium.org, blink-...@chromium.org, Di Zhang, chromium...@chromium.org

    Attention is currently required from: Di Zhang.

    View Change

    2 comments:

    • File third_party/blink/renderer/core/html/html_element.cc:

      • Add to TODO that once flag is removed, this function should only be called with self as stay_within […]

        Done

      • Patch Set #5, Line 2509: if (slotted_node->IsTextNode()) {

        Should this be calling `element->ShouldAutoDirUseValue()` instead?

      • I don't think it needs to. This part is handling text nodes, and the part below is handling elements. The part below that handles elements will make a recursive call to `ResolveAutoDirectionality`, which will call `ElementIfAutoDirShouldUseValueOrNull` for the child element.

    To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
    Gerrit-Change-Number: 4805164
    Gerrit-PatchSet: 6
    Gerrit-Owner: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Di Zhang <dizh...@chromium.org>
    Gerrit-Attention: Di Zhang <dizh...@chromium.org>
    Gerrit-Comment-Date: Thu, 28 Sep 2023 00:29:47 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Di Zhang <dizh...@chromium.org>

    Di Zhang (Gerrit)

    unread,
    Sep 28, 2023, 2:08:20 PM9/28/23
    to David Baron, blink-rev...@chromium.org, blink-...@chromium.org, chromium...@chromium.org

    Attention is currently required from: David Baron.

    Patch set 6:Code-Review +1

    View Change

      To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
      Gerrit-Change-Number: 4805164
      Gerrit-PatchSet: 6
      Gerrit-Owner: David Baron <dba...@chromium.org>
      Gerrit-Reviewer: Di Zhang <dizh...@chromium.org>
      Gerrit-Attention: David Baron <dba...@chromium.org>
      Gerrit-Comment-Date: Thu, 28 Sep 2023 18:08:07 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes

      David Baron (Gerrit)

      unread,
      Sep 28, 2023, 2:09:09 PM9/28/23
      to David Baron, blink-rev...@chromium.org, blink-...@chromium.org, Di Zhang, chromium...@chromium.org

      Patch set 6:Commit-Queue +2

      View Change

        To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
        Gerrit-Change-Number: 4805164
        Gerrit-PatchSet: 6
        Gerrit-Owner: David Baron <dba...@chromium.org>
        Gerrit-Reviewer: David Baron <dba...@chromium.org>
        Gerrit-Reviewer: Di Zhang <dizh...@chromium.org>
        Gerrit-Comment-Date: Thu, 28 Sep 2023 18:08:58 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes

        Chromium LUCI CQ (Gerrit)

        unread,
        Sep 28, 2023, 5:03:40 PM9/28/23
        to David Baron, blink-rev...@chromium.org, blink-...@chromium.org, Di Zhang, chromium...@chromium.org

        Chromium LUCI CQ submitted this change.

        View Change

        Approvals: Di Zhang: Looks good to me David Baron: Commit
        Fix the traversal for dir=auto handling on <slot> to traverse what was intended.

        The use of Traversal and FlatTreeTraversal for handling <slot dir=auto>,
        prior to this change, starts from the first flat-tree slotted child of
        the slot, and from there traverses potentially the entire rest of the
        document, ignoring the stay_within argument to the function and the
        slotting of children. This change fixes the traversal to traverse the
        children slotted into the <slot> and their light dom descendants.

        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
        https://github.com/web-platform-tests/wpt/pull/29820

        Bug: 576815
        Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
        Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4805164
        Reviewed-by: Di Zhang <dizh...@chromium.org>
        Commit-Queue: David Baron <dba...@chromium.org>
        Cr-Commit-Position: refs/heads/main@{#1202823}

        ---
        M third_party/blink/renderer/core/html/html_element.cc
        D third_party/blink/web_tests/external/wpt/html/dom/elements/global-attributes/dir-auto-dynamic-changes.window-expected.txt
        2 files changed, 43 insertions(+), 13 deletions(-)


        To view, visit change 4805164. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-MessageType: merged
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ifc0277cff4d94a30e2dd932004a55ed54bfa60bb
        Gerrit-Change-Number: 4805164
        Gerrit-PatchSet: 7
        Gerrit-Owner: David Baron <dba...@chromium.org>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        Reply all
        Reply to author
        Forward
        0 new messages