Bug 233767

Summary: AX: In AccessibilityRenderObject::documentLinks, use existing image-map document links instead of always creating new ones
Product: WebKit Reporter: Tyler Wilcock <tyler_w>
Component: AccessibilityAssignee: Tyler Wilcock <tyler_w>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Tyler Wilcock 2021-12-02 10:03:18 PST
The current implementation of AccessibilityRenderObject::documentLinks always creates new image-map links rather than using the existing ones created via AccessibilityRenderObject::addImageMapChildren. This is problematic for two reasons:

  1. It is wasteful in terms of memory usage as we will endlessly accumulate AccessibilityImageMapLink objects in the cache each time AccessibilityRenderObject::documentLinks is called.
  2. It breaks document links in isolated tree mode, since the objects created this way aren't a child of any other object, and thus don't have any representation in the isolated tree. Concretely, this means AXIsolatedTree::nodeForID never returns anything for these objects.
Comment 1 Radar WebKit Bug Importer 2021-12-02 10:03:45 PST
<rdar://problem/85976724>
Comment 2 Tyler Wilcock 2021-12-02 10:11:36 PST
Created attachment 445733 [details]
Patch
Comment 3 chris fleizach 2021-12-02 11:22:08 PST
Comment on attachment 445733 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=445733&action=review

> Source/WebCore/accessibility/AccessibilityRenderObject.cpp:2064
> +                    HTMLMapElement& map = downcast<HTMLMapElement>(*parent);

this could be auto& map
Comment 4 Tyler Wilcock 2021-12-02 11:27:50 PST
Created attachment 445754 [details]
Patch
Comment 5 EWS 2021-12-02 20:17:37 PST
Committed r286477 (244816@main): <https://commits.webkit.org/244816@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 445754 [details].