Changeset 208442 in webkit
- Timestamp:
- Nov 9, 2016 10:25:42 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208438 r208442 1 2016-11-09 Joanmarie Diggs <jdiggs@igalia.com> 2 3 AX: [ATK] Wrong selected element at a given index in a list box (redux) 4 https://bugs.webkit.org/show_bug.cgi?id=164430 5 6 Reviewed by Darin Adler. 7 8 Add tests to ensure listboxes with no selected children do not report 9 a selected child. Modify select-element-at-index.html to reflect the 10 corrected behavior for ATK. Move the Mac port's expectations to the 11 shared expectations. 12 13 * accessibility/aria-listbox-no-selection-expected.txt: Added. 14 * accessibility/aria-listbox-no-selection.html: Added. 15 * accessibility/native-listbox-no-selection-expected.txt: Added. 16 * accessibility/native-listbox-no-selection.html: Added. 17 * accessibility/select-element-at-index-expected.txt: Modified. 18 * accessibility/select-element-at-index.html: Modified. 19 * platform/mac/accessibility/select-element-at-index-expected.txt: Removed. 20 1 21 2016-11-09 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/LayoutTests/accessibility/select-element-at-index-expected.txt
r164577 r208442 15 15 PASS selectElement.selectedChildrenCount is 3 16 16 PASS option4.isSelected is true 17 PASS selectElement.selectedChildAtIndex( 3).isEqual(option4) is true17 PASS selectElement.selectedChildAtIndex(2).isEqual(option4) is true 18 18 PASS option4.isSelected is false 19 19 PASS selectElement.selectedChildrenCount is 2 -
trunk/LayoutTests/accessibility/select-element-at-index.html
r189044 r208442 46 46 shouldBe("selectElement.selectedChildrenCount", "3"); 47 47 shouldBeTrue("option4.isSelected"); 48 49 // On mac, selectedChildAtIndex is using the index to retrieve the element 50 // from the selected children array. Here, the selected children array has 51 // size 3, so the index should be 2. 52 if (accessibilityController.platformName == "mac") 53 shouldBeTrue("selectElement.selectedChildAtIndex(2).isEqual(option4)"); 48 49 // The index expected by selectedChildAtIndex is with respect to the array of 50 // selected children; not the array of all children. The element whose text is 51 // "Option 4" is the third of three selected items, thus the index should be 2. 52 shouldBeTrue("selectElement.selectedChildAtIndex(2).isEqual(option4)"); 53 54 // atk_selection_remove_selection() works like atk_selection_ref_selection() 55 // in that the index is with respect to the array of selected children; not 56 // the array of all children. Thus to remove the selection from "Option 4" 57 // in ATK, we again need to specify an index of 2. 58 if (accessibilityController.platformName == "atk") 59 selectElement.removeSelectionAtIndex(2); 54 60 else 55 shouldBeTrue("selectElement.selectedChildAtIndex(3).isEqual(option4)"); 56 57 selectElement.removeSelectionAtIndex(3); 61 selectElement.removeSelectionAtIndex(3); 58 62 shouldBeFalse("option4.isSelected"); 59 63 shouldBe("selectElement.selectedChildrenCount", "2"); -
trunk/Source/WebCore/ChangeLog
r208440 r208442 1 2016-11-09 Joanmarie Diggs <jdiggs@igalia.com> 2 3 AX: [ATK] Wrong selected element at a given index in a list box (redux) 4 https://bugs.webkit.org/show_bug.cgi?id=164430 5 6 Reviewed by Darin Adler. 7 8 This essentially undoes the implementation change resulting from r164577. 9 As stated in the ATK documentation, atk_selection_ref_selection() takes 10 "a gint specifying the index in the selection set. (e.g. the ith selection 11 as opposed to the ith child)." r164577 deliberately modified that, causing 12 atk_selection_ref_selection() to treat the index as if it were the position 13 with respect to all of the children. There is different API in ATK, namely 14 atk_object_ref_accessible_child(), when the ith child from the set of all 15 children is sought. 16 17 Tests: accessibility/aria-listbox-no-selection.html 18 accessibility/native-listbox-no-selection.html 19 20 * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: 21 (optionFromSelection): 22 1 23 2016-11-09 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 24 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
r174898 r208442 97 97 static AccessibilityObject* optionFromSelection(AtkSelection* selection, gint index) 98 98 { 99 // i is the ith selection as opposed to the ith child.100 101 99 AccessibilityObject* coreSelection = core(selection); 102 100 if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || index < 0) 103 101 return nullptr; 104 102 105 int selectedIndex = index; 106 if (coreSelection->isMenuList()) { 107 RenderObject* renderer = coreSelection->renderer(); 108 if (!renderer) 109 return nullptr; 110 111 HTMLSelectElement* selectNode = downcast<HTMLSelectElement>(renderer->node()); 112 if (!selectNode) 113 return nullptr; 114 115 selectedIndex = selectNode->selectedIndex(); 116 const auto& listItems = selectNode->listItems(); 117 118 if (selectedIndex < 0 || selectedIndex >= static_cast<int>(listItems.size())) 119 return nullptr; 120 } 121 122 return optionFromList(selection, selectedIndex); 103 // This method provides the functionality expected by atk_selection_ref_selection(). 104 // According to the ATK documentation for this method, the index is "a gint specifying 105 // the index in the selection set. (e.g. the ith selection as opposed to the ith child)." 106 // There is different API, namely atk_object_ref_accessible_child(), when the ith child 107 // from the set of all children is sought. 108 AccessibilityObject::AccessibilityChildrenVector options; 109 coreSelection->selectedChildren(options); 110 if (index < static_cast<gint>(options.size())) 111 return options.at(index).get(); 112 113 return nullptr; 123 114 } 124 115 … … 228 219 return FALSE; 229 220 230 // TODO: This is only getting called if i == 0. What is preventing the rest?231 221 AccessibilityObject* option = optionFromSelection(selection, index); 232 222 if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) {
Note: See TracChangeset
for help on using the changeset viewer.