Changeset 227144 in webkit
- Timestamp:
- Jan 18, 2018 9:26:23 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r227143 r227144 1 2018-01-18 Chris Fleizach <cfleizach@apple.com> 2 3 AX: Aria-activedescendant not supported 4 https://bugs.webkit.org/show_bug.cgi?id=161734 5 <rdar://problem/28202679> 6 7 Reviewed by Joanmarie Diggs. 8 9 * accessibility/aria-combobox-control-owns-elements-expected.txt: Added. 10 * accessibility/aria-combobox-control-owns-elements.html: Added. 11 1 12 2018-01-18 Per Arne Vollan <pvollan@apple.com> 2 13 -
trunk/LayoutTests/accessibility/lists-expected.txt
r198356 r227144 39 39 AXEditableAncestor: (null) 40 40 AXHighestEditableAncestor: (null) 41 AXSelectedChildren: (null)41 AXSelectedChildren: <array of size 0> 42 42 AXVisibleChildren: <array of size 2> 43 43 AXOrientation: AXVerticalOrientation … … 73 73 AXEditableAncestor: (null) 74 74 AXHighestEditableAncestor: (null) 75 AXSelectedChildren: (null)75 AXSelectedChildren: <array of size 0> 76 76 AXVisibleChildren: <array of size 2> 77 77 AXOrientation: AXVerticalOrientation -
trunk/Source/WebCore/ChangeLog
r227141 r227144 1 2018-01-18 Chris Fleizach <cfleizach@apple.com> 2 3 AX: Aria-activedescendant not supported 4 https://bugs.webkit.org/show_bug.cgi?id=161734 5 <rdar://problem/28202679> 6 7 Reviewed by Joanmarie Diggs. 8 9 When a combo-box owns/controls a list/listbox/grid/tree, the owned element needs to check the active-descendant of the combobox when 10 checking if it has selected children. 11 The target of the selection change notification should also be the owned element in these cases. 12 13 Test: accessibility/aria-combobox-controlling-list.html 14 15 * accessibility/AccessibilityObject.cpp: 16 (WebCore::AccessibilityObject::selectedListItem): 17 * accessibility/AccessibilityObject.h: 18 * accessibility/AccessibilityRenderObject.cpp: 19 (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const): 20 (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged): 21 (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const): 22 (WebCore::AccessibilityRenderObject::selectedChildren): 23 * accessibility/AccessibilityRenderObject.h: 24 * accessibility/mac/AXObjectCacheMac.mm: 25 (WebCore::AXObjectCache::postPlatformNotification): 26 1 27 2018-01-17 Per Arne Vollan <pvollan@apple.com> 2 28 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r227006 r227144 3411 3411 return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(*element).isPasswordField(); 3412 3412 } 3413 3414 AccessibilityObject* AccessibilityObject::selectedListItem() 3415 { 3416 for (const auto& child : children()) { 3417 if (child->isListItem() && (child->isSelected() || child->isActiveDescendantOfFocusedContainer())) 3418 return child.get(); 3419 } 3420 3421 return nullptr; 3422 } 3413 3423 3414 3424 void AccessibilityObject::ariaElementsFromAttribute(AccessibilityChildrenVector& children, const QualifiedName& attributeName) const -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r226432 r227144 661 661 virtual AccessibilityObject* selectedRadioButton() { return nullptr; } 662 662 virtual AccessibilityObject* selectedTabItem() { return nullptr; } 663 AccessibilityObject* selectedListItem(); 663 664 virtual int layoutCount() const { return 0; } 664 665 virtual double estimatedLoadingProgress() const { return 0; } -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r226432 r227144 2496 2496 cache->postNotification(this, document(), AXObjectCache::AXExpandedChanged); 2497 2497 } 2498 2499 RenderObject* AccessibilityRenderObject::targetElementForActiveDescendant(const QualifiedName& attributeName, AccessibilityObject* activeDescendant) const 2500 { 2501 AccessibilityObject::AccessibilityChildrenVector elements; 2502 ariaElementsFromAttribute(elements, attributeName); 2503 for (auto element : elements) { 2504 if (activeDescendant->isDescendantOfObject(element.get())) 2505 return element->renderer(); 2506 } 2507 2508 return nullptr; 2509 } 2498 2510 2499 2511 void AccessibilityRenderObject::handleActiveDescendantChanged() … … 2505 2517 return; 2506 2518 2507 if (activeDescendant() && shouldNotifyActiveDescendant()) 2508 renderer()->document().axObjectCache()->postNotification(renderer(), AXObjectCache::AXActiveDescendantChanged); 2519 auto* activeDescendant = this->activeDescendant(); 2520 if (activeDescendant && shouldNotifyActiveDescendant()) { 2521 auto* targetRenderer = renderer(); 2522 2523 #if PLATFORM(COCOA) 2524 // If the combobox's activeDescendant is inside another object, the target element should be that parent. 2525 if (isComboBox()) { 2526 if (auto* ariaOwner = targetElementForActiveDescendant(aria_ownsAttr, activeDescendant)) 2527 targetRenderer = ariaOwner; 2528 else if (auto* ariaController = targetElementForActiveDescendant(aria_controlsAttr, activeDescendant)) 2529 targetRenderer = ariaController; 2530 } 2531 #endif 2532 2533 renderer()->document().axObjectCache()->postNotification(targetRenderer, AXObjectCache::AXActiveDescendantChanged); 2534 } 2509 2535 } 2510 2536 … … 3300 3326 case AccessibilityRole::Tree: 3301 3327 case AccessibilityRole::TreeGrid: 3328 case AccessibilityRole::List: 3302 3329 // These roles are containers whose children are treated as selected by assistive 3303 3330 // technologies. We can get the "selected" item via aria-activedescendant or the … … 3327 3354 auto rowsIteration = [&](auto& rows) { 3328 3355 for (auto& row : rows) { 3329 if (row->isSelected() ) {3356 if (row->isSelected() || row->isActiveDescendantOfFocusedContainer()) { 3330 3357 result.append(row); 3331 3358 if (!isMulti) … … 3351 3378 for (const auto& child : children()) { 3352 3379 // Every child should have aria-role option, and if so, check for selected attribute/state. 3353 if (child-> isSelected() && child->ariaRoleAttribute() == AccessibilityRole::ListBoxOption) {3380 if (child->ariaRoleAttribute() == AccessibilityRole::ListBoxOption && (child->isSelected() || child->isActiveDescendantOfFocusedContainer())) { 3354 3381 result.append(child); 3355 3382 if (!isMulti) … … 3379 3406 if (AccessibilityObject* selectedTab = selectedTabItem()) 3380 3407 result.append(selectedTab); 3408 return; 3409 case AccessibilityRole::List: 3410 if (auto* selectedListItemChild = selectedListItem()) 3411 result.append(selectedListItemChild); 3381 3412 return; 3382 3413 case AccessibilityRole::Menu: -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h
r226432 r227144 286 286 bool shouldGetTextFromNode(AccessibilityTextUnderElementMode) const; 287 287 288 RenderObject* targetElementForActiveDescendant(const QualifiedName&, AccessibilityObject*) const; 288 289 bool canHavePlainText() const; 289 290 }; -
trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
r222898 r227144 272 272 case AXActiveDescendantChanged: 273 273 // An active descendant change for trees means a selected rows change. 274 if (obj->isTree() )274 if (obj->isTree() || obj->isTable()) 275 275 macNotification = NSAccessibilitySelectedRowsChangedNotification; 276 276 … … 278 278 // list has changed. In these cases we should use selected children changed, because 279 279 // we don't want the focus to change away from the combobox where the user is typing. 280 else if (obj->isComboBox() )280 else if (obj->isComboBox() || obj->isList() || obj->isListBox()) 281 281 macNotification = NSAccessibilitySelectedChildrenChangedNotification; 282 282 else
Note: See TracChangeset
for help on using the changeset viewer.