⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267477 in webkit


Ignore:
Timestamp:
Sep 23, 2020, 8:53:01 AM (6 years ago)
Author:
Andres Gonzalez
Message:

Fix for accessibility/aria-combobox-control-owns-elements.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=216878

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/aria-combobox-control-owns-elements.html.

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::updateIsolatedTree): Update the isolated tree
node for ActiveDescendant and SelectedChildren notifications.

  • accessibility/isolatedtree/AXIsolatedObject.cpp:

(WebCore::AXIsolatedObject::initializeAttributeData): Only cache
selectedChildren for those AXObjects that canHaveSelectedChildren.

LayoutTests:

Use Promises to make this test work reliably for both single and multithreaded accessibility modes.

  • accessibility/aria-combobox-control-owns-elements-expected.txt:
  • accessibility/aria-combobox-control-owns-elements.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r267476 r267477  
     12020-09-23  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Fix for accessibility/aria-combobox-control-owns-elements.html in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=216878
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Use Promises to make this test work reliably for both single and multithreaded accessibility modes.
     9
     10        * accessibility/aria-combobox-control-owns-elements-expected.txt:
     11        * accessibility/aria-combobox-control-owns-elements.html:
     12
    1132020-09-23  Darin Adler  <darin@apple.com>
    214
  • trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements-expected.txt

    r227144 r267477  
    1616
    1717PASS list.selectedChildrenCount is 0
    18 PASS list.selectedChildrenCount is 1
    19 PASS list.selectedChildAtIndex(0).isEqual(listitem1) is true
    20 PASS listbox.selectedChildrenCount is 0
    21 PASS listbox.selectedChildrenCount is 1
    22 PASS listbox.selectedChildAtIndex(0).isEqual(option2_1) is true
    23 PASS grid.selectedChildrenCount is 0
    24 PASS grid.selectedChildrenCount is 1
    25 PASS grid.selectedChildAtIndex(0).isEqual(row3_1) is true
    26 PASS tree.selectedChildrenCount is 0
    27 PASS tree.selectedChildrenCount is 1
    28 PASS tree.selectedChildAtIndex(0).isEqual(treeitem4_1) is true
    2918Received AXSelectedChildrenChanged for List1
     19list has 1 selected children
     20PASS list.selectedChildAtIndex(0) is listitem1
     21listbox has 0 selected children
    3022Received AXSelectedChildrenChanged for Listbox2
     23listbox has 1 selected children
     24PASS listbox.selectedChildAtIndex(0) is option2_1
     25grid has 0 selected children
    3126Received AXSelectedRowsChanged for Grid3
     27grid has 1 selected children
     28PASS grid.selectedChildAtIndex(0) is row3_1
     29tree has 0 selected children
    3230Received AXSelectedRowsChanged for Tree4
     31tree has 1 selected children
     32PASS tree.selectedChildAtIndex(0) is treeitem4_1
    3333PASS successfullyParsed is true
    3434
  • trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements.html

    r227144 r267477  
    4040
    4141<script>
    42 
    4342    description("This tests variations of the comboboxes and elements it can control and own. Then verifies the active-descendant is reflected correctly.");
    4443
     
    5251                var targetString = platformValueForW3CName(target);
    5352                debug("Received " + notification + " for " + targetString);
    54                 if (selectedChildrenChangeCount == 4) {
    55                     accessibilityController.removeNotificationListener();
    56                     finishJSTest();
    57                 }
    5853            }
    5954        });
     
    6661        document.getElementById("combobox1").setAttribute("aria-activedescendant", "item1_1");
    6762        var listitem1 = accessibilityController.accessibleElementById("item1_1");
    68         shouldBe("list.selectedChildrenCount", "1");
    69         shouldBeTrue("list.selectedChildAtIndex(0).isEqual(listitem1)");
     63        setTimeout(async function() {
     64            debug("list has " + list.selectedChildrenCount + " selected children");
     65            debug(list.selectedChildAtIndex(0).isEqual(listitem1)
     66                ? "PASS list.selectedChildAtIndex(0) is listitem1"
     67                : "FAIL list.selectedChildAtIndex(0) is not listitem1");
    7068
    71         // Example 2: aria-owns a listbox.
    72         document.getElementById("combobox2").focus();
    73         var listbox = accessibilityController.accessibleElementById("listbox2");
    74         shouldBe("listbox.selectedChildrenCount", "0");
    75         // Set active-descendant, verify notification is sent and that list has correct selected children.
    76         document.getElementById("combobox2").setAttribute("aria-activedescendant", "option2_1");
    77         var option2_1 = accessibilityController.accessibleElementById("option2_1");
    78         shouldBe("listbox.selectedChildrenCount", "1");
    79         shouldBeTrue("listbox.selectedChildAtIndex(0).isEqual(option2_1)");
     69            // Example 2: aria-owns a listbox.
     70            document.getElementById("combobox2").focus();
     71            var listbox = accessibilityController.accessibleElementById("listbox2");
     72            debug("listbox has " + listbox.selectedChildrenCount + " selected children");
     73            // Set active-descendant, verify notification is sent and that list has correct selected children.
     74            document.getElementById("combobox2").setAttribute("aria-activedescendant", "option2_1");
     75            var option2_1 = accessibilityController.accessibleElementById("option2_1");
     76            await waitFor(() => {
     77                return selectedChildrenChangeCount == 2 && listbox.selectedChildrenCount;
     78            });
     79            debug("listbox has " + listbox.selectedChildrenCount + " selected children");
     80            debug(listbox.selectedChildAtIndex(0).isEqual(option2_1)
     81                ? "PASS listbox.selectedChildAtIndex(0) is option2_1"
     82                : "FAIL listbox.selectedChildAtIndex(0) is not option2_1");
    8083
    81         // Example 3: aria-owns a grid.
    82         document.getElementById("combobox3").focus();
    83         var grid = accessibilityController.accessibleElementById("grid3");
    84         shouldBe("grid.selectedChildrenCount", "0");
    85         // Set active-descendant, verify notification is sent and that list has correct selected children.
    86         document.getElementById("combobox3").setAttribute("aria-activedescendant", "row3_1");
    87         var row3_1 = accessibilityController.accessibleElementById("row3_1");
    88         shouldBe("grid.selectedChildrenCount", "1");
    89         shouldBeTrue("grid.selectedChildAtIndex(0).isEqual(row3_1)");
     84            // Example 3: aria-owns a grid.
     85            document.getElementById("combobox3").focus();
     86            var grid = accessibilityController.accessibleElementById("grid3");
     87            debug("grid has " + grid.selectedChildrenCount + " selected children");
     88            // Set active-descendant, verify notification is sent and that list has correct selected children.
     89            document.getElementById("combobox3").setAttribute("aria-activedescendant", "row3_1");
     90            var row3_1 = accessibilityController.accessibleElementById("row3_1");
     91            await waitFor(() => {
     92                return selectedChildrenChangeCount == 3 && grid.selectedChildrenCount;
     93            });
     94            debug("grid has " + grid.selectedChildrenCount + " selected children");
     95            debug(grid.selectedChildAtIndex(0).isEqual(row3_1)
     96                ? "PASS grid.selectedChildAtIndex(0) is row3_1"
     97                : "FAIL grid.selectedChildAtIndex(0) is not row3_1");
    9098
    91         // Example 4: aria-owns a tree.
    92         document.getElementById("combobox4").focus();
    93         var tree = accessibilityController.accessibleElementById("tree4");
    94         shouldBe("tree.selectedChildrenCount", "0");
    95         // Set active-descendant, verify notification is sent and that list has correct selected children.
    96         document.getElementById("combobox4").setAttribute("aria-activedescendant", "treeitem4_1");
    97         var treeitem4_1 = accessibilityController.accessibleElementById("treeitem4_1");
    98         shouldBe("tree.selectedChildrenCount", "1");
    99         shouldBeTrue("tree.selectedChildAtIndex(0).isEqual(treeitem4_1)");
     99            // Example 4: aria-owns a tree.
     100            document.getElementById("combobox4").focus();
     101            var tree = accessibilityController.accessibleElementById("tree4");
     102            debug("tree has " + tree.selectedChildrenCount + " selected children");
     103            // Set active-descendant, verify notification is sent and that list has correct selected children.
     104            document.getElementById("combobox4").setAttribute("aria-activedescendant", "treeitem4_1");
     105            var treeitem4_1 = accessibilityController.accessibleElementById("treeitem4_1");
     106            await waitFor(() => {
     107                return selectedChildrenChangeCount == 4 && tree.selectedChildrenCount;
     108            });
     109            debug("tree has " + tree.selectedChildrenCount + " selected children");
     110            debug(tree.selectedChildAtIndex(0).isEqual(treeitem4_1)
     111                ? "PASS tree.selectedChildAtIndex(0) is treeitem4_1"
     112                : "FAIL tree.selectedChildAtIndex(0) is not treeitem4_1");
     113
     114            accessibilityController.removeNotificationListener();
     115            finishJSTest();
     116        }, 0);
    100117    }
    101 
    102118</script>
    103 
    104119<script src="../resources/js-test-post.js"></script>
    105120</body>
    106121</html>
    107 
  • trunk/Source/WebCore/ChangeLog

    r267474 r267477  
     12020-09-23  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Fix for accessibility/aria-combobox-control-owns-elements.html in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=216878
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Test: accessibility/aria-combobox-control-owns-elements.html.
     9
     10        * accessibility/AXObjectCache.cpp:
     11        (WebCore::AXObjectCache::updateIsolatedTree): Update the isolated tree
     12        node for ActiveDescendant and SelectedChildren notifications.
     13        * accessibility/isolatedtree/AXIsolatedObject.cpp:
     14        (WebCore::AXIsolatedObject::initializeAttributeData): Only cache
     15        selectedChildren for those AXObjects that canHaveSelectedChildren.
     16
    1172020-09-23  Philippe Normand  <pnormand@igalia.com>
    218
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r267363 r267477  
    31833183        tree->updateNodeCheckedState(object);
    31843184        break;
     3185    case AXActiveDescendantChanged:
     3186    case AXSelectedChildrenChanged:
    31853187    case AXSelectedTextChanged:
    31863188    case AXValueChanged:
     
    32453247            tree->updateNodeCheckedState(*notification.first);
    32463248            break;
     3249        case AXActiveDescendantChanged:
     3250        case AXSelectedChildrenChanged:
    32473251        case AXSelectedTextChanged:
    32483252        case AXValueChanged: {
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

    r267320 r267477  
    285285        setProperty(AXPropertyName::TextLength, object.textLength());
    286286
    287     AccessibilityChildrenVector selectedChildren;
    288     object.selectedChildren(selectedChildren);
    289     setObjectVectorProperty(AXPropertyName::SelectedChildren, selectedChildren);
     287    if (object.canHaveSelectedChildren()) {
     288        AccessibilityChildrenVector selectedChildren;
     289        object.selectedChildren(selectedChildren);
     290        setObjectVectorProperty(AXPropertyName::SelectedChildren, selectedChildren);
     291    }
    290292
    291293    AccessibilityChildrenVector visibleChildren;
Note: See TracChangeset for help on using the changeset viewer.