RESOLVED FIXED 255371
Make AXCoreObject::visibleChildren, AXCoreObject::isPresentationalChildOfAriaRole, and AXCoreObject::ariaRoleHasPresentationalChildren work for display:contents elements
https://bugs.webkit.org/show_bug.cgi?id=255371
Summary Make AXCoreObject::visibleChildren, AXCoreObject::isPresentationalChildOfAria...
Tyler Wilcock
Reported 2023-04-12 15:31:41 PDT
None of these methods inherently require a renderer, but are still only implemented for AccessibilityRenderObject.
Attachments
Patch (18.28 KB, patch)
2023-04-12 15:34 PDT, Tyler Wilcock
no flags
Patch (18.23 KB, patch)
2023-04-13 12:00 PDT, Tyler Wilcock
no flags
Patch (19.69 KB, patch)
2023-04-13 15:28 PDT, Tyler Wilcock
no flags
Radar WebKit Bug Importer
Comment 1 2023-04-12 15:31:53 PDT
Tyler Wilcock
Comment 2 2023-04-12 15:34:52 PDT
chris fleizach
Comment 3 2023-04-13 11:52:51 PDT
Comment on attachment 465874 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=465874&action=review > Source/WebCore/accessibility/AccessibilityListBox.cpp:128 > + for (unsigned i = 0; i < m_children.size(); i++) { can we cache size() so we don't call it repeatedly on each iteration
Tyler Wilcock
Comment 4 2023-04-13 12:00:40 PDT
Tyler Wilcock
Comment 5 2023-04-13 12:06:09 PDT
(In reply to chris fleizach from comment #3) > Comment on attachment 465874 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=465874&action=review > > > Source/WebCore/accessibility/AccessibilityListBox.cpp:128 > > + for (unsigned i = 0; i < m_children.size(); i++) { > > can we cache size() so we don't call it repeatedly on each iteration Fixed, thanks.
Andres Gonzalez
Comment 6 2023-04-13 12:07:43 PDT
(In reply to chris fleizach from comment #3) > Comment on attachment 465874 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=465874&action=review > > > Source/WebCore/accessibility/AccessibilityListBox.cpp:128 > > + for (unsigned i = 0; i < m_children.size(); i++) { > > can we cache size() so we don't call it repeatedly on each iteration No need to do that, size() is an inline accessor in std-like containers like Vector.
Andres Gonzalez
Comment 7 2023-04-13 12:54:19 PDT
(In reply to Tyler Wilcock from comment #4) > Created attachment 465896 [details] > Patch --- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp +AXCoreObject::AccessibilityChildrenVector AccessibilityNodeObject::visibleChildren() +{ + // Only listboxes are asked for their visible children. + // Native list boxes would be AccessibilityListBoxes, so only check for aria list boxes. + if (ariaRoleAttribute() != AccessibilityRole::ListBox) + return { }; Can we unify native and ARIA list boxes in the AXListbox class? + for (const auto& child : children()) { + if (child->isOffScreen()) isOffScreen() ? I would think that visible child would be on screen. --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp +bool AccessibilityObject::isPresentationalChildOfAriaRole() const +{ + // Walk the parent chain looking for a parent that has presentational children + AccessibilityObject* parent; + for (parent = parentObject(); parent && !parent->ariaRoleHasPresentationalChildren(); parent = parent->parentObject()) + { } Can we do this with findAncestor? --- a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp +++ b/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp - AccessibilityChildrenVector visibleChildren; - object.visibleChildren(visibleChildren); - setObjectVectorProperty(AXPropertyName::VisibleChildren, visibleChildren); + setObjectVectorProperty(AXPropertyName::VisibleChildren, object.visibleChildren()); Since this is used only for list boxes, should we just cache it in that case? Or maybe better, only if it is not an empty Vector?
Tyler Wilcock
Comment 8 2023-04-13 15:28:48 PDT
Tyler Wilcock
Comment 9 2023-04-13 15:36:07 PDT
> --- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp > +++ b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp > > +AXCoreObject::AccessibilityChildrenVector > AccessibilityNodeObject::visibleChildren() > +{ > + // Only listboxes are asked for their visible children. > + // Native list boxes would be AccessibilityListBoxes, so only check for > aria list boxes. > + if (ariaRoleAttribute() != AccessibilityRole::ListBox) > + return { }; > > Can we unify native and ARIA list boxes in the AXListbox class? ARIA list boxes may not have a renderer, while AccessibilityListBox is a subclass of AccessibilityRenderObject, so I don't think so. We could consider removing the AccessibilityListBox implementation in the future, but let's save that for a future patch. > + for (const auto& child : children()) { > + if (child->isOffScreen()) > > isOffScreen() ? I would think that visible child would be on screen. Wow, yeah, this was totally wrong. It's interesting because we don't have any layout tests covering this attribute for listboxes (ARIA or native). And after adding some logging, VoiceOver doesn't seem to request it for ARIA or native listboxes. Maybe we can consider removing it entirely in a future patch (pending more investigation of how it's used). > --- a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp > +++ b/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp > > - AccessibilityChildrenVector visibleChildren; > - object.visibleChildren(visibleChildren); > - setObjectVectorProperty(AXPropertyName::VisibleChildren, > visibleChildren); > + setObjectVectorProperty(AXPropertyName::VisibleChildren, > object.visibleChildren()); > > Since this is used only for list boxes, should we just cache it in that > case? Or maybe better, only if it is not an empty Vector? Added a check for isListBox(). Not caching in the case of an empty Vector should be accomplished by a future patch where we don't cache any property of type T if it is equal to T(). Addressed all other review comments. Please re-review when you get a moment. Thanks!
EWS
Comment 10 2023-04-17 09:48:51 PDT
Committed 263025@main (ee7f5c504b70): <https://commits.webkit.org/263025@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 465899 [details].
Note You need to log in before you can comment on or make changes to this bug.