Bug 244746 - AX: Stop unnecessarily caching AXPropertyName::{LayoutCount, PressedIsPresent, DropEffects, ClickPoint, ClassList}
Summary: AX: Stop unnecessarily caching AXPropertyName::{LayoutCount, PressedIsPresent...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-09-02 18:30 PDT by Tyler Wilcock
Modified: 2022-09-03 10:13 PDT (History)
10 users (show)

See Also:


Attachments
Patch (19.13 KB, patch)
2022-09-02 18:32 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (19.10 KB, patch)
2022-09-02 19:57 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 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].