Changeset 208442 in webkit


Ignore:
Timestamp:
Nov 9, 2016 10:25:42 AM (7 years ago)
Author:
jdiggs@igalia.com
Message:

AX: [ATK] Wrong selected element at a given index in a list box (redux)
https://bugs.webkit.org/show_bug.cgi?id=164430

Reviewed by Darin Adler.

Source/WebCore:

This essentially undoes the implementation change resulting from r164577.
As stated in the ATK documentation, atk_selection_ref_selection() takes
"a gint specifying the index in the selection set. (e.g. the ith selection
as opposed to the ith child)." r164577 deliberately modified that, causing
atk_selection_ref_selection() to treat the index as if it were the position
with respect to all of the children. There is different API in ATK, namely
atk_object_ref_accessible_child(), when the ith child from the set of all
children is sought.

Tests: accessibility/aria-listbox-no-selection.html

accessibility/native-listbox-no-selection.html

  • accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:

(optionFromSelection):

LayoutTests:

Add tests to ensure listboxes with no selected children do not report
a selected child. Modify select-element-at-index.html to reflect the
corrected behavior for ATK. Move the Mac port's expectations to the
shared expectations.

  • accessibility/aria-listbox-no-selection-expected.txt: Added.
  • accessibility/aria-listbox-no-selection.html: Added.
  • accessibility/native-listbox-no-selection-expected.txt: Added.
  • accessibility/native-listbox-no-selection.html: Added.
  • accessibility/select-element-at-index-expected.txt: Modified.
  • accessibility/select-element-at-index.html: Modified.
  • platform/mac/accessibility/select-element-at-index-expected.txt: Removed.
Location:
trunk
Files:
4 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208438 r208442  
     12016-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
    1212016-11-09  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/LayoutTests/accessibility/select-element-at-index-expected.txt

    r164577 r208442  
    1515PASS selectElement.selectedChildrenCount is 3
    1616PASS option4.isSelected is true
    17 PASS selectElement.selectedChildAtIndex(3).isEqual(option4) is true
     17PASS selectElement.selectedChildAtIndex(2).isEqual(option4) is true
    1818PASS option4.isSelected is false
    1919PASS selectElement.selectedChildrenCount is 2
  • trunk/LayoutTests/accessibility/select-element-at-index.html

    r189044 r208442  
    4646        shouldBe("selectElement.selectedChildrenCount", "3");
    4747        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);
    5460        else
    55             shouldBeTrue("selectElement.selectedChildAtIndex(3).isEqual(option4)");
    56 
    57         selectElement.removeSelectionAtIndex(3);
     61            selectElement.removeSelectionAtIndex(3);
    5862        shouldBeFalse("option4.isSelected");
    5963        shouldBe("selectElement.selectedChildrenCount", "2");
  • trunk/Source/WebCore/ChangeLog

    r208440 r208442  
     12016-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
    1232016-11-09  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    224
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp

    r174898 r208442  
    9797static AccessibilityObject* optionFromSelection(AtkSelection* selection, gint index)
    9898{
    99     // i is the ith selection as opposed to the ith child.
    100 
    10199    AccessibilityObject* coreSelection = core(selection);
    102100    if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || index < 0)
    103101        return nullptr;
    104102
    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;
    123114}
    124115
     
    228219        return FALSE;
    229220
    230     // TODO: This is only getting called if i == 0. What is preventing the rest?
    231221    AccessibilityObject* option = optionFromSelection(selection, index);
    232222    if (option && (coreSelection->isListBox() || coreSelection->isMenuList())) {
Note: See TracChangeset for help on using the changeset viewer.