From 0dda0eebab47a9bac61e4bac35665a8c8eecee71 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Tue, 22 Oct 2024 21:46:54 +0000 Subject: [PATCH] Bug 1924605 [wpt PR 48611] - [reading-flow] display: contents participate in the flow, a=testonly Automatic update from web-platform-tests [reading-flow] display: contents participate in the flow From CSSWG resolution [1]: > display:contents focusable element occurs immediately before its first child in visual order [1] https://github.com/w3c/csswg-drafts/issues/9230#issuecomment-2369780005 Currently, reading flow items in display: contents are ignored and display: contents elements are visited last in the focus order. That means we lose that order information. We update the algorithm so when we loop reading items and find one that is not in the focus scope, we traverse its parent to find an ancestor that is. This element can then be added in the reading flow instead. We update A11Y to behave the same way as focus navigation. Since the A11Y tree uses LayoutTreeBuilder, we update the algorithm to loop through each reading flow item's ancestor until its parent is the LayoutTreeBuilderTraversal::Parent. This element can then be added in the reading flow instead. Change-Id: I1c3c3ab3a6548611af9a2cfddecc9d889b0ecb14 Bug: 371024057 Bug: 40932006 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5924454 Commit-Queue: Di Zhang Reviewed-by: Mason Freed Cr-Commit-Position: refs/heads/main{#1368523} -- wpt-commits: 078000e068347d9558ff63ceb84510aad5953725 wpt-pr: 48611 UltraBlame original commit: 98d9d2eab45c9af3379a7b46c7a407389ce941e3 --- .../tentative/grid-order-across-scopes.html | 35 +++++------ .../grid-order-with-display-contents.html | 58 +++++++++++++------ .../tentative/grid-order-with-slots.html | 33 +++++------ 3 files changed, 72 insertions(+), 54 deletions(-) diff --git a/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-across-scopes.html b/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-across-scopes.html index 6d4743cefaf8..053b6f9e1455 100644 --- a/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-across-scopes.html +++ b/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-across-scopes.html @@ -255,17 +255,18 @@ - - Since -C -is +B +A +are +inside a -direct -reading -flow -item -it -is +display +: +contents +they +are visited -first +together . - - @@ -276,17 +277,17 @@ - Since B -A -are -inside -a +has +order +1 +its display : contents -they -are +parent +is visited -after +first . - - @@ -305,9 +306,9 @@ expect = " -C B A +C " data - diff --git a/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-display-contents.html b/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-display-contents.html index 2434098e063b..9ddd52abd52c 100644 --- a/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-display-contents.html +++ b/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-display-contents.html @@ -280,9 +280,9 @@ = " order1 -order3 order2 order4 +order3 " data - @@ -299,6 +299,17 @@ same grid container +and +are +placed +in +the +position +where +their +first +child +resides . " > @@ -446,10 +457,10 @@ " div1B order1B -order3B div2B order2B order4B +order3B " data - @@ -466,18 +477,27 @@ same grid container -with -focusable +and +are +placed +in +the +position +where +their +first +child +resides +. +The display contents -divs -at -the -end -of -the -focus -sequence +have +tabindex +and +should +be +focusable . " > @@ -643,18 +663,18 @@ expect = " -A1 -A2 -A3 -B1 -B2 -B3 C1 C2 C3 D1 D2 D3 +B1 +B2 +B3 +A1 +A2 +A3 " data - @@ -676,7 +696,7 @@ div class = -box +wrapper > < div diff --git a/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-slots.html b/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-slots.html index 1a22605e9a20..fe26e7ee3fb1 100644 --- a/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-slots.html +++ b/testing/web-platform/tests/shadow-dom/focus-navigation/reading-flow/tentative/grid-order-with-slots.html @@ -603,15 +603,15 @@ expect = " +o1 +o3 +o5 host3 / o2 host3 / o4 -o1 -o3 -o5 " data - @@ -823,18 +823,18 @@ expect = " -host4 -/ -after -host4 -/ -before b4 a4 d42 d41 d43 c4 +host4 +/ +after +host4 +/ +before " data - @@ -1343,14 +1343,14 @@ expect = " +b6 +a6 host6 / after host6 / before -b6 -a6 " data - @@ -1543,11 +1543,11 @@ expect = " -a7 -b7 host7 / after +a7 +b7 host7 / before @@ -1615,7 +1615,7 @@ " order : -4 +5 " id = @@ -1636,10 +1636,7 @@ display : block -" -style -= -" +; order : 4