Bug 244746

Summary: AX: Stop unnecessarily caching AXPropertyName::{LayoutCount, PressedIsPresent, DropEffects, ClickPoint, ClassList}
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-09-02 18:30:18 PDT
We only expect these properties to be requested by tests and automation on the Mac (so not actual AX clients), so don't do the work to cache them.
Comment 1 Radar WebKit Bug Importer 2022-09-02 18:30:36 PDT
<rdar://problem/99512111>
Comment 2 Tyler Wilcock 2022-09-02 18:32:53 PDT
Created attachment 462108 [details]
Patch
Comment 3 chris fleizach 2022-09-02 19:33:22 PDT
Comment on attachment 462108 [details]
Patch

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

> Source/WebCore/accessibility/AccessibilityObject.cpp:3150
> +    for (unsigned k = 0; k < domClassList.length(); k++)

Can we put length outside the loop to reduce number of times it is called

> Source/WebCore/accessibility/AccessibilityObject.cpp:3151
> +        classList.append(domClassList.item(k).string());

Is there some existing map function that does this?
Comment 4 Tyler Wilcock 2022-09-02 19:57:56 PDT
Created attachment 462111 [details]
Patch
Comment 5 Tyler Wilcock 2022-09-02 19:59:08 PDT
(In reply to chris fleizach from comment #3)
> Comment on attachment 462108 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=462108&action=review
> 
> > Source/WebCore/accessibility/AccessibilityObject.cpp:3150
> > +    for (unsigned k = 0; k < domClassList.length(); k++)
> 
> Can we put length outside the loop to reduce number of times it is called
Fixed.

> > Source/WebCore/accessibility/AccessibilityObject.cpp:3151
> > +        classList.append(domClassList.item(k).string());
> 
> Is there some existing map function that does this?
Unfortunately no. This is a DOMTokenList class rather than a Vector, and it doesn't have a map function.
Comment 6 EWS 2022-09-03 10:13:13 PDT
Committed 254130@main (1ee82a09fde8): <https://commits.webkit.org/254130@main>

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