Bug 262934 - AX: AXIsolatedTree::children() should not re-initialize m_children unless they've changed
Summary: AX: AXIsolatedTree::children() should not re-initialize m_children unless the...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-09 20:30 PDT by Tyler Wilcock
Modified: 2023-10-10 14:52 PDT (History)
10 users (show)

See Also:


Attachments
Patch (4.54 KB, patch)
2023-10-09 20:35 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Wilcock 2023-10-09 20:30:30 PDT
This shows up heavily on samples for some sites.
Comment 1 Radar WebKit Bug Importer 2023-10-09 20:30:40 PDT
<rdar://problem/116715426>
Comment 2 Tyler Wilcock 2023-10-09 20:35:38 PDT
Created attachment 468141 [details]
Patch
Comment 3 chris fleizach 2023-10-09 22:10:03 PDT
Comment on attachment 468141 [details]
Patch

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

> Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:463
> +    m_childrenIDs = WTFMove(ids);

Can we avoid dirty children if the IDs are same in same order?
Comment 4 Tyler Wilcock 2023-10-09 22:15:37 PDT
(In reply to chris fleizach from comment #3)
> Comment on attachment 468141 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=468141&action=review
> 
> > Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:463
> > +    m_childrenIDs = WTFMove(ids);
> 
> Can we avoid dirty children if the IDs are same in same order?
I thought about this too...but ended up deciding against it since it forces an O(n) iteration for what is likely a very uncommon case. Additionally, this proposed iteration would have to happen while we hold the m_changeLogLock, potentially increasing lock contention.
Comment 5 Andres Gonzalez 2023-10-10 06:01:17 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 468141 [details]
> Patch

Are we covering the unconnected objects case? We don't update m_pendingchildrenUpdates for those objects.
Comment 6 Tyler Wilcock 2023-10-10 10:39:22 PDT
(In reply to Andres Gonzalez from comment #5)
> (In reply to Tyler Wilcock from comment #2)
> > Created attachment 468141 [details]
> > Patch
> 
> Are we covering the unconnected objects case? We don't update
> m_pendingchildrenUpdates for those objects.
I don't think that's necessary here. The only time we need to mark children as dirty is when AXIsolatedObject::m_childrenIDs changes, which addUnconnectedNode doesn't do.
Comment 7 EWS 2023-10-10 14:52:22 PDT
Committed 269170@main (4d35a6d87939): <https://commits.webkit.org/269170@main>

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