Title: [295597] trunk
Revision
295597
Author
tyle...@apple.com
Date
2022-06-16 09:39:55 -0700 (Thu, 16 Jun 2022)

Log Message

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

Reviewed by Chris Fleizach.

* LayoutTests/accessibility/placeholder-expected.txt:
* LayoutTests/accessibility/placeholder.html: Add new test cases.
* LayoutTests/platform/ios/TestExpectations: Enable accessibility/placeholder.html.
* Source/WebCore/accessibility/AXLogger.cpp:
(WebCore::operator<<):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleAttributeChange):
(WebCore::AXObjectCache::updateIsolatedTree):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp

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

Modified Paths

Diff

Modified: trunk/LayoutTests/accessibility/placeholder-expected.txt (295596 => 295597)


--- trunk/LayoutTests/accessibility/placeholder-expected.txt	2022-06-16 16:30:11 UTC (rev 295596)
+++ trunk/LayoutTests/accessibility/placeholder-expected.txt	2022-06-16 16:39:55 UTC (rev 295597)
@@ -1,12 +1,16 @@
-This test makes sure that the placeholder is returned as the correct attribute
+This test ensures that the placeholder is returned as the correct attribute.
 
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS: fieldElement.stringAttributeValue('AXPlaceholderValue') === 'search'
+PASS: passwordElement.stringAttributeValue('AXPlaceholderValue') === 'Password'
+PASS: searchElement.stringAttributeValue('AXPlaceholderValue') === 'MM-DD-YYYY'
+PASS: textInput.stringAttributeValue('AXPlaceholderValue') === 'Fill in the blank'
 
+Updating aria-placeholder attribute of the #search element to 'YYYY-MM-DD'.
+PASS: searchElement.stringAttributeValue('AXPlaceholderValue') === 'YYYY-MM-DD'
 
-PASS fieldElement.stringAttributeValue('AXPlaceholderValue') is 'search'
-PASS passwordElement.stringAttributeValue('AXPlaceholderValue') is 'Password'
-PASS searchElement.stringAttributeValue('AXPlaceholderValue') is 'MM-DD-YYYY'
-PASS textInput.stringAttributeValue('AXPlaceholderValue') is 'Fill in the blank'
+Updating placeholder attribute of the #search element to 'Foo'.
+PASS: searchElement.stringAttributeValue('AXPlaceholderValue') === 'Foo'
+
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/placeholder.html (295596 => 295597)


--- trunk/LayoutTests/accessibility/placeholder.html	2022-06-16 16:30:11 UTC (rev 295596)
+++ trunk/LayoutTests/accessibility/placeholder.html	2022-06-16 16:39:55 UTC (rev 295597)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
+<script src=""
 <script src=""
-<script src=""
 </head>
 <body>
 
@@ -14,23 +14,40 @@
 <div id="search" role="searchbox" aria-labelledby="label" aria-placeholder="MM-DD-YYYY">03-14-1879</div>
 
 <input type="text" id="input" placeholder="Fill in the blank" aria-placeholder="aria placeholder">
-    
+
 <script>
-    description("This test makes sure that the placeholder is returned as the correct attribute");
+    var testOutput = "This test ensures that the placeholder is returned as the correct attribute.\n\n";
 
     if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
         var fieldElement = accessibilityController.accessibleElementById("searchterm");
-        shouldBe("fieldElement.stringAttributeValue('AXPlaceholderValue')", "'search'");
+        testOutput += expect("fieldElement.stringAttributeValue('AXPlaceholderValue')", "'search'");
 
         var passwordElement = accessibilityController.accessibleElementById("password");
-        shouldBe("passwordElement.stringAttributeValue('AXPlaceholderValue')", "'Password'");
+        testOutput += expect("passwordElement.stringAttributeValue('AXPlaceholderValue')", "'Password'");
 
         var searchElement = accessibilityController.accessibleElementById("search");
-        shouldBe("searchElement.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
+        testOutput += expect("searchElement.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
 
         // When the placeholder and aria-placeholder attributes are both present, use the placeholder attribute's value.
         var textInput = accessibilityController.accessibleElementById("input");
-        shouldBe("textInput.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
+        testOutput += expect("textInput.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
+
+        testOutput += "\nUpdating aria-placeholder attribute of the #search element to 'YYYY-MM-DD'.\n";
+        document.getElementById("search").ariaPlaceholder = "YYYY-MM-DD";
+        setTimeout(async function() {
+            await waitFor(() => searchElement.stringAttributeValue("AXPlaceholderValue") === "YYYY-MM-DD");
+            testOutput += expect("searchElement.stringAttributeValue('AXPlaceholderValue')", "'YYYY-MM-DD'");
+
+            testOutput += "\nUpdating placeholder attribute of the #search element to 'Foo'.\n";
+            document.getElementById("search").setAttribute("placeholder", "Foo");
+            await waitFor(() => searchElement.stringAttributeValue("AXPlaceholderValue") === "Foo");
+            testOutput += expect("searchElement.stringAttributeValue('AXPlaceholderValue')", "'Foo'");
+
+            debug(testOutput);
+            finishJSTest();
+        }, 0);
     }
 </script>
 </body>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (295596 => 295597)


--- trunk/LayoutTests/platform/ios/TestExpectations	2022-06-16 16:30:11 UTC (rev 295596)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2022-06-16 16:39:55 UTC (rev 295597)
@@ -2138,6 +2138,7 @@
 accessibility/live-region-attributes-update-after-dynamic-change.html [ Pass ]
 accessibility/node-only-inert-object.html [ Pass ]
 accessibility/node-only-object-element-rect.html [ Pass ]
+accessibility/placeholder.html [ Pass ]
 accessibility/text-updates-after-dynamic-change.html [ Pass ]
 accessibility/video-element-url-attribute.html [ Pass ]
 accessibility/visible-character-range-basic.html [ Pass ]

Modified: trunk/Source/WebCore/accessibility/AXLogger.cpp (295596 => 295597)


--- trunk/Source/WebCore/accessibility/AXLogger.cpp	2022-06-16 16:30:11 UTC (rev 295596)
+++ trunk/Source/WebCore/accessibility/AXLogger.cpp	2022-06-16 16:39:55 UTC (rev 295597)
@@ -421,6 +421,9 @@
     case AXObjectCache::AXNotification::AXLoadComplete:
         stream << "AXLoadComplete";
         break;
+    case AXObjectCache::AXNotification::AXPlaceholderChanged:
+        stream << "AXPlaceholderChanged";
+        break;
     case AXObjectCache::AXNotification::AXMaximumValueChanged:
         stream << "AXMaximumValueChanged";
         break;

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (295596 => 295597)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-06-16 16:30:11 UTC (rev 295596)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-06-16 16:39:55 UTC (rev 295597)
@@ -1925,6 +1925,8 @@
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
     else if (attrName == langAttr)
         updateIsolatedTree(get(element), AXObjectCache::AXLanguageChanged);
+    else if (attrName == placeholderAttr)
+        postNotification(element, AXPlaceholderChanged);
     else if (attrName == idAttr) {
         relationsNeedUpdate(true);
         updateIsolatedTree(get(element), AXObjectCache::AXIdAttributeChanged);
@@ -1958,6 +1960,8 @@
         postNotification(element, AXLevelChanged);
     else if (attrName == aria_liveAttr)
         postNotification(element, AXLiveRegionStatusChanged);
+    else if (attrName == aria_placeholderAttr)
+        postNotification(element, AXPlaceholderChanged);
     else if (attrName == aria_valuemaxAttr)
         postNotification(element, AXMaximumValueChanged);
     else if (attrName == aria_valueminAttr)
@@ -3575,6 +3579,7 @@
         case AXLevelChanged:
         case AXLiveRegionStatusChanged:
         case AXLiveRegionRelevantChanged:
+        case AXPlaceholderChanged:
         case AXMenuListValueChanged:
         case AXMultiSelectableStateChanged:
         case AXPressedStateChanged:

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (295596 => 295597)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2022-06-16 16:30:11 UTC (rev 295596)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2022-06-16 16:39:55 UTC (rev 295597)
@@ -295,6 +295,7 @@
         AXLoadComplete,
         AXNewDocumentLoadComplete,
         AXPageScrolled,
+        AXPlaceholderChanged,
         AXPositionInSetChanged,
         AXSelectedChildrenChanged,
         AXSelectedStateChanged,

Modified: trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp (295596 => 295597)


--- trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp	2022-06-16 16:30:11 UTC (rev 295596)
+++ trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp	2022-06-16 16:39:55 UTC (rev 295597)
@@ -221,6 +221,8 @@
         break;
     case AXOrientationChanged:
         break;
+    case AXPlaceholderChanged:
+        break;
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to