AX: Move node-dependent role computation to AccessibilityNodeObject from AccessibilityRenderObject
https://bugs.webkit.org/show_bug.cgi?id=236166
Reviewed by Chris Fleizach.
Source/WebCore:
AccessibilityRenderObject::determineAccessibilityRole has a lot of
logic for computing the object's role that depends only on the node
associated with the object, not the renderer. This means that objects
that typically have renderers but sometimes don't (e.g. objects with
`hidden` + `aria-hidden="false"`, objects with `display: contents`)
can't have these roles, which is wrong.
This patch improves this by moving these node-dependent role
calcuations to a new determineAccessibilityRoleFromNode function, and
changing AccessibilityRenderObject to use that.
Test: accessibility/aria-visible-element-roles.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::determineAccessibilityRole):
(WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):
Added.
(WebCore::AccessibilityNodeObject::isDescendantOfElementType const):
(WebCore::AccessibilityNodeObject::isFileUploadButton const):
Moved to AccessibilityObject.
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isButton const):
Remove unnecessary whitespace.
(WebCore::AccessibilityObject::isFileUploadButton const):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
If properties of m_renderer don't yield a role, fallback to
determineAccessibilityRoleFromNode.
(WebCore::AccessibilityRenderObject::isDescendantOfElementType const):
Moved to AccessibilityNodeObject.
* accessibility/AccessibilityRenderObject.h:
LayoutTests:
Add test to verify ARIA visible objects (e.g. those with `hidden` and
`aria-hidden="false"`) compute their role and subrole properly based
on their DOM element.
* accessibility/aria-visible-element-roles.html: Added.
* platform/glib/accessibility/aria-visible-element-roles-expected.txt: Added.
* platform/mac-wk1/accessibility/aria-visible-element-roles-expected.txt: Added.
* platform/mac-wk2/accessibility/aria-visible-element-roles-expected.txt: Added.
* platform/win/accessibility/aria-visible-element-roles-expected.txt: Added.
* platform/mac-wk2/accessibility/roles-exposed-expected.txt:
This patch results in a progression in computing the role of these
inputs, which before were all consided to be AXGroup:
- input[type='date']
- input[type='datetime-local']
- input[type='month']
- input[type='time']
- input[type='week']
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@289248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed: