Title: [293212] trunk
Revision
293212
Author
tyle...@apple.com
Date
2022-04-22 00:02:14 -0700 (Fri, 22 Apr 2022)

Log Message

AX: The isolated tree is not updated after role changes in AccessibilityRenderObject::updateRoleAfterChildrenCreation()
https://bugs.webkit.org/show_bug.cgi?id=239549

Reviewed by Chris Fleizach and Andres Gonzalez.

Source/WebCore:

In AccessibilityRenderObject::updateRoleAfterChildrenCreation(), if the objects role changes,
we need to inform the cache via AXObjectCache::handleRoleChange which in turn will
update the isolated tree.

Fixes accessibility/mac/invalid-menu-role-does-not-send-notification.html in isolated tree mode.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):

LayoutTests:

* accessibility/mac/invalid-menu-role-does-not-send-notification-expected.txt:
* accessibility/mac/invalid-menu-role-does-not-send-notification.html:
Update test to use async-await to actually wait for changes to happen,
which is required to make the test pass in isolated tree mode.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (293211 => 293212)


--- trunk/LayoutTests/ChangeLog	2022-04-22 06:08:39 UTC (rev 293211)
+++ trunk/LayoutTests/ChangeLog	2022-04-22 07:02:14 UTC (rev 293212)
@@ -1,3 +1,15 @@
+2022-04-22  Tyler Wilcock  <tyle...@apple.com>
+
+        AX: The isolated tree is not updated after role changes in AccessibilityRenderObject::updateRoleAfterChildrenCreation()
+        https://bugs.webkit.org/show_bug.cgi?id=239549
+
+        Reviewed by Chris Fleizach and Andres Gonzalez.
+
+        * accessibility/mac/invalid-menu-role-does-not-send-notification-expected.txt:
+        * accessibility/mac/invalid-menu-role-does-not-send-notification.html:
+        Update test to use async-await to actually wait for changes to happen,
+        which is required to make the test pass in isolated tree mode.
+
 2022-04-21  Andres Gonzalez  <andresg...@apple.com>
 
         AX ITM: Fix for multiple flaky tests in isolated tree mode.

Modified: trunk/LayoutTests/accessibility/mac/invalid-menu-role-does-not-send-notification-expected.txt (293211 => 293212)


--- trunk/LayoutTests/accessibility/mac/invalid-menu-role-does-not-send-notification-expected.txt	2022-04-22 06:08:39 UTC (rev 293211)
+++ trunk/LayoutTests/accessibility/mac/invalid-menu-role-does-not-send-notification-expected.txt	2022-04-22 07:02:14 UTC (rev 293212)
@@ -1,9 +1,7 @@
 This tests that the AXMenuOpened notification does not get fired for a menu that is invalid (does not have a menu item child).
 
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+The item should not have a menu role: AXRole: AXGroup
 
-
-The item should not have a menu role: AXRole: AXGroup
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/mac/invalid-menu-role-does-not-send-notification.html (293211 => 293212)


--- trunk/LayoutTests/accessibility/mac/invalid-menu-role-does-not-send-notification.html	2022-04-22 06:08:39 UTC (rev 293211)
+++ trunk/LayoutTests/accessibility/mac/invalid-menu-role-does-not-send-notification.html	2022-04-22 07:02:14 UTC (rev 293212)
@@ -1,58 +1,46 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
 <body id="body">
 
 <div id="content">
-<div id="menu1" role="menu" hidden>
-<a href=""
+    <div id="menu" role="menu" hidden>
+        <a href=""
+    </div>
 </div>
-</div>
 
-
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
+    var testOutput = "This tests that the AXMenuOpened notification does not get fired for a menu that is invalid (does not have a menu item child).\n\n";
 
-    description("This tests that the AXMenuOpened notification does not get fired for a menu that is invalid (does not have a menu item child).");
-
-    function showMenu(menu) {
-        document.getElementById("menu1").removeAttribute("hidden");
-        debug("The item should not have a menu role: " + accessibilityController.accessibleElementById('menu1').role);
-    }
-
-    var notification = 0;
-    var element = 0;
-    function ariaCallback(element, notification) {
-        if (notification == "AXMenuOpened") {
-           debug("FAIL Received menu opened notification: " + notification);
-        }
-    }
-
     function endTest() {
-       document.getElementById("content").style.display = 'none';
-       accessibilityController.removeNotificationListener();
-       finishJSTest();
+        document.getElementById("content").style.display = "none";
+        accessibilityController.removeNotificationListener();
+        debug(testOutput);
+        finishJSTest();
     }
 
-    window.jsTestIsAsync = true;
     if (window.accessibilityController) {
-        var addedNotification = accessibilityController.addNotificationListener(ariaCallback);
+        window.jsTestIsAsync = true;
 
-        // Make sure AX is enabled by accessing root element.
-        accessibilityController.rootElement;
+        accessibilityController.addNotificationListener((element, notification) => {
+            if (notification == "AXMenuOpened")
+                testOutput += `FAIL Received menu opened notification: ${notification}`;
+        });
+        setTimeout(async () => {
+            document.getElementById("menu").removeAttribute("hidden");
+            await waitFor(() => {
+                const menu = accessibilityController.accessibleElementById("menu");
+                return menu && !menu.role.includes("Menu");
+            });
+            testOutput += `The item should not have a menu role: ${accessibilityController.accessibleElementById("menu").role}\n`;
 
-        setTimeout("showMenu();", 1);
-        // We should not actually get this notification, so end the test after a short time when we 'might' have gotten the notification.
-        setTimeout("endTest();", 100);
+            // We should not actually get this notification, so end the test after a short time when we 'might' have gotten the notification.
+            setTimeout("endTest()", 100);
+        }, 0);
     }
-    successfullyParsed = true;
-
 </script>
-
-<script src=""
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (293211 => 293212)


--- trunk/Source/WebCore/ChangeLog	2022-04-22 06:08:39 UTC (rev 293211)
+++ trunk/Source/WebCore/ChangeLog	2022-04-22 07:02:14 UTC (rev 293212)
@@ -1,3 +1,19 @@
+2022-04-22  Tyler Wilcock  <tyle...@apple.com>
+
+        AX: The isolated tree is not updated after role changes in AccessibilityRenderObject::updateRoleAfterChildrenCreation()
+        https://bugs.webkit.org/show_bug.cgi?id=239549
+
+        Reviewed by Chris Fleizach and Andres Gonzalez.
+
+        In AccessibilityRenderObject::updateRoleAfterChildrenCreation(), if the objects role changes,
+        we need to inform the cache via AXObjectCache::handleRoleChange which in turn will
+        update the isolated tree.
+
+        Fixes accessibility/mac/invalid-menu-role-does-not-send-notification.html in isolated tree mode.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
+
 2022-04-21  John Cunningham  <johncunning...@apple.com>
 
         Use GCGLSpanTuple to pass buffer parameters to multidraw calls.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (293211 => 293212)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2022-04-22 06:08:39 UTC (rev 293211)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2022-04-22 07:02:14 UTC (rev 293212)
@@ -3278,6 +3278,11 @@
     }
     if (role == AccessibilityRole::SVGRoot && !children().size())
         m_role = AccessibilityRole::Image;
+
+    if (role != m_role) {
+        if (auto* cache = axObjectCache())
+            cache->handleRoleChange(this);
+    }
 }
     
 void AccessibilityRenderObject::addChildren()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to