Bug 247948

Summary: AX: Optimize shouldIgnoreGroup to avoid calling AccessibilityObject::textUnderElement unnecessarily.
Product: WebKit Reporter: Andres Gonzalez <andresg_22>
Component: AccessibilityAssignee: Andres Gonzalez <andresg_22>
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: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Andres Gonzalez 2022-11-15 09:13:09 PST
This function can be optimized.
Comment 1 Radar WebKit Bug Importer 2022-11-15 09:13:21 PST
<rdar://problem/102370543>
Comment 2 Andres Gonzalez 2022-11-15 09:18:10 PST
Created attachment 463533 [details]
Patch
Comment 3 chris fleizach 2022-11-15 10:08:15 PST
Comment on attachment 463533 [details]
Patch

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

> Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm:132
> +    if (!first || first != axObject.lastChild() || first->roleValue() != AccessibilityRole::StaticText)

is checking roleValue() faster than getting lastChild?
Comment 4 Andres Gonzalez 2022-11-15 11:18:10 PST
Created attachment 463537 [details]
Patch
Comment 5 Andres Gonzalez 2022-11-15 11:19:51 PST
(In reply to chris fleizach from comment #3)
> Comment on attachment 463533 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=463533&action=review
> 
> > Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm:132
> > +    if (!first || first != axObject.lastChild() || first->roleValue() != AccessibilityRole::StaticText)
> 
> is checking roleValue() faster than getting lastChild?

Yes, fixed.
Comment 6 EWS 2022-11-16 05:30:36 PST
Committed 256730@main (8f48b85eab58): <https://commits.webkit.org/256730@main>

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