Changeset 208929 in webkit
- Timestamp:
- Nov 19, 2016 1:12:24 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208926 r208929 1 2016-11-19 Joanmarie Diggs <jdiggs@igalia.com> 2 3 AX: [ATK] Implement selection interface and states for elements supporting aria-selected and for menu roles 4 https://bugs.webkit.org/show_bug.cgi?id=164865 5 6 Reviewed by Chris Fleizach. 7 8 New tests for the added support. In addition, update the expectations for 9 aria-combobox.html to reflect the corrected ATK mapping of ListBoxRole for 10 combobox descendants. 11 12 * accessibility/aria-combobox-expected.txt: Updated. 13 * accessibility/aria-combobox-hierarchy.html: Added. 14 * accessibility/aria-selected-menu-items.html: Added. 15 * accessibility/aria-selected.html: Added. 16 * platform/gtk/accessibility/aria-combobox-hierarchy-expected.txt: Added. 17 * platform/gtk/accessibility/aria-selected-expected.txt: Added. 18 * platform/gtk/accessibility/aria-selected-menu-items-expected.txt: Added. 19 * platform/mac/accessibility/aria-combobox-hierarchy-expected.txt: Added. 20 * platform/mac/accessibility/aria-selected-expected.txt: Added. 21 * platform/mac/accessibility/aria-selected-menu-items-expected.txt: Added. 22 1 23 2016-11-18 Simon Fraser <simon.fraser@apple.com> 2 24 -
trunk/LayoutTests/accessibility/aria-combobox-expected.txt
r158810 r208929 9 9 PASS combobox.isExpanded is false 10 10 PASS combobox.isExpanded is false 11 Role: AXRole: AX ListItem11 Role: AXRole: AXMenu 12 12 PASS successfullyParsed is true 13 13 -
trunk/Source/WebCore/ChangeLog
r208927 r208929 1 2016-11-19 Joanmarie Diggs <jdiggs@igalia.com> 2 3 AX: [ATK] Implement selection interface and states for elements supporting aria-selected and for menu roles 4 https://bugs.webkit.org/show_bug.cgi?id=164865 5 6 Reviewed by Chris Fleizach. 7 8 Implement AtkSelection and support ATK_STATE_SELECTABLE and ATK_STATE_SELECTED 9 for elements supporting aria-selected and for menu-related roles. Also enable the 10 equivalent support for the Mac because NSAccessibilitySelectedChildrenAttribute is 11 included as supported on the same roles. 12 13 In addition, fix several bugs discovered along the way: Call isSelected() on role 14 tab, because tab supports aria-selected; not aria-checked. Correct ATK mapping 15 of ListBoxRole and ListBoxOptionRole for combobox descendants. Always defer to 16 WebCore for inclusion/exclusion decisions related to elements with an explicit 17 ARIA role. 18 19 Tests: accessibility/aria-combobox-hierarchy.html 20 accessibility/aria-selected-menu-items.html 21 accessibility/aria-selected.html 22 23 * accessibility/AccessibilityNodeObject.cpp: 24 (WebCore::AccessibilityNodeObject::selectedTabItem): 25 (WebCore::AccessibilityNodeObject::canSetSelectedAttribute): 26 * accessibility/AccessibilityObject.cpp: 27 (WebCore::AccessibilityObject::isDescendantOfRole): 28 * accessibility/AccessibilityObject.h: 29 (WebCore::AccessibilityObject::canHaveSelectedChildren): 30 * accessibility/AccessibilityRenderObject.cpp: 31 (WebCore::AccessibilityRenderObject::isSelected): 32 (WebCore::AccessibilityRenderObject::canHaveSelectedChildren): 33 (WebCore::AccessibilityRenderObject::selectedChildren): 34 * accessibility/AccessibilityRenderObject.h: 35 * accessibility/atk/AccessibilityObjectAtk.cpp: 36 (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): 37 * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: 38 (webkitAccessibleSelectionGetSelectionCount): 39 * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: 40 (atkRole): 41 (getInterfaceMaskFromObject): 42 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 43 (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): 44 1 45 2016-11-19 Simon Fraser <simon.fraser@apple.com> 2 46 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r208739 r208929 934 934 return nullptr; 935 935 936 // FIXME: Is this valid? ARIA tab items support aria-selected; not aria-checked. 936 937 // Find the child tab item that is selected (ie. the intValue == 1). 937 938 AccessibilityObject::AccessibilityChildrenVector tabs; … … 939 940 940 941 for (const auto& child : children()) { 941 if (child->isTabItem() && child->isChecked())942 if (child->isTabItem() && (child->isChecked() || child->isSelected())) 942 943 return child.get(); 943 944 } … … 2177 2178 case TreeItemRole: 2178 2179 case TreeRole: 2180 case MenuItemCheckboxRole: 2181 case MenuItemRadioRole: 2182 case MenuItemRole: 2179 2183 return isEnabled(); 2180 2184 default: -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r208839 r208929 510 510 511 511 return accessibleObject; 512 } 513 514 bool AccessibilityObject::isDescendantOfRole(AccessibilityRole role) const 515 { 516 return AccessibilityObject::matchedParent(*this, false, [&role] (const AccessibilityObject& object) { 517 return object.roleValue() == role; 518 }) != nullptr; 512 519 } 513 520 -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r208924 r208929 687 687 void findMatchingObjects(AccessibilitySearchCriteria*, AccessibilityChildrenVector&); 688 688 virtual bool isDescendantOfBarrenParent() const { return false; } 689 690 bool isDescendantOfRole(AccessibilityRole) const; 689 691 690 692 // Text selection … … 819 821 virtual bool isDetachedFromParent() { return false; } 820 822 823 virtual bool canHaveSelectedChildren() const { return false; } 821 824 virtual void selectedChildren(AccessibilityChildrenVector&) { } 822 825 virtual void visibleChildren(AccessibilityChildrenVector&) { } -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r208924 r208929 1622 1622 return true; 1623 1623 1624 // Menu items are considered selectable by assistive technologies 1625 if (isMenuItem()) 1626 return isFocused() || parentObjectUnignored()->activeDescendant() == this; 1627 1624 1628 return false; 1625 1629 } … … 3275 3279 return elementAttributeValue(aria_busyAttr); 3276 3280 } 3281 3282 bool AccessibilityRenderObject::canHaveSelectedChildren() const 3283 { 3284 switch (roleValue()) { 3285 // These roles are containers whose children support aria-selected: 3286 case GridRole: 3287 case ListBoxRole: 3288 case TabListRole: 3289 case TreeRole: 3290 case TreeGridRole: 3291 // These roles are containers whose children are treated as selected by assistive 3292 // technologies. We can get the "selected" item via aria-activedescendant or the 3293 // focused element. 3294 case MenuRole: 3295 case MenuBarRole: 3296 return true; 3297 default: 3298 return false; 3299 } 3300 } 3277 3301 3278 3302 void AccessibilityRenderObject::ariaSelectedRows(AccessibilityChildrenVector& result) … … 3328 3352 ASSERT(result.isEmpty()); 3329 3353 3330 // only listboxes should be asked for their selected children. 3331 AccessibilityRole role = roleValue(); 3332 if (role == ListBoxRole) // native list boxes would be AccessibilityListBoxes, so only check for aria list boxes 3354 if (!canHaveSelectedChildren()) 3355 return; 3356 3357 switch (roleValue()) { 3358 case ListBoxRole: 3359 // native list boxes would be AccessibilityListBoxes, so only check for aria list boxes 3333 3360 ariaListboxSelectedChildren(result); 3334 else if (role == TreeRole || role == TreeGridRole || role == TableRole || role == GridRole) 3361 return; 3362 case GridRole: 3363 case TreeRole: 3335 3364 ariaSelectedRows(result); 3365 return; 3366 case TabListRole: 3367 if (AccessibilityObject* selectedTab = selectedTabItem()) 3368 result.append(selectedTab); 3369 return; 3370 case MenuRole: 3371 case MenuBarRole: 3372 if (AccessibilityObject* descendant = activeDescendant()) { 3373 result.append(descendant); 3374 return; 3375 } 3376 if (AccessibilityObject* focusedElement = focusedUIElement()) { 3377 result.append(focusedElement); 3378 return; 3379 } 3380 return; 3381 default: 3382 ASSERT_NOT_REACHED(); 3383 } 3336 3384 } 3337 3385 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h
r208924 r208929 153 153 void addChildren() override; 154 154 bool canHaveChildren() const override; 155 bool canHaveSelectedChildren() const override; 155 156 void selectedChildren(AccessibilityChildrenVector&) override; 156 157 void visibleChildren(AccessibilityChildrenVector&) override; -
trunk/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp
r200244 r208929 46 46 return DefaultBehavior; 47 47 48 // If the author has provided a role, platform-specific inclusion likely doesn't apply. 49 if (ariaRoleAttribute() != UnknownRole) 50 return DefaultBehavior; 51 48 52 AccessibilityRole role = roleValue(); 49 53 // We expose the slider as a whole but not its value indicator. -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
r208442 r208929 176 176 return 0; 177 177 178 if (coreSelection->isListBox()) {179 AccessibilityObject::AccessibilityChildrenVector selectedItems;180 coreSelection->selectedChildren(selectedItems);181 return static_cast<gint>(selectedItems.size());182 }183 184 178 if (coreSelection->isMenuList()) { 185 179 RenderObject* renderer = coreSelection->renderer(); … … 191 185 } 192 186 193 return 0; 187 AccessibilityObject::AccessibilityChildrenVector selectedItems; 188 coreSelection->selectedChildren(selectedItems); 189 return static_cast<gint>(selectedItems.size()); 194 190 } 195 191 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
r208924 r208929 583 583 return ATK_ROLE_HEADING; 584 584 case ListBoxRole: 585 return ATK_ROLE_LIST_BOX; 585 // https://rawgit.com/w3c/aria/master/core-aam/core-aam.html#role-map-listbox 586 return coreObject->isDescendantOfRole(ComboBoxRole) ? ATK_ROLE_MENU : ATK_ROLE_LIST_BOX; 586 587 case ListItemRole: 587 588 return coreObject->inheritsPresentationalRole() ? ATK_ROLE_SECTION : ATK_ROLE_LIST_ITEM; 588 589 case ListBoxOptionRole: 589 return ATK_ROLE_LIST_ITEM;590 return coreObject->isDescendantOfRole(ComboBoxRole) ? ATK_ROLE_MENU_ITEM : ATK_ROLE_LIST_ITEM; 590 591 case ParagraphRole: 591 592 return ATK_ROLE_PARAGRAPH; … … 1086 1087 1087 1088 // Selection 1088 if (coreObject-> isListBox() || coreObject->isMenuList())1089 if (coreObject->canHaveSelectedChildren() || coreObject->isMenuList()) 1089 1090 interfaceMask |= 1 << WAISelection; 1090 1091 -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r208924 r208929 2705 2705 2706 2706 if ([attributeName isEqualToString: NSAccessibilitySelectedChildrenAttribute]) { 2707 if (m_object-> isListBox()) {2707 if (m_object->canHaveSelectedChildren()) { 2708 2708 AccessibilityObject::AccessibilityChildrenVector selectedChildrenCopy; 2709 2709 m_object->selectedChildren(selectedChildrenCopy);
Note: See TracChangeset
for help on using the changeset viewer.