Bug 239499

Summary: Only AXIsolatedTree::update{Children,Node} once when processing notifications in AXObjectCache::updateIsolatedTree
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 2022-04-19 08:24:38 PDT
Currently, we do try to prevent performing duplicate updates, but we do so only if we have an exact match for a previous notification for any given object:

case AXTextChanged:
case AXValueChanged: {

    bool needsUpdate = appendIfNotContainsMatching(filteredNotifications, notification, [&notification] (const std::pair<RefPtr<AXCoreObject>, AXNotification>& note) {
       return note.second == notification.second && note.first.get() == notification.first.get();
    });

    if (needsUpdate)
        tree->updateNode(*notification.first);
   

However, multiple notifications trigger AXIsolatedTree::updateNode and children, so we'll still do wasted work in this case. For example, in the above snippet, we'd update the node twice if the same object got both an AXTextChanged and AXValueChanged notification in the same batch.
Comment 1 Radar WebKit Bug Importer 2022-04-19 08:24:47 PDT
<rdar://problem/91961437>
Comment 2 Tyler Wilcock 2022-04-19 08:32:22 PDT
Created attachment 457894 [details]
Patch
Comment 3 Tyler Wilcock 2022-04-19 09:06:42 PDT
Created attachment 457903 [details]
Patch
Comment 4 EWS 2022-04-21 13:52:51 PDT
Committed r293186 (249862@main): <https://commits.webkit.org/249862@main>

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