Bug 257377

Summary: AX: Implement unit testing of the functionality in NSApplicationAccessibilityFocusedUIElement.
Product: WebKit Reporter: Andres Gonzalez <andresg_22>
Component: AccessibilityAssignee: Andres Gonzalez <andresg_22>
Status: RESOLVED FIXED    
Severity: Normal CC: andresg_22, darin, tyler_w, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Andres Gonzalez
Reported 2023-05-26 05:35:55 PDT
No AX layout test exercise this functionality.
Attachments
Patch (8.14 KB, patch)
2023-05-26 06:21 PDT, Andres Gonzalez
no flags
Patch (8.13 KB, patch)
2023-05-30 13:20 PDT, Andres Gonzalez
no flags
Radar WebKit Bug Importer
Comment 1 2023-05-26 05:36:23 PDT
Andres Gonzalez
Comment 2 2023-05-26 06:21:26 PDT
Darin Adler
Comment 3 2023-05-26 09:44:27 PDT
I suggest the function we add to the header not take any arguments. It can call the internal function that takes and ignores an NSApplication and a SEL.
Darin Adler
Comment 4 2023-05-26 09:45:11 PDT
By the way, the bugs.webkit.org review tool is no longer working for me. I encourage everyone to switch to GitHub pull requests soon.
Tyler Wilcock
Comment 5 2023-05-26 10:24:23 PDT
Comment on attachment 466506 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=466506&action=review > Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:278 > +#if ENABLE(ACCESSIBILITY_ISOLATED_TREE) && USE(APPKIT) > + UNUSED_PARAM(pageRef); > + return WebKit::WebProcess::accessibilityFocusedUIElement(nil, nil); > +#else Prior to this change, accessibility would be enabled (via AXObjectCache::enableAccessibility()), assuming we had a non-null `pageRef`, `page`, and `focusedDocument`. Do we want / need to preserve that behavior somehow? > Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:298 > +#endif Thoughts on adding // ENABLE(ACCESSIBILITY_ISOLATED_TREE) && USE(APPKIT) after this #endif? This added #endif is sibling to an #else of a different compiler directive, so the extra context on which one is ending here could be nice.
Andres Gonzalez
Comment 6 2023-05-30 13:20:30 PDT
Andres Gonzalez
Comment 7 2023-05-30 13:25:33 PDT
(In reply to Darin Adler from comment #3) > I suggest the function we add to the header not take any arguments. It can > call the internal function that takes and ignores an NSApplication and a SEL. Added the method to the header that takes no arguments as you suggested. This static method now implements the functionality. The AppKit override that takes and ignores NSApplication and SEL, now simply calls this method. I think it is much cleaner now. Thanks.
Andres Gonzalez
Comment 8 2023-05-30 13:38:21 PDT
(In reply to Tyler Wilcock from comment #5) > Comment on attachment 466506 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=466506&action=review > > > Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:278 > > +#if ENABLE(ACCESSIBILITY_ISOLATED_TREE) && USE(APPKIT) > > + UNUSED_PARAM(pageRef); > > + return WebKit::WebProcess::accessibilityFocusedUIElement(nil, nil); > > +#else > > Prior to this change, accessibility would be enabled (via > AXObjectCache::enableAccessibility()), assuming we had a non-null `pageRef`, > `page`, and `focusedDocument`. Do we want / need to preserve that behavior > somehow? AXObjectCache::enableAccessibility is called because this path ultimately results in getting the root element, to get the focused element from it, and getting the root does: - (id)accessibilityRootObjectWrapper { #if ENABLE(ACCESSIBILITY_ISOLATED_TREE) if (!isMainRunLoop()) { if (RefPtr root = m_isolatedTreeRoot.get()) return root->wrapper(); } #endif return ax::retrieveAutoreleasedValueFromMainThread<id>([protectedSelf = retainPtr(self)] () -> RetainPtr<id> { if (!WebCore::AXObjectCache::accessibilityEnabled()) WebCore::AXObjectCache::enableAccessibility(); > > > Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:298 > > +#endif > > Thoughts on adding // ENABLE(ACCESSIBILITY_ISOLATED_TREE) && USE(APPKIT) > after this #endif? This added #endif is sibling to an #else of a different > compiler directive, so the extra context on which one is ending here could > be nice. Done.
EWS
Comment 9 2023-05-30 18:16:39 PDT
Committed 264706@main (2def5f3d4ef5): <https://commits.webkit.org/264706@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 466537 [details].
Note You need to log in before you can comment on or make changes to this bug.