Title: [294938] trunk
Revision
294938
Author
tyle...@apple.com
Date
2022-05-27 08:49:14 -0700 (Fri, 27 May 2022)

Log Message

AX: Update the isolated tree in response to dynamic aria-haspopup and aria-describedby changes
https://bugs.webkit.org/show_bug.cgi?id=240968

Reviewed by Chris Fleizach.

Testcases added to aria-describedby-on-input.html
and element-haspopup.html to cover this change.

* LayoutTests/accessibility/aria-describedby-on-input-expected.txt:
* LayoutTests/accessibility/aria-describedby-on-input.html:
* LayoutTests/accessibility/element-haspopup-expected.txt:
* LayoutTests/accessibility/element-haspopup.html:
* LayoutTests/platform/ios/accessibility/aria-describedby-on-input-expected.txt: Added.
* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/accessibility/AXLogger.cpp:
(WebCore::operator<<):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleAttributeChange):
(WebCore::AXObjectCache::updateIsolatedTree):
* Source/WebCore/accessibility/AXObjectCache.h:

Canonical link: https://commits.webkit.org/251049@main

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/accessibility/aria-describedby-on-input-expected.txt (294937 => 294938)


--- trunk/LayoutTests/accessibility/aria-describedby-on-input-expected.txt	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/LayoutTests/accessibility/aria-describedby-on-input-expected.txt	2022-05-27 15:49:14 UTC (rev 294938)
@@ -1,5 +1,11 @@
-This computer will self-destruct in   minutes.
-Allows you to specify the number of minutes after
-which the computer will self-destruct.
+This test ensures input elements properly use the aria-describedby in their accessibility description.
 
-The accessibility description is "AXHelp: Allows you to specify the number of minutes after which the computer will self-destruct."
+The accessibility description of #time is "AXHelp: Allows you to specify the number of minutes after which the computer will self-destruct."
+
+Updating aria-describedby of #time to #description3.
+The accessibility description of #time is "AXHelp: Foobar."
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/accessibility/aria-describedby-on-input.html (294937 => 294938)


--- trunk/LayoutTests/accessibility/aria-describedby-on-input.html	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/LayoutTests/accessibility/aria-describedby-on-input.html	2022-05-27 15:49:14 UTC (rev 294938)
@@ -1,23 +1,41 @@
 <html>
-<script>
-    if (window.testRunner)
-        testRunner.dumpAsText();
-</script>
+<head>
+<script src=""
+<script src=""
+</head>
 <body>
+
+<div id="content">
     <span id="message">This computer will self-destruct in</span>
     <input id="time" type="text" value="10" aria-describedby="description1 description2"/>
     <span id="unit"> minutes.</span>
+
     <div id="description1">Allows you to specify the number of minutes after</div>
     <div id="description2">which the computer will self-destruct.</div>
-    <div id="result"></div>
-    
-    <script>
-        if (window.accessibilityController) {
-            var labeledItem = document.getElementById("time");
-            labeledItem.focus();
-            var result = document.getElementById("result");
-            result.innerText = "\nThe accessibility description is \"" + accessibilityController.focusedElement.helpText + "\"";
-        }
-    </script>
+    <div id="description3">Foobar.</div>
+</div>
+
+<script>
+    var testOutput = "This test ensures input elements properly use the aria-describedby in their accessibility description.\n\n";
+
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        var timeInput = accessibilityController.accessibleElementById("time");
+        testOutput += `The accessibility description of #time is \"${timeInput.helpText}\"\n`;
+
+        testOutput += `\nUpdating aria-describedby of #time to #description3.\n`;
+        document.getElementById("time").setAttribute("aria-describedby", "description3");
+        setTimeout(async function() {
+            await waitFor(() => timeInput.helpText.includes("Foobar") );
+            testOutput += `The accessibility description of #time is \"${timeInput.helpText}\"\n`;
+
+            document.getElementById("content").style.visibility = "hidden";
+            debug(testOutput);
+            finishJSTest();
+        }, 0);
+    }
+</script>
 </body>
 </html>
+

Modified: trunk/LayoutTests/accessibility/element-haspopup-expected.txt (294937 => 294938)


--- trunk/LayoutTests/accessibility/element-haspopup-expected.txt	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/LayoutTests/accessibility/element-haspopup-expected.txt	2022-05-27 15:49:14 UTC (rev 294938)
@@ -1,3 +1,17 @@
+This tests that an element will report that it has a popup correctly.
+
+PASS: linkOne.hasPopup === true
+PASS: accessibilityController.accessibleElementById('link2').hasPopup === false
+PASS: accessibilityController.accessibleElementById('paragraph1').hasPopup === true
+PASS: accessibilityController.accessibleElementById('paragraph2').hasPopup === false
+PASS: accessibilityController.accessibleElementById('paragraph3').hasPopup === false
+
+Setting aria-haspopup to false for #link1.
+PASS: linkOne.hasPopup === false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
 Link 1 Link 2
 Paragraph 1.
 
@@ -5,17 +19,4 @@
 
 Paragraph 3.
 
-This tests that an element will report that it has a popup correctly.
 
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS accessibilityController.accessibleElementById('link1').hasPopup is true
-PASS accessibilityController.accessibleElementById('link2').hasPopup is false
-PASS accessibilityController.accessibleElementById('paragraph1').hasPopup is true
-PASS accessibilityController.accessibleElementById('paragraph2').hasPopup is false
-PASS accessibilityController.accessibleElementById('paragraph3').hasPopup is false
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Modified: trunk/LayoutTests/accessibility/element-haspopup.html (294937 => 294938)


--- trunk/LayoutTests/accessibility/element-haspopup.html	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/LayoutTests/accessibility/element-haspopup.html	2022-05-27 15:49:14 UTC (rev 294938)
@@ -1,9 +1,10 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
 
 <a href="" aria-haspopup="true" tabindex="0" id="link1">Link 1</a>
 <a href="" aria-haspopup="false" tabindex="0" id="link2">Link 2</a>
@@ -20,23 +21,31 @@
     <p id="paragraph3">Paragraph 3.</p>
 </a>
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
-    description("This tests that an element will report that it has a popup correctly.");
+    var testOutput = "This tests that an element will report that it has a popup correctly.\n\n";
 
     if (window.accessibilityController) {
-        shouldBe("accessibilityController.accessibleElementById('link1').hasPopup", "true");
-        shouldBe("accessibilityController.accessibleElementById('link2').hasPopup", "false");
+        window.jsTestIsAsync = true;
 
-        shouldBe("accessibilityController.accessibleElementById('paragraph1').hasPopup", "true");
-        shouldBe("accessibilityController.accessibleElementById('paragraph2').hasPopup", "false");
-        shouldBe("accessibilityController.accessibleElementById('paragraph3').hasPopup", "false");
+        var linkOne = accessibilityController.accessibleElementById("link1");
+        testOutput += expect("linkOne.hasPopup", "true");
+        testOutput += expect("accessibilityController.accessibleElementById('link2').hasPopup", "false");
+
+        testOutput += expect("accessibilityController.accessibleElementById('paragraph1').hasPopup", "true");
+        testOutput += expect("accessibilityController.accessibleElementById('paragraph2').hasPopup", "false");
+        testOutput += expect("accessibilityController.accessibleElementById('paragraph3').hasPopup", "false");
+
+        testOutput += "\nSetting aria-haspopup to false for #link1.\n";
+        document.getElementById("link1").ariaHasPopup = "false";
+        setTimeout(async function() {
+            await waitFor(() => !linkOne.hasPopup );
+            testOutput += expect("linkOne.hasPopup", "false");
+
+            debug(testOutput);
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+

Modified: trunk/LayoutTests/platform/ios/TestExpectations (294937 => 294938)


--- trunk/LayoutTests/platform/ios/TestExpectations	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2022-05-27 15:49:14 UTC (rev 294938)
@@ -2116,10 +2116,12 @@
 
 accessibility/table-exposure-updates-dynamically.html [ Pass ]
 accessibility/aria-busy-updates-after-dynamic-change.html [ Pass ]
+accessibility/aria-describedby-on-input.html [ Pass ]
 accessibility/aria-hidden-display-contents-element.html [ Pass ]
 accessibility/aria-readonly-updates-after-dynamic-change.html [ Pass ]
 accessibility/aria-required-updates-after-dynamic-change.html [ Pass ]
 accessibility/display-contents-element-roles.html [ Pass ]
+accessibility/element-haspopup.html [ Pass ]
 accessibility/list-with-dynamically-changing-content.html [ Pass ]
 accessibility/node-only-object-element-rect.html [ Pass ]
 accessibility/text-updates-after-dynamic-change.html [ Pass ]

Added: trunk/LayoutTests/platform/ios/accessibility/aria-describedby-on-input-expected.txt (0 => 294938)


--- trunk/LayoutTests/platform/ios/accessibility/aria-describedby-on-input-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios/accessibility/aria-describedby-on-input-expected.txt	2022-05-27 15:49:14 UTC (rev 294938)
@@ -0,0 +1,11 @@
+This test ensures input elements properly use the aria-describedby in their accessibility description.
+
+The accessibility description of #time is "AXHint: Allows you to specify the number of minutes after which the computer will self-destruct."
+
+Updating aria-describedby of #time to #description3.
+The accessibility description of #time is "AXHint: Foobar."
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/accessibility/AXLogger.cpp (294937 => 294938)


--- trunk/Source/WebCore/accessibility/AXLogger.cpp	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/Source/WebCore/accessibility/AXLogger.cpp	2022-05-27 15:49:14 UTC (rev 294938)
@@ -385,6 +385,9 @@
     case AXObjectCache::AXNotification::AXDisabledStateChanged:
         stream << "AXDisabledStateChanged";
         break;
+    case AXObjectCache::AXNotification::AXDescribedByChanged:
+        stream << "AXDescribedByChanged";
+        break;
     case AXObjectCache::AXNotification::AXFocusedUIElementChanged:
         stream << "AXFocusedUIElementChanged";
         break;
@@ -394,6 +397,9 @@
     case AXObjectCache::AXNotification::AXGrabbedStateChanged:
         stream << "AXGrabbedStateChanged";
         break;
+    case AXObjectCache::AXNotification::AXHasPopupChanged:
+        stream << "AXHasPopupChanged";
+        break;
     case AXObjectCache::AXNotification::AXIdAttributeChanged:
         stream << "AXIdAttributeChanged";
         break;

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (294937 => 294938)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-05-27 15:49:14 UTC (rev 294938)
@@ -1938,6 +1938,8 @@
         textChanged(element);
     else if (attrName == aria_checkedAttr)
         checkedStateChanged(element);
+    else if (attrName == aria_describedbyAttr)
+        postNotification(element, AXDescribedByChanged);
     else if (attrName == aria_grabbedAttr)
         postNotification(element, AXGrabbedStateChanged);
     else if (attrName == aria_posinsetAttr)
@@ -1946,6 +1948,8 @@
         selectedStateChanged(element);
     else if (attrName == aria_expandedAttr)
         handleAriaExpandedChange(element);
+    else if (attrName == aria_haspopupAttr)
+        postNotification(element, AXHasPopupChanged);
     else if (attrName == aria_hiddenAttr) {
         if (auto* parent = get(element->parentNode()))
             handleChildrenChanged(*parent);
@@ -3503,8 +3507,10 @@
             break;
         case AXActiveDescendantChanged:
         case AXAriaRoleChanged:
+        case AXDescribedByChanged:
         case AXElementBusyChanged:
         case AXGrabbedStateChanged:
+        case AXHasPopupChanged:
         case AXInvalidStatusChanged:
         case AXMenuListValueChanged:
         case AXPressedStateChanged:

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (294937 => 294938)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2022-05-27 14:47:04 UTC (rev 294937)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2022-05-27 15:49:14 UTC (rev 294938)
@@ -280,10 +280,12 @@
         AXCheckedStateChanged,
         AXChildrenChanged,
         AXCurrentStateChanged,
+        AXDescribedByChanged,
         AXDisabledStateChanged,
         AXFocusedUIElementChanged,
         AXFrameLoadComplete,
         AXGrabbedStateChanged,
+        AXHasPopupChanged,
         AXIdAttributeChanged,
         AXImageOverlayChanged,
         AXLanguageChanged,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to