Changeset 164577 in webkit
- Timestamp:
- Feb 24, 2014 1:31:12 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r164574 r164577 1 2014-02-24 Krzysztof Czech <k.czech@samsung.com> 2 3 [ATK] Wrong selected element at a given index in a list box. 4 https://bugs.webkit.org/show_bug.cgi?id=129039 5 6 Reviewed by Chris Fleizach. 7 8 Proposed test that checks whether correct element at a given index is retrieved. 9 Also testing some other scenarios such as removing selection from rows, counting all 10 selected rows and setting selection. 11 12 * accessibility/select-element-at-index-expected.txt: Added. 13 * accessibility/select-element-at-index.html: Added. 14 * platform/mac/TestExpectations: Skipping test in Mac, missing implementation. 15 1 16 2014-02-23 Dean Jackson <dino@apple.com> 2 17 -
trunk/LayoutTests/platform/mac/TestExpectations
r164574 r164577 50 50 # isIndeterminate is not implemented in mac 51 51 webkit.org/b/125855 accessibility/aria-checked-mixed-value.html [ Skip ] 52 # Missing implementation of some functions in mac. 53 webkit.org/b/129039 accessibility/select-element-at-index.html [ Skip ] 52 54 53 55 # ariaControlsElementAtIndex is not implemented in mac -
trunk/Source/WebCore/ChangeLog
r164574 r164577 1 2014-02-24 Krzysztof Czech <k.czech@samsung.com> 2 3 [ATK] Wrong selected element at a given index in a list box. 4 https://bugs.webkit.org/show_bug.cgi?id=129039 5 6 Reviewed by Chris Fleizach. 7 8 Test: accessibility/select-element-at-index.html 9 10 The selected element at a given index was wrong. One should be considered among the 11 all children of a list box, not only selected ones. 12 13 * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: 14 (core): 15 (listObjectForSelection): 16 (optionFromList): 17 (optionFromSelection): 18 (webkitAccessibleSelectionRefSelection): 19 1 20 2014-02-23 Dean Jackson <dino@apple.com> 2 21 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
r161873 r164577 46 46 { 47 47 if (!WEBKIT_IS_ACCESSIBLE(selection)) 48 return 0;48 return nullptr; 49 49 50 50 return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(selection)); … … 57 57 // Only list boxes and menu lists supported so far. 58 58 if (!coreSelection->isListBox() && !coreSelection->isMenuList()) 59 return 0;59 return nullptr; 60 60 61 61 // For list boxes the list object is just itself. … … 68 68 const AccessibilityObject::AccessibilityChildrenVector& children = coreSelection->children(); 69 69 if (!children.size()) 70 return 0;70 return nullptr; 71 71 72 72 AccessibilityObject* listObject = children.at(0).get(); 73 73 if (!listObject->isMenuListPopup()) 74 return 0;74 return nullptr; 75 75 76 76 return listObject; … … 81 81 AccessibilityObject* coreSelection = core(selection); 82 82 if (!coreSelection || index < 0) 83 return 0;83 return nullptr; 84 84 85 85 // Need to select the proper list object depending on the type. 86 86 AccessibilityObject* listObject = listObjectForSelection(selection); 87 87 if (!listObject) 88 return 0;88 return nullptr; 89 89 90 90 const AccessibilityObject::AccessibilityChildrenVector& options = listObject->children(); … … 92 92 return options.at(index).get(); 93 93 94 return 0;94 return nullptr; 95 95 } 96 96 … … 101 101 AccessibilityObject* coreSelection = core(selection); 102 102 if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || index < 0) 103 return 0; 104 105 AccessibilityObject::AccessibilityChildrenVector selectedItems; 106 if (coreSelection->isListBox()) 107 coreSelection->selectedChildren(selectedItems); 108 else if (coreSelection->isMenuList()) { 103 return nullptr; 104 105 int selectedIndex = index; 106 if (coreSelection->isMenuList()) { 109 107 RenderObject* renderer = coreSelection->renderer(); 110 108 if (!renderer) 111 return 0;109 return nullptr; 112 110 113 111 HTMLSelectElement* selectNode = toHTMLSelectElement(renderer->node()); 114 int selectedIndex = selectNode->selectedIndex(); 115 const Vector<HTMLElement*> listItems = selectNode->listItems(); 112 if (!selectNode) 113 return nullptr; 114 115 selectedIndex = selectNode->selectedIndex(); 116 const auto& listItems = selectNode->listItems(); 116 117 117 118 if (selectedIndex < 0 || selectedIndex >= static_cast<int>(listItems.size())) 118 return 0; 119 120 return optionFromList(selection, selectedIndex); 121 } 122 123 if (index < static_cast<gint>(selectedItems.size())) 124 return selectedItems.at(index).get(); 125 126 return 0; 119 return nullptr; 120 } 121 122 return optionFromList(selection, selectedIndex); 127 123 } 128 124 … … 167 163 static AtkObject* webkitAccessibleSelectionRefSelection(AtkSelection* selection, gint index) 168 164 { 169 g_return_val_if_fail(ATK_SELECTION(selection), 0);170 returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), 0);165 g_return_val_if_fail(ATK_SELECTION(selection), nullptr); 166 returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), nullptr); 171 167 172 168 AccessibilityObject* option = optionFromSelection(selection, index); … … 177 173 } 178 174 179 return 0;175 return nullptr; 180 176 } 181 177 -
trunk/Tools/ChangeLog
r164562 r164577 1 2014-02-24 Krzysztof Czech <k.czech@samsung.com> 2 3 [ATK] Wrong selected element at a given index in a list box. 4 https://bugs.webkit.org/show_bug.cgi?id=129039 5 6 Reviewed by Chris Fleizach. 7 8 Added missing implementation and proposed some new function for testing selection 9 in a list boxes. 10 11 * DumpRenderTree/AccessibilityUIElement.cpp: 12 (setSelectedChildAtIndexCallback): 13 (removeSelectionAtIndexCallback): 14 (AccessibilityUIElement::getJSClass): 15 * DumpRenderTree/AccessibilityUIElement.h: 16 * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: 17 (AccessibilityUIElement::selectedChildrenCount): 18 (AccessibilityUIElement::selectedChildAtIndex): 19 (AccessibilityUIElement::setSelectedChildAtIndex): 20 (AccessibilityUIElement::removeSelectionAtIndex): 21 * DumpRenderTree/win/AccessibilityUIElementWin.cpp: 22 (AccessibilityUIElement::selectedChildrenCount): 23 (AccessibilityUIElement::selectedChildAtIndex): 24 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: 25 (WTR::AccessibilityUIElement::setSelectedChildAtIndex): 26 (WTR::AccessibilityUIElement::removeSelectionAtIndex): 27 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: 28 * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: 29 * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: 30 (WTR::AccessibilityUIElement::selectedChildAtIndex): 31 (WTR::AccessibilityUIElement::selectedChildrenCount): 32 (WTR::AccessibilityUIElement::setSelectedChildAtIndex): 33 (WTR::AccessibilityUIElement::removeSelectionAtIndex): 34 1 35 2014-02-23 Diego Pino García <dpino@igalia.com> 2 36 -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp
r164270 r164577 1208 1208 } 1209 1209 1210 static JSValueRef setSelectedChildAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1211 { 1212 int indexNumber = -1; 1213 if (argumentCount == 1); 1214 indexNumber = JSValueToNumber(context, arguments[0], exception); 1215 1216 if (indexNumber >= 0) 1217 toAXElement(thisObject)->setSelectedChildAtIndex(indexNumber); 1218 return JSValueMakeUndefined(context); 1219 } 1220 1221 static JSValueRef removeSelectionAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1222 { 1223 int indexNumber = -1; 1224 if (argumentCount == 1) 1225 indexNumber = JSValueToNumber(context, arguments[0], exception); 1226 1227 if (indexNumber >= 0) 1228 toAXElement(thisObject)->removeSelectionAtIndex(indexNumber); 1229 return JSValueMakeUndefined(context); 1230 } 1231 1210 1232 #elif PLATFORM(IOS) 1211 1233 … … 1293 1315 JSStringRef AccessibilityUIElement::rangeForPosition(int, int) { return 0; } 1294 1316 void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement*) const { } 1295 unsigned AccessibilityUIElement::selectedChildrenCount() const { return 0; }1296 AccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned) const { return 0; }1297 1317 AccessibilityUIElement AccessibilityUIElement::horizontalScrollbar() const { return 0; } 1298 1318 AccessibilityUIElement AccessibilityUIElement::verticalScrollbar() const { return 0; } … … 1596 1616 { "lineAtOffset", lineAtOffsetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1597 1617 { "sentenceAtOffset", sentenceAtOffsetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1618 { "setSelectedChildAtIndex", setSelectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1619 { "removeSelectionAtIndex", removeSelectionAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1598 1620 #elif PLATFORM(IOS) 1599 1621 { "linkedElement", linkedElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.h
r164270 r164577 149 149 unsigned selectedChildrenCount() const; 150 150 AccessibilityUIElement selectedChildAtIndex(unsigned) const; 151 void setSelectedChildAtIndex(unsigned) const; 152 void removeSelectionAtIndex(unsigned) const; 151 153 152 154 bool isExpanded() const; -
trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp
r164165 r164577 1624 1624 } 1625 1625 1626 unsigned AccessibilityUIElement::selectedChildrenCount() const 1627 { 1628 if (!ATK_IS_SELECTION(m_element)) 1629 return 0; 1630 1631 return atk_selection_get_selection_count(ATK_SELECTION(m_element)); 1632 } 1633 1634 AccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned index) const 1635 { 1636 if (!ATK_IS_SELECTION(m_element)) 1637 return nullptr; 1638 1639 GRefPtr<AtkObject> child = adoptGRef(atk_selection_ref_selection(ATK_SELECTION(m_element), index)); 1640 return child ? AccessibilityUIElement(child.get()) : nullptr; 1641 } 1642 1643 void AccessibilityUIElement::setSelectedChildAtIndex(unsigned index) const 1644 { 1645 if (!ATK_IS_SELECTION(m_element)) 1646 return; 1647 1648 atk_selection_add_selection(ATK_SELECTION(m_element), index); 1649 } 1650 1651 void AccessibilityUIElement::removeSelectionAtIndex(unsigned index) const 1652 { 1653 if (!ATK_IS_SELECTION(m_element)) 1654 return; 1655 1656 atk_selection_remove_selection(ATK_SELECTION(m_element), index); 1657 } 1658 1626 1659 #endif -
trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
r164165 r164577 874 874 return 0; 875 875 } 876 877 unsigned AccessibilityUIElement::selectedChildrenCount() const 878 { 879 // FIXME: implement 880 return 0; 881 } 882 883 AccessibilityUIElement AccessibilityUIElement::selectedChildAtIndex(unsigned) const 884 { 885 // FIXME: implement 886 return 0; 887 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
r164295 r164577 60 60 JSRetainPtr<JSStringRef> AccessibilityUIElement::lineAtOffset(int) { return 0; } 61 61 JSRetainPtr<JSStringRef> AccessibilityUIElement::sentenceAtOffset(int) { return 0; } 62 void AccessibilityUIElement::setSelectedChildAtIndex(unsigned) const { } 63 void AccessibilityUIElement::removeSelectionAtIndex(unsigned) const { } 62 64 #endif 63 65 -
trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
r164295 r164577 142 142 bool isMultiSelectable() const; 143 143 void setSelectedChild(AccessibilityUIElement*) const; 144 void setSelectedChildAtIndex(unsigned) const; 145 void removeSelectionAtIndex(unsigned) const; 144 146 unsigned selectedChildrenCount() const; 145 147 PassRefPtr<AccessibilityUIElement> selectedChildAtIndex(unsigned) const; -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
r164165 r164577 38 38 AccessibilityUIElement selectedChildAtIndex(unsigned long index); 39 39 void setSelectedChild(AccessibilityUIElement element); 40 void setSelectedChildAtIndex(unsigned long index); 41 void removeSelectionAtIndex(unsigned long index); 40 42 AccessibilityUIElement titleUIElement(); 41 43 AccessibilityUIElement parentElement(); -
trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
r164165 r164577 702 702 PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::selectedChildAtIndex(unsigned index) const 703 703 { 704 // FIXME: implement 705 return nullptr; 704 if (!ATK_SELECTION(m_element.get())) 705 return nullptr; 706 707 GRefPtr<AtkObject> child = adoptGRef(atk_selection_ref_selection(ATK_SELECTION(m_element.get()), index)); 708 return child ? AccessibilityUIElement::create(child.get()) : nullptr; 706 709 } 707 710 708 711 unsigned AccessibilityUIElement::selectedChildrenCount() const 709 712 { 710 // FIXME: implement 711 return 0; 713 if (!ATK_IS_SELECTION(m_element.get())) 714 return 0; 715 return atk_selection_get_selection_count(ATK_SELECTION(m_element.get())); 712 716 } 713 717 … … 1464 1468 { 1465 1469 // FIXME: implement 1470 } 1471 1472 void AccessibilityUIElement::setSelectedChildAtIndex(unsigned index) const 1473 { 1474 if (!ATK_IS_SELECTION(m_element.get())) 1475 return; 1476 1477 atk_selection_add_selection(ATK_SELECTION(m_element.get()), index); 1478 } 1479 1480 void AccessibilityUIElement::removeSelectionAtIndex(unsigned index) const 1481 { 1482 if (!ATK_IS_SELECTION(m_element.get())) 1483 return; 1484 1485 atk_selection_remove_selection(ATK_SELECTION(m_element.get()), index); 1466 1486 } 1467 1487
Note: See TracChangeset
for help on using the changeset viewer.