Title: [267477] trunk
Revision
267477
Author
[email protected]
Date
2020-09-23 08:53:01 -0700 (Wed, 23 Sep 2020)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (267476 => 267477)


--- trunk/LayoutTests/ChangeLog	2020-09-23 15:50:44 UTC (rev 267476)
+++ trunk/LayoutTests/ChangeLog	2020-09-23 15:53:01 UTC (rev 267477)
@@ -1,3 +1,15 @@
+2020-09-23  Andres Gonzalez  <[email protected]>
+
+        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.
+
+        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:
+
 2020-09-23  Darin Adler  <[email protected]>
 
         Selection API: Update more tests that depend on WebKit's legacy non-standard behavior to set up the selection

Modified: trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements-expected.txt (267476 => 267477)


--- trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements-expected.txt	2020-09-23 15:50:44 UTC (rev 267476)
+++ trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements-expected.txt	2020-09-23 15:53:01 UTC (rev 267477)
@@ -15,21 +15,21 @@
 
 
 PASS list.selectedChildrenCount is 0
-PASS list.selectedChildrenCount is 1
-PASS list.selectedChildAtIndex(0).isEqual(listitem1) is true
-PASS listbox.selectedChildrenCount is 0
-PASS listbox.selectedChildrenCount is 1
-PASS listbox.selectedChildAtIndex(0).isEqual(option2_1) is true
-PASS grid.selectedChildrenCount is 0
-PASS grid.selectedChildrenCount is 1
-PASS grid.selectedChildAtIndex(0).isEqual(row3_1) is true
-PASS tree.selectedChildrenCount is 0
-PASS tree.selectedChildrenCount is 1
-PASS tree.selectedChildAtIndex(0).isEqual(treeitem4_1) is true
 Received AXSelectedChildrenChanged for List1
+list has 1 selected children
+PASS list.selectedChildAtIndex(0) is listitem1
+listbox has 0 selected children
 Received AXSelectedChildrenChanged for Listbox2
+listbox has 1 selected children
+PASS listbox.selectedChildAtIndex(0) is option2_1
+grid has 0 selected children
 Received AXSelectedRowsChanged for Grid3
+grid has 1 selected children
+PASS grid.selectedChildAtIndex(0) is row3_1
+tree has 0 selected children
 Received AXSelectedRowsChanged for Tree4
+tree has 1 selected children
+PASS tree.selectedChildAtIndex(0) is treeitem4_1
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements.html (267476 => 267477)


--- trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements.html	2020-09-23 15:50:44 UTC (rev 267476)
+++ trunk/LayoutTests/accessibility/aria-combobox-control-owns-elements.html	2020-09-23 15:53:01 UTC (rev 267477)
@@ -39,7 +39,6 @@
 <div id="console"></div>
 
 <script>
-
     description("This tests variations of the comboboxes and elements it can control and own. Then verifies the active-descendant is reflected correctly.");
 
     if (window.accessibilityController) {
@@ -51,10 +50,6 @@
                 selectedChildrenChangeCount++;
                 var targetString = platformValueForW3CName(target);
                 debug("Received " + notification + " for " + targetString);
-                if (selectedChildrenChangeCount == 4) {
-                    accessibilityController.removeNotificationListener();
-                    finishJSTest(); 
-                }
             }
         });
 
@@ -65,43 +60,62 @@
         // Set active-descendant, verify notification is sent and that list has correct selected children.
         document.getElementById("combobox1").setAttribute("aria-activedescendant", "item1_1");
         var listitem1 = accessibilityController.accessibleElementById("item1_1");
-        shouldBe("list.selectedChildrenCount", "1");
-        shouldBeTrue("list.selectedChildAtIndex(0).isEqual(listitem1)");
+        setTimeout(async function() {
+            debug("list has " + list.selectedChildrenCount + " selected children");
+            debug(list.selectedChildAtIndex(0).isEqual(listitem1)
+                ? "PASS list.selectedChildAtIndex(0) is listitem1"
+                : "FAIL list.selectedChildAtIndex(0) is not listitem1");
 
-        // Example 2: aria-owns a listbox.
-        document.getElementById("combobox2").focus();
-        var listbox = accessibilityController.accessibleElementById("listbox2");
-        shouldBe("listbox.selectedChildrenCount", "0");
-        // Set active-descendant, verify notification is sent and that list has correct selected children.
-        document.getElementById("combobox2").setAttribute("aria-activedescendant", "option2_1");
-        var option2_1 = accessibilityController.accessibleElementById("option2_1");
-        shouldBe("listbox.selectedChildrenCount", "1");
-        shouldBeTrue("listbox.selectedChildAtIndex(0).isEqual(option2_1)");
+            // Example 2: aria-owns a listbox.
+            document.getElementById("combobox2").focus();
+            var listbox = accessibilityController.accessibleElementById("listbox2");
+            debug("listbox has " + listbox.selectedChildrenCount + " selected children");
+            // Set active-descendant, verify notification is sent and that list has correct selected children.
+            document.getElementById("combobox2").setAttribute("aria-activedescendant", "option2_1");
+            var option2_1 = accessibilityController.accessibleElementById("option2_1");
+            await waitFor(() => {
+                return selectedChildrenChangeCount == 2 && listbox.selectedChildrenCount;
+            });
+            debug("listbox has " + listbox.selectedChildrenCount + " selected children");
+            debug(listbox.selectedChildAtIndex(0).isEqual(option2_1)
+                ? "PASS listbox.selectedChildAtIndex(0) is option2_1"
+                : "FAIL listbox.selectedChildAtIndex(0) is not option2_1");
 
-        // Example 3: aria-owns a grid.
-        document.getElementById("combobox3").focus();
-        var grid = accessibilityController.accessibleElementById("grid3");
-        shouldBe("grid.selectedChildrenCount", "0");
-        // Set active-descendant, verify notification is sent and that list has correct selected children.
-        document.getElementById("combobox3").setAttribute("aria-activedescendant", "row3_1");
-        var row3_1 = accessibilityController.accessibleElementById("row3_1");
-        shouldBe("grid.selectedChildrenCount", "1");
-        shouldBeTrue("grid.selectedChildAtIndex(0).isEqual(row3_1)");
+            // Example 3: aria-owns a grid.
+            document.getElementById("combobox3").focus();
+            var grid = accessibilityController.accessibleElementById("grid3");
+            debug("grid has " + grid.selectedChildrenCount + " selected children");
+            // Set active-descendant, verify notification is sent and that list has correct selected children.
+            document.getElementById("combobox3").setAttribute("aria-activedescendant", "row3_1");
+            var row3_1 = accessibilityController.accessibleElementById("row3_1");
+            await waitFor(() => {
+                return selectedChildrenChangeCount == 3 && grid.selectedChildrenCount;
+            });
+            debug("grid has " + grid.selectedChildrenCount + " selected children");
+            debug(grid.selectedChildAtIndex(0).isEqual(row3_1)
+                ? "PASS grid.selectedChildAtIndex(0) is row3_1"
+                : "FAIL grid.selectedChildAtIndex(0) is not row3_1");
 
-        // Example 4: aria-owns a tree.
-        document.getElementById("combobox4").focus();
-        var tree = accessibilityController.accessibleElementById("tree4");
-        shouldBe("tree.selectedChildrenCount", "0");
-        // Set active-descendant, verify notification is sent and that list has correct selected children.
-        document.getElementById("combobox4").setAttribute("aria-activedescendant", "treeitem4_1");
-        var treeitem4_1 = accessibilityController.accessibleElementById("treeitem4_1");
-        shouldBe("tree.selectedChildrenCount", "1");
-        shouldBeTrue("tree.selectedChildAtIndex(0).isEqual(treeitem4_1)");
+            // Example 4: aria-owns a tree.
+            document.getElementById("combobox4").focus();
+            var tree = accessibilityController.accessibleElementById("tree4");
+            debug("tree has " + tree.selectedChildrenCount + " selected children");
+            // Set active-descendant, verify notification is sent and that list has correct selected children.
+            document.getElementById("combobox4").setAttribute("aria-activedescendant", "treeitem4_1");
+            var treeitem4_1 = accessibilityController.accessibleElementById("treeitem4_1");
+            await waitFor(() => {
+                return selectedChildrenChangeCount == 4 && tree.selectedChildrenCount;
+            });
+            debug("tree has " + tree.selectedChildrenCount + " selected children");
+            debug(tree.selectedChildAtIndex(0).isEqual(treeitem4_1)
+                ? "PASS tree.selectedChildAtIndex(0) is treeitem4_1"
+                : "FAIL tree.selectedChildAtIndex(0) is not treeitem4_1");
+
+            accessibilityController.removeNotificationListener();
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
 <script src=""
 </body>
 </html>
-

Modified: trunk/Source/WebCore/ChangeLog (267476 => 267477)


--- trunk/Source/WebCore/ChangeLog	2020-09-23 15:50:44 UTC (rev 267476)
+++ trunk/Source/WebCore/ChangeLog	2020-09-23 15:53:01 UTC (rev 267477)
@@ -1,3 +1,19 @@
+2020-09-23  Andres Gonzalez  <[email protected]>
+
+        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.
+
+        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.
+
 2020-09-23  Philippe Normand  <[email protected]>
 
         media/can-play-av1.html is not spec compliant

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (267476 => 267477)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-09-23 15:50:44 UTC (rev 267476)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-09-23 15:53:01 UTC (rev 267477)
@@ -3182,6 +3182,8 @@
     case AXCheckedStateChanged:
         tree->updateNodeCheckedState(object);
         break;
+    case AXActiveDescendantChanged:
+    case AXSelectedChildrenChanged:
     case AXSelectedTextChanged:
     case AXValueChanged:
         tree->updateNode(object);
@@ -3244,6 +3246,8 @@
         case AXCheckedStateChanged:
             tree->updateNodeCheckedState(*notification.first);
             break;
+        case AXActiveDescendantChanged:
+        case AXSelectedChildrenChanged:
         case AXSelectedTextChanged:
         case AXValueChanged: {
             bool needsUpdate = appendIfNotContainsMatching(filteredNotifications, notification, [&notification] (const std::pair<RefPtr<AXCoreObject>, AXNotification>& note) {

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (267476 => 267477)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-09-23 15:50:44 UTC (rev 267476)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-09-23 15:53:01 UTC (rev 267477)
@@ -284,9 +284,11 @@
     if (object.isTextControl())
         setProperty(AXPropertyName::TextLength, object.textLength());
 
-    AccessibilityChildrenVector selectedChildren;
-    object.selectedChildren(selectedChildren);
-    setObjectVectorProperty(AXPropertyName::SelectedChildren, selectedChildren);
+    if (object.canHaveSelectedChildren()) {
+        AccessibilityChildrenVector selectedChildren;
+        object.selectedChildren(selectedChildren);
+        setObjectVectorProperty(AXPropertyName::SelectedChildren, selectedChildren);
+    }
 
     AccessibilityChildrenVector visibleChildren;
     object.visibleChildren(visibleChildren);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to