[A11y] Notify img of image map when its children are deleted.
Here is an explanation of this bug and how it was fixed:
See the attached wpt test and the behavior of the
script that runs inside it. The a11y tree will
start in a stat ewhere the node is present
and is later removed.
Before executing the script test:
a11y tree:
*"RootWebArea" axid#4 #document isRoot focused focusable #children=1
"GenericContainer" axid#5 <html.test-wait> isIgnored #children=1
"GenericContainer" axid#6 #children=1
"Image" axid#10 #children=1
"StaticText" axid#14 "x" isIgnored missingLayout
Dom tree:
*#document
DOCTYPE html
HTML class="test-wait"
HEAD
BODY
DIV style="display:none"
MAP
IMG
SPAN class="removeme"
STYLE
SCRIPT
When the script executes:
- The is removed via a call to
RemoveSubtree(). Its a11y object is:
""GenericContainer" axid#11 <span.removeme>
isIgnored isRemovedFromTree" - The parent of the span is notified via
ChildrenChangedWithCleanLayout(). The a11y
object is: ""GenericContainer" axid#6
#children=1" - Some tree restructuring (unclear what this is),
calls RemoveSubtree on the div that contains the
image map. - The image map, while removing the nodes through
dom traversal, points to the static text ("x"),
instead of pointing to the image it has as a child
in the a11y tree.
In another words: the way we traverse to build the
a11y tree is different from the way we are
traversing it when removing it.
A11y tree after removal:
*"RootWebArea" axid#4 #document isRoot focused focusable #children=1
"GenericContainer" axid#5 <html.> isIgnored #children=1
"GenericContainer" axid#6 #children=1
"Image" axid#10 #children=1
"StaticText" axid#14 "x" isIgnored missingLayout
Dom tree after removal:
*#document
DOCTYPE html
HTML
HEAD
BODY
DIV style="display:none"
MAP
IMG
STYLE
SCRIPT
Test: wpt test
Fixed: 335633649
Bug: 341130884
Change-Id: I3ce3264388c547ebd18f56761d81df6c7a192a37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5600664
Reviewed-by: Aaron Leventhal aleventhal@chromium.org
Commit-Queue: Lucas Radaelli lucasradaelli@google.com
Cr-Commit-Position: refs/heads/main@{#1312290}