Repository navigation
Get Accessibility Properties - #1960
spectranaut wants to merge 11 commits into
Conversation
spectranaut
left a comment
There was a problem hiding this comment.
First pass at fixes to your comments, @cookiecrook, but I still need to work on definitions and where they belong!
Co-authored-by: James Teh <jamie@jantrid.net>
|
I can't actually add people as reviewers, but, this is ready for re-review after all the feedback from the meetings the last few days, and the review comments from James and Jamie. @jcsteh @cookiecrook @jugglinmike @lolaodelola , if you could all take a look :) |
Co-authored-by: James Teh <jamie@jantrid.net>
| </tr> | ||
| <tr> | ||
| <td>GET</td> | ||
| <td>/session/{<var>session id</var>}/accessibiltiy/properties/{<var>accessibility id</var>}/</td> |
There was a problem hiding this comment.
A couple typos: "accessibility", and we can nix the trailing forward-slash.
Taking a step back, though, I wonder if we should design this resource more like the element commands. That is, given that we have:
/session/{session ID}/element/{element ID}/rect
A resource like:
/session/{session ID}/accessibility/node/{accessibility node ID}/properties
Looks a little more familiar (and hopefully more predictable) than
/session/{session ID}/accessibility/properties/{accessibility node ID}
I'd personally be in favor of such an alteration purely on the basis of parity, but it would help if there was a credible expectation for further accessible-node-based commands in the future. Do you know any? Maybe /element to get the backing DOM element (where available)?
There was a problem hiding this comment.
Thanks for the ideas here, I wonder what the other reviews would think, and we should discuss this at the next accessibility interop meeting.
There was a problem hiding this comment.
We agreed to make this switch!
There was a problem hiding this comment.
Hm, I need to reopen this issue given that even through you agreed on the suggestion it hasn't been made yet. And yes, it sounds better.
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked - pressed - children (array of serialized AXIDs) - parent (serialized AXID) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203. Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800. At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAXNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * LayoutTests/resources/testdriver-vendor.js: (window.test_driver_internal.get_accessibility_properties_for_element): (window.test_driver_internal.get_accessibility_properties_for_accessibility_node): * Source/JavaScriptCore/inspector/protocol/DOM.json * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (Ref<JSON::ArrayOf<String>> buildArrayForAXChildren) (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.h * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXNode) (WebAutomationSessionProxy::ComputedAXProperties getComputedAccessibilityProperties) * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in * Source/WebKit/Scripts/webkit/messages.py * Source/WebCore/accessibility/AXObjectCache.h
|
The build is failing because it can't find The problem could be something completely different, have I missed something? |
Thanks for these changes Lola! I agree that we should land the Core-AAM change first. |
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked - pressed - children (array of serialized AXIDs) - parent (serialized AXID) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203. Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800. At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAXNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * LayoutTests/resources/testdriver-vendor.js: (window.test_driver_internal.get_accessibility_properties_for_element): (window.test_driver_internal.get_accessibility_properties_for_accessibility_node): * Source/JavaScriptCore/inspector/protocol/DOM.json * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (Ref<JSON::ArrayOf<String>> buildArrayForAXChildren) (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.h * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXNode) (WebAutomationSessionProxy::ComputedAXProperties getComputedAccessibilityProperties) * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in * Source/WebKit/Scripts/webkit/messages.py * Source/WebCore/accessibility/AXObjectCache.h
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * LayoutTests/resources/testdriver-vendor.js: (window.test_driver_internal.get_accessibility_properties_for_element): (window.test_driver_internal.get_accessibility_properties_for_accessibility_node): * Source/JavaScriptCore/inspector/protocol/DOM.json * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::stringForAccessibilityNodeID): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXNode): (WebKit::toAccessibilityTriState): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in:
| <!-- Accessibility node --> <li><dfn><a | ||
| href="https://w3c.github.io/core-aam/#computed_accessibility_properties">Accessibility node</a></dfn> | ||
| <!-- accessibilityId --> <li><dfn><a | ||
| href="https://w3c.github.io/core-aam/#computed_accessibility_properties_aria_states_and_properties">accessibilityId</a></dfn> |
There was a problem hiding this comment.
In the WebKit implementation of "Get Accessibility Properties...", a concern was surfaced about accessibility node IDs uniquely identifying an accessibility node across frames in a top-level browsing context. Would this be considered an implementation detail, or something that needs to be in the WebDriver spec?
There was a problem hiding this comment.
I'd say implementation detail in terms of how it works (for example we should probably just concatenate frameID + AXID, but other browsers might do it a different way). I do think the spec should say that the IDs are unique within a page.
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * LayoutTests/resources/testdriver-vendor.js: (window.test_driver_internal.get_accessibility_properties_for_element): (window.test_driver_internal.get_accessibility_properties_for_accessibility_node): * Source/JavaScriptCore/inspector/protocol/DOM.json * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::stringForAccessibilityNodeID): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXNode): (WebKit::toAccessibilityTriState): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in:
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * LayoutTests/resources/testdriver-vendor.js: (window.test_driver_internal.get_accessibility_properties_for_element): (window.test_driver_internal.get_accessibility_properties_for_accessibility_node): * Source/JavaScriptCore/inspector/protocol/DOM.json * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::stringForAccessibilityNodeID): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXNode): (WebKit::toAccessibilityTriState): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in:
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::WTF::CompletionHandler<void): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * TestExpectations/apitests: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::WTF::CompletionHandler<void): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * TestExpectations/apitests: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::WTF::CompletionHandler<void): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * TestExpectations/apitests: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::WTF::CompletionHandler<void): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * TestExpectations/apitests: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…ccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::WTF::CompletionHandler<void): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * TestExpectations/apitests: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…AccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, test_driver.get_accessibility_properties...() will return an accessibility property bag containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of serialized AXIDs) - parent (serialized AXID; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands which is then dispatched to the UI Process (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy) which invokes an asynchronous IPC message to the corresponding Web Process. Note that GetAccessibilityPropertiesForElement uses the same DOM node/frame-based approach as many other WebDriver commands however, GetAccessibilityPropertiesForAccessibilityNode does not require frame-based process routing (it retrieves computed accessibility properties using the page's axObjectCache, rather than a specific frame tied to a DOM node); thus, GetAccessibilityPropertiesForAccessibilityNode has a different message signature. Since AXIDs are only unique within a single Web Process, accessibility nodes in cross-process (site-isolated) iframes are not yet supported; a FIXME tracks this. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - session/{session_id}/element/{elId}/accessibilityproperties: Returns accessibility properties for DOM element {elId} - session/{session_id}/accessibility/<accessibility node id>/properties/{accessibility node id}: Returns accessibility properties for accessibility node {accessibility node id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::WTF::CompletionHandler<void): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * TestExpectations/apitests: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)): Fix accessibilitynodehandle discrepancy
…AccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, the Automation protocol returns an accessibility property bag (surfaced to WPT via test_driver.get_accessibility_properties...()) containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of accessibility node handles) - parent (accessibility node handle; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands, which are then dispatched to the UIProcess (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy), which invokes an asynchronous IPC message to the corresponding WebProcess. Since an AXID is only unique within a single WebProcess, accessibility nodes are identified by opaque handles that also encode the hosting process and frame. The UIProcess validates the handle (frame still exists, belongs to the page, and is still hosted by that process) and routes GetAccessibilityPropertiesForAccessibilityNode to the process containing that frame; the WebProcess only resolves the AXID within that frame's document. Parent and children are computed from the unignored tree using the cross-frame accessors (now exported from WebCore), so they can cross frames hosted by the same process. With site isolation, a frame hosted by another process appears as a childless RemoteFrame node; walking across process boundaries is not yet supported and will be addressed in a follow-up: https://bugs.webkit.org/show_bug.cgi?id=327631. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using frame-qualified AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. WebCore::AXID is registered as an IPC-serialized identifier in messages.py. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - /session/{session id}/element/{element id}/accessibilityproperties: Returns accessibility properties for DOM element {element id} - /session/{session id}/accessibility/properties/{accessibility id}: Returns accessibility properties for accessibility node {accessibility id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has also been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). New API tests (WebAutomationAccessibility) cover a cross-origin iframe with and without site isolation, checked/pressed states, forged and stale handles, and malformed handles. * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXID): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…AccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, the Automation protocol returns an accessibility property bag (surfaced to WPT via test_driver.get_accessibility_properties...()) containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of accessibility node handles) - parent (accessibility node handle; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands, which are then dispatched to the UIProcess (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy), which invokes an asynchronous IPC message to the corresponding WebProcess. Since an AXID is only unique within a single WebProcess, accessibility nodes are identified by opaque handles that also encode the hosting process and frame. The UIProcess validates the handle (frame still exists, belongs to the page, and is still hosted by that process) and routes GetAccessibilityPropertiesForAccessibilityNode to the process containing that frame; the WebProcess only resolves the AXID within that frame's document. Parent and children are computed from the unignored tree using the cross-frame accessors (now exported from WebCore), so they can cross frames hosted by the same process. With site isolation, a frame hosted by another process appears as a childless RemoteFrame node; walking across process boundaries is not yet supported and will be addressed in a follow-up: https://bugs.webkit.org/show_bug.cgi?id=327631. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using frame-qualified AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. WebCore::AXID is registered as an IPC-serialized identifier in messages.py. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - /session/{session id}/element/{element id}/accessibilityproperties: Returns accessibility properties for DOM element {element id} - /session/{session id}/accessibility/properties/{accessibility id}: Returns accessibility properties for accessibility node {accessibility id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has also been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). New API tests (WebAutomationAccessibility) cover a cross-origin iframe with and without site isolation, checked/pressed states, forged and stale handles, and malformed handles. * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXID): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…AccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, the Automation protocol returns an accessibility property bag (surfaced to WPT via test_driver.get_accessibility_properties...()) containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of accessibility node handles) - parent (accessibility node handle; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands, which are then dispatched to the UIProcess (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy), which invokes an asynchronous IPC message to the corresponding WebProcess. Since an AXID is only unique within a single WebProcess, accessibility nodes are identified by opaque handles that also encode the hosting process and frame. The UIProcess validates the handle (frame still exists, belongs to the page, and is still hosted by that process) and routes GetAccessibilityPropertiesForAccessibilityNode to the process containing that frame; the WebProcess only resolves the AXID within that frame's document. Parent and children are computed from the unignored tree using the cross-frame accessors (now exported from WebCore), so they can cross frames hosted by the same process. With site isolation, a frame hosted by another process appears as a childless RemoteFrame node; walking across process boundaries is not yet supported and will be addressed in a follow-up: https://bugs.webkit.org/show_bug.cgi?id=327631. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using frame-qualified AXIDs and an AccessibilityTriState enum rather than strings; the UIProcess converts these to strings when building the protocol object. WebCore::AXID is registered as an IPC-serialized identifier in messages.py. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in Webdriver for Safari (safaridriver): - /session/{session id}/element/{element id}/accessibilityproperties: Returns accessibility properties for DOM element {element id} - /session/{session id}/accessibility/properties/{accessibility id}: Returns accessibility properties for accessibility node {accessibility id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has also been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). New API tests (WebAutomationAccessibility) cover a cross-origin iframe with and without site isolation, checked/pressed states, forged and stale handles, and malformed handles. * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXID): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…AccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, the Automation protocol returns an accessibility property bag (surfaced to WPT via test_driver.get_accessibility_properties...()) containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of accessibility node handles) - parent (accessibility node handle; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands, which are then dispatched to the UIProcess (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy), which invokes an asynchronous IPC message to the corresponding WebProcess. Since an AXID is only unique within a single WebProcess, accessibility nodes are identified by opaque handles that also encode the hosting process and frame. The UIProcess fills in the process from the process it sent the request to, rather than trusting a value reported by the WebProcess, and only accepts handles whose components are plain decimal integers. It validates the handle (the frame still exists, belongs to the page, and is still hosted by that process) and routes GetAccessibilityPropertiesForAccessibilityNode to the process containing that frame; the WebProcess only resolves the AXID within that frame's document. Parent and children are computed from the unignored tree using the cross-frame accessors (now exported from WebCore), so they can cross frames hosted by the same process. With site isolation, a frame hosted by another process appears as a childless RemoteFrame node; walking across process boundaries is not yet supported and will be addressed in a follow-up: https://bugs.webkit.org/show_bug.cgi?id=327631. Accessibility nodes that are ignored (e.g., hidden, aria-hidden="true", or presentational) are not part of the tree that parent and children expose, so both commands report them, along with elements that have no accessibility node, using a new AccessibilityNodeNotFound error that corresponds to WebDriver's "no such accessibility node" error. Stale and forged accessibility node handles report the same error. Since getComputedRole and getComputedLabel share the element lookup, they now also report AccessibilityNodeNotFound instead of InternalError for elements that are not rendered. Both lookups enable accessibility before bringing every frame's accessibility cache in the process up to date. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using frame-qualified AXIDs and an AccessibilityTriState enum rather than strings; the process is not part of the struct. The UIProcess converts these to strings when building the protocol object. WebCore::AXID is registered as an IPC-serialized identifier in messages.py, and WebCore::AccessibilityObject::isIgnored() is now exported. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in WebDriver for Safari (safaridriver): - /session/{session id}/element/{element id}/accessibilityproperties: Returns accessibility properties for DOM element {element id} - /session/{session id}/accessibility/properties/{accessibility id}: Returns accessibility properties for accessibility node {accessibility id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has also been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). New API tests (WebAutomationAccessibility) cover a cross-origin iframe with and without site isolation (checking that every child names its parent in both cases), checked/pressed states, hidden, aria-hidden, and presentational elements, nodes that become ignored, omitting the frame handle, forged and stale handles, and malformed handles, including whitespace in a component. * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebCore/accessibility/AccessibilityObject.h: Export isIgnored() for use by WebAutomationSessionProxy. * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForNode): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXID): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::setAttribute): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, ElementWithoutFrameHandle)): (TestWebKitAPI::TEST(WebAutomationAccessibility, IgnoredAndHiddenElements)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
…AccessibilityPropertiesForAccessibilityNode commands https://bugs.webkit.org/show_bug.cgi?id=299508 rdar://161303091 Reviewed by NOBODY (OOPS!). This patch implements two new WebDriver automation commands used to support more robust WPT accessibility testing: - GetAccessibilityPropertiesForElement - GetAccessibilityPropertiesForAccessibilityNode For this initial implementation, the Automation protocol returns an accessibility property bag (surfaced to WPT via test_driver.get_accessibility_properties...()) containing the following computed properties: - accessibilityNodeId - role - label - checked ("true", "false", or "mixed"; omitted if the node does not support a checked state) - pressed ("true", "false", or "mixed"; omitted if the node is not a toggle button) - children (array of accessibility node handles) - parent (accessibility node handle; omitted if the node has no parent) As these new WebDriver commands are test-only interfaces, there's been in-depth discussion around how to treat computed AX properties when a property is missing and supported, or present & unsupported; see WICG/aom#203 Some additional resources: - WebDriver PR for the new commands: w3c/webdriver#1960 - ARIA PR for the initial set of computed accessibility properties, and treatment of undefined/missing/unsupported values: w3c/aria#2800 At a high level, the WebDriver client (i.e., Web Platform Tests' testdriver.js) initiates these new commands, which are then dispatched to the UIProcess (WebAutomationSession). The WebAutomationSession then parses the payload and extracts the protocol-specific element or accessibility node, after which it identifies the target (WebPageProxy), which invokes an asynchronous IPC message to the corresponding WebProcess. Since an AXID is only unique within a single WebProcess, accessibility nodes are identified by opaque handles that also encode the hosting process and frame. The UIProcess fills in the process from the process it sent the request to, rather than trusting a value reported by the WebProcess, and only accepts handles whose components are plain decimal integers. It validates the handle (the frame still exists, belongs to the page, and is still hosted by that process) and routes GetAccessibilityPropertiesForAccessibilityNode to the process containing that frame; the WebProcess only resolves the AXID within that frame's document. Parent and children are computed from the unignored tree using the cross-frame accessors (now exported from WebCore), so they can cross frames hosted by the same process. With site isolation, a frame hosted by another process appears as a childless RemoteFrame node; walking across process boundaries is not yet supported and will be addressed in a follow-up: https://bugs.webkit.org/show_bug.cgi?id=327631. Accessibility nodes that are ignored (e.g., hidden, aria-hidden="true", or presentational) are not part of the tree that parent and children expose, so both commands report them, along with elements that have no accessibility node, using a new AccessibilityNodeNotFound error that corresponds to WebDriver's "no such accessibility node" error. Stale and forged accessibility node handles report the same error. Since getComputedRole and getComputedLabel share the element lookup, they now also report AccessibilityNodeNotFound instead of InternalError for elements that are not rendered. Both lookups enable accessibility before bringing every frame's accessibility cache in the process up to date. The WebProcess returns the computed accessibility properties to the UIProcess as a typed "ComputedAccessibilityProperties" struct (Source/WebKit/Shared/Automation), using frame-qualified AXIDs and an AccessibilityTriState enum rather than strings; the process is not part of the struct. The UIProcess converts these to strings when building the protocol object. WebCore::AXID is registered as an IPC-serialized identifier in messages.py, and WebCore::AccessibilityObject::isIgnored() is now exported. Note that to fully support these new WebDriver commands, corresponding WebDriver HTTP endpoints must be implemented in WebDriver for Safari (safaridriver): - /session/{session id}/element/{element id}/accessibilityproperties: Returns accessibility properties for DOM element {element id} - /session/{session id}/accessibility/properties/{accessibility id}: Returns accessibility properties for accessibility node {accessibility id} Due to the existence of two AccessibilityProperties protocol object definitions, documentation for each has also been updated: - Source/WebKit/UIProcess/Automation/Automation.json — specification conformance and interoperability testing - Source/JavaScriptCore/inspector/protocol/DOM.json — Web Inspector DOM element inspection As an unrelated small fix, the return type for GetComputedLabel (WebAutomationSessionProxy IPC message) incorrectly names the first string parameter as "role" instead of "label" so this patch also corrects the tuple to return (label, errorType). New API tests (WebAutomationAccessibility) cover a cross-origin iframe with and without site isolation (checking that every child names its parent in both cases), checked/pressed states, hidden, aria-hidden, and presentational elements, nodes that become ignored, omitting the frame handle, forged and stale handles, and malformed handles, including whitespace in a component. * Source/JavaScriptCore/inspector/protocol/DOM.json: * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebCore/accessibility/AccessibilityObject.h: Export isIgnored() for use by WebAutomationSessionProxy. * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/Scripts/webkit/messages.py: (serialized_identifiers): (types_that_cannot_be_forward_declared): (headers_for_type): * Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::serializedIdentifiers): * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.h: Added. * Source/WebKit/Shared/Automation/ComputedAccessibilityProperties.serialization.in: Added. * Source/WebKit/UIProcess/Automation/Automation.json: * Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp: (WebKit::makeAccessibilityNodeHandle): (WebKit::parseAccessibilityNodeHandle): (WebKit::stringForAccessibilityTriState): (WebKit::makeAccessibilityPropertiesCompletionHandler): (WebKit::WebAutomationSession::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSession::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/UIProcess/Automation/WebAutomationSession.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::performDeferredAccessibilityCacheUpdates): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForNode): (WebKit::WebAutomationSessionProxy::getAccessibilityObjectForAXID): (WebKit::toAccessibilityTriState): (WebKit::accessibilityNodeReference): (WebKit::getComputedAccessibilityProperties): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForElement): (WebKit::WebAutomationSessionProxy::getAccessibilityPropertiesForAccessibilityNode): * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h: * Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in: * Tools/TestWebKitAPI/SourcesCocoa.txt: * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebAutomationAccessibility.mm: Added. (TestWebKitAPI::decodeAccessibilityNodeHandle): (TestWebKitAPI::encodeAccessibilityNodeHandle): (TestWebKitAPI::frameIDForFrameInfo): (TestWebKitAPI::WebAutomationAccessibility::WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::~WebAutomationAccessibility): (TestWebKitAPI::WebAutomationAccessibility::sendCommand): (TestWebKitAPI::WebAutomationAccessibility::frameHandleForChildFrame): (TestWebKitAPI::WebAutomationAccessibility::nodeHandleForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForElement): (TestWebKitAPI::WebAutomationAccessibility::propertiesForAccessibilityNode): (TestWebKitAPI::WebAutomationAccessibility::removeIframe): (TestWebKitAPI::WebAutomationAccessibility::setAttribute): (TestWebKitAPI::WebAutomationAccessibility::mainFrameID const): (TestWebKitAPI::WebAutomationAccessibility::childFrameID const): (TestWebKitAPI::WebAutomationAccessibility::mainFramePID const): (TestWebKitAPI::WebAutomationAccessibility::childFramePID const): (TestWebKitAPI::properties): (TestWebKitAPI::errorMessage): (TestWebKitAPI::expectError): (TestWebKitAPI::walkAccessibilityTree): (TestWebKitAPI::runRoundTripTest): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframe)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CrossOriginIframeWithSiteIsolation)): (TestWebKitAPI::TEST(WebAutomationAccessibility, CheckedAndPressedStates)): (TestWebKitAPI::TEST(WebAutomationAccessibility, ElementWithoutFrameHandle)): (TestWebKitAPI::TEST(WebAutomationAccessibility, IgnoredAndHiddenElements)): (TestWebKitAPI::TEST(WebAutomationAccessibility, MalformedAccessibilityNodeHandle)):
|
At the TPAC BTT & ARIA WG joint meeting today (October 29 2026), there was positive discussion about the addition of a new WebDriver error code (e.g., "No Such Accessibility Node" to match the existing No Such Node). In this issue, @spectranaut also linked to @cookiecrook's proposal for error handling of stale/non-existent accessibility nodes which is another potential approach: WICG/aom#203 (comment). |
Isn't it that the new command steps link terms that the index never defines under those names? There are two issues:
|
whimboo
left a comment
There was a problem hiding this comment.
Thank you for all the work on these new a11y WebDriver classic commands. I've taken a look and added a couple of inline comments. Please take a look at these.
| <!-- Computed accessibility properties --> <li><dfn><a | ||
| href="https://w3c.github.io/core-aam/#computed_accessibility_properties">Computed accessibility properties</a></dfn> | ||
| <!-- Accessibility node --> <li><dfn><a | ||
| href="https://w3c.github.io/core-aam/#computed_accessibility_properties">Accessibility node</a></dfn> |
There was a problem hiding this comment.
Is that the wrong link? It's the same as for Computed accessibility properties.
Also the links use https://w3c.github.io/core-aam/, but specref lists the editor's draft for core-aam-1.2 as https://w3c.github.io/aria/core-aam/. It might not matter when all of the links can be removed.
| </tr> | ||
| <tr> | ||
| <td>GET</td> | ||
| <td>/session/{<var>session id</var>}/accessibiltiy/properties/{<var>accessibility id</var>}/</td> |
There was a problem hiding this comment.
Hm, I need to reopen this issue given that even through you agreed on the suggestion it hasn't been made yet. And yes, it sounds better.
| <li><p><a>Try</a> to <a>handle any user prompts</a> | ||
| with <var>session</var>. | ||
|
|
||
| <li><p>Let <var>node</var> be the <a>accessibility node</a> with <a>accessibility node ID</a> matching the <var>URL variables</var>["<code>accessibility id</code>"]. If no such <a>accessibility node</a> exists, return <a>error</a> with <a>error code</a> <a>no such accessibility node</a>. |
There was a problem hiding this comment.
This doesn't restrict the node to the currently selected window / browsing context but matches in any window, frame or session. Compare the steps from get a known element in how it should be described.
| of <a>trying</a> to <a>get a known element</a> | ||
| with <var>URL variables</var>["<code>element id</code>"]. | ||
|
|
||
| <li><p>Let <var>accessible</var> be the <a>accessibility node</a> that corresponds to this element. If no <a>accessibility node</a> exists, return <a>error</a> with <a>error code</a> <a>no such accessibility node</a>. |
There was a problem hiding this comment.
| <li><p>Let <var>accessible</var> be the <a>accessibility node</a> that corresponds to this element. If no <a>accessibility node</a> exists, return <a>error</a> with <a>error code</a> <a>no such accessibility node</a>. | |
| <li><p>Let <var>accessible</var> be the <a>accessibility node</a> that corresponds to <var>element</var>. If no <a>accessibility node</a> exists, return <a>error</a> with <a>error code</a> <a>no such accessibility node</a>. |
Also ideally it should also link to a defined element-to-node mapping (maybe in Core-AAM?) instead of relying on prose.
Maybe it might also have a short note to explain why in some cases there is no accessible node: `an element with no node (e.g. aria-hidden or display:none) is expected to return "no such accessibility node".
| <section> | ||
| <h2>Accessibility</h2> | ||
| <section> | ||
| <h3><dfn>Get Accessibility Properties for Accessibility Node</dfn></h3> |
There was a problem hiding this comment.
| <h3><dfn>Get Accessibility Properties for Accessibility Node</dfn></h3> | |
| <h3><dfn>Get Accessibility Properties For Accessibility Node</dfn></h3> |
|
|
||
| <li><p>Return <a>success</a> with data <var>properties</var>. | ||
| </ol> | ||
| </section> <!-- /Get Element Accessibility Properties --> |
There was a problem hiding this comment.
This doesn't match the section's heading.
| <!-- Simon Stewart --> <a href=http://www.rocketpoweredjetpants.com/>Simon Stewart</a>, | ||
| <!-- Sri Harsha --> Sri Harsha, | ||
| <!-- Titus Fortner --> Titus Fortner, | ||
| <!-- Valerie Young--> Valerie Young, |
There was a problem hiding this comment.
| <!-- Valerie Young--> Valerie Young, | |
| <!-- Valerie Young --> Valerie Young, |
| <!-- Luke Inman-Semerau --> Luke Inman-Semerau, | ||
| <!-- Lola Odelola --> Lola Odelola, |
There was a problem hiding this comment.
| <!-- Luke Inman-Semerau --> Luke Inman-Semerau, | |
| <!-- Lola Odelola --> Lola Odelola, | |
| <!-- Lola Odelola --> Lola Odelola, | |
| <!-- Luke Inman-Semerau --> Luke Inman-Semerau, |
| <!-- children --> <li><dfn><a | ||
| href="https://w3c.github.io/core-aam/#computed_accessibility_properties_aria_states_and_properties">children</a></dfn> | ||
| </ul> | ||
|
|
There was a problem hiding this comment.
nit: not needed empty line.
See WICG/aom#203
Added/update sections:
Things to maybe revisit:
This change is
Preview | Diff