Bug 270024

Summary: AX: Support searching for remote frames
Product: WebKit Reporter: chris fleizach <cfleizach>
Component: AccessibilityAssignee: chris fleizach <cfleizach>
Status: NEW ---    
Severity: Normal CC: andresg_22, tyler_w, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch cfleizach: review?, ews-feeder: commit-queue-

Description chris fleizach 2024-02-23 16:02:54 PST
Searching through remote frames need to follow this process.
1) Fill the results array with objects until you hit a remote frame
2) Add the platform element to the results array
3) Return the results array even if not full.

<rdar://problem/123527233>
Comment 1 chris fleizach 2024-02-23 16:04:39 PST
Created attachment 470036 [details]
Patch
Comment 2 Tyler Wilcock 2024-02-25 14:23:26 PST
Comment on attachment 470036 [details]
Patch

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

> COMMIT_MESSAGE:10
> +1) Fill the results array with objects until you hit a remote frame
> +2) Add the platform element to the results array
> +3) Return the results array even if not full.

With the patch as-is, I see how we accomplish one and two. But are we actually behaving as described in 3? Pretend we were searching for 3 headings. We found one, then hit this new object->isAXRemoteFrame() branch, and add the frame to the results. But won't we keep searching inside this process for the third heading rather than returning the results early?
Comment 3 Andres Gonzalez 2024-02-26 04:25:12 PST
(In reply to chris fleizach from comment #1)
> Created attachment 470036 [details]
> Patch

diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp
index 52cf02d7ce08..5ce412badb81 100644
--- a/Source/WebCore/accessibility/AccessibilityObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityObject.cpp
@@ -4592,6 +4592,13 @@ static bool isAccessibilityTextSearchMatch(RefPtr<AXCoreObject> axObject, const

 static bool objectMatchesSearchCriteriaWithResultLimit(RefPtr<AXCoreObject> object, const AccessibilitySearchCriteria& criteria, AXCoreObject::AccessibilityChildrenVector& results)
 {
+    // As soon as a remote object is found, return that and stop processing.
+    // AX clients will process the remote object and then return to searching this process later.
+    if (object->isAXRemoteFrame()) {
+        results.append(object);
+        return true;
+    }

AG: should we include the remote object in results even if it doesn't match the search criteria? I understand that we should stop at that point and let the client to continue the search in the remote process if needed, but don't see why we need to include the remote object in the results unconditionally. Maybe because that's how the client knows what process to query next?