Title: [295384] trunk
Revision
295384
Author
[email protected]
Date
2022-06-08 10:22:34 -0700 (Wed, 08 Jun 2022)

Log Message

AX: Update the isolated tree in response to dynamic aria-valuemin, aria-valuemax, and aria-multiselectable changes
https://bugs.webkit.org/show_bug.cgi?id=241394

Reviewed by Chris Fleizach.

Add testcases to accessibility/aria-multiselectable-grid.html
and aria-slider-value.html to cover these changes.

* LayoutTests/accessibility/aria-multiselectable-grid-expected.txt:
* LayoutTests/accessibility/aria-multiselectable-grid.html:
* LayoutTests/accessibility/aria-slider-value-expected.txt:
* LayoutTests/accessibility/aria-slider-value.html:
* LayoutTests/platform/ios/TestExpectations:
Enable aria-slider-value.html on iOS.
* 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:
(WebCore::AXObjectCache::postPlatformNotification):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateNodeProperty):

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

Modified Paths

Diff

Modified: trunk/LayoutTests/accessibility/aria-multiselectable-grid-expected.txt (295383 => 295384)


--- trunk/LayoutTests/accessibility/aria-multiselectable-grid-expected.txt	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/LayoutTests/accessibility/aria-multiselectable-grid-expected.txt	2022-06-08 17:22:34 UTC (rev 295384)
@@ -1,11 +1,12 @@
 This tests that aria-multiselectable is exposed correctly for grids.
 
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS: gridMultiselectableUnspecified.isMultiSelectable === true
+PASS: gridMultiselectableTrue.isMultiSelectable === true
+PASS: gridMultiselectableFalse.isMultiSelectable === false
 
+Updating aria-multiselectable for #grid3 from false to true.
+PASS: accessibilityController.accessibleElementById('grid3').isMultiSelectable === true
 
-PASS gridMultiselectableUnspecified.isMultiSelectable is true
-PASS gridMultiselectableTrue.isMultiSelectable is true
-PASS gridMultiselectableFalse.isMultiSelectable is false
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/aria-multiselectable-grid.html (295383 => 295384)


--- trunk/LayoutTests/accessibility/aria-multiselectable-grid.html	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/LayoutTests/accessibility/aria-multiselectable-grid.html	2022-06-08 17:22:34 UTC (rev 295384)
@@ -1,29 +1,41 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
+
 <div id="grid1" role="grid" tabindex="0"></div>
 <div id="grid2" role="grid" aria-multiselectable="true" tabindex="0"></div>
 <div id="grid3" role="grid" aria-multiselectable="false" tabindex="0"></div>
-<p id="description"></p>
-<div id="console"></div>
+
 <script>
-    description("This tests that aria-multiselectable is exposed correctly for grids.");
+    var testOutput = "This tests that aria-multiselectable is exposed correctly for grids.\n\n";
+
     if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
         var gridMultiselectableUnspecified = accessibilityController.accessibleElementById("grid1");
-        shouldBe("gridMultiselectableUnspecified.isMultiSelectable", "true");
+        testOutput += expect("gridMultiselectableUnspecified.isMultiSelectable", "true");
 
         var gridMultiselectableTrue = accessibilityController.accessibleElementById("grid2");
-        shouldBe("gridMultiselectableTrue.isMultiSelectable", "true");
+        testOutput += expect("gridMultiselectableTrue.isMultiSelectable", "true");
 
         var gridMultiselectableFalse = accessibilityController.accessibleElementById("grid3");
-        shouldBe("gridMultiselectableFalse.isMultiSelectable", "false");
+        testOutput += expect("gridMultiselectableFalse.isMultiSelectable", "false");
+
+        testOutput += "\nUpdating aria-multiselectable for #grid3 from false to true.\n";
+        document.getElementById("grid3").setAttribute("aria-multiselectable", "true");
+        setTimeout(async function() {
+            await waitFor(() => accessibilityController.accessibleElementById("grid3").isMultiSelectable);
+            testOutput += expect("accessibilityController.accessibleElementById('grid3').isMultiSelectable", "true");
+
+            debug(testOutput);
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+

Modified: trunk/LayoutTests/accessibility/aria-slider-value-expected.txt (295383 => 295384)


--- trunk/LayoutTests/accessibility/aria-slider-value-expected.txt	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/LayoutTests/accessibility/aria-slider-value-expected.txt	2022-06-08 17:22:34 UTC (rev 295384)
@@ -1,5 +1,14 @@
-In accessibility, the following should be a progress indicator:
+This test ensures we properly expose the current, minimum, and maximum values of ARIA sliders.
 
+PASS: slider.intValue === 5
+PASS: slider.minValue === 0
+PASS: slider.maxValue === 10
+
+For #slider element, updating aria-valuemin to 2, aria-valuemax to 8.
+PASS: slider.minValue === 2
+PASS: slider.maxValue === 8
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
 X
-
-This test PASSES in DumpRenderTree. The value is 5, the minValue is 0, and the max value is 10.

Modified: trunk/LayoutTests/accessibility/aria-slider-value.html (295383 => 295384)


--- trunk/LayoutTests/accessibility/aria-slider-value.html	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/LayoutTests/accessibility/aria-slider-value.html	2022-06-08 17:22:34 UTC (rev 295384)
@@ -1,37 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
+<head>
+<script src=""
+<script src=""
+</head>
 <body>
+
+<span tabindex="0" role="slider" id="slider" aria-valuenow=5 aria-valuemin=0 aria-valuemax=10>X</span>
+
 <script>
-    if (window.testRunner)
-        testRunner.dumpAsText();
+    var testOutput = "This test ensures we properly expose the current, minimum, and maximum values of ARIA sliders.\n\n";
 
-    function checkValue() {
-        if (!window.accessibilityController)
-            return;
-        
-        var aria = document.getElementById("slider");
-        aria.focus();
-        var focusedElement = accessibilityController.focusedElement;
-        var value = focusedElement.intValue;
-        var minValue = focusedElement.minValue;
-        var maxValue = focusedElement.maxValue;
-       
-        var result = document.getElementById("result");
-        if (value == 5 && minValue == 0 && maxValue == 10)
-            result.innerText = "This test PASSES in DumpRenderTree. The value is " + value + ", the minValue is " 
-                + minValue + ", and the max value is " + maxValue + ".";
-        else
-            result.innerText = "This test FAILS in DumpRenderTree. The value, minValue, and/or maxValue of the range must be incorrect.";
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        var slider = accessibilityController.accessibleElementById("slider");
+        testOutput += expect("slider.intValue", "5");
+        testOutput += expect("slider.minValue", "0");
+        testOutput += expect("slider.maxValue", "10");
+
+        testOutput += "\nFor #slider element, updating aria-valuemin to 2, aria-valuemax to 8.\n";
+        document.getElementById("slider").ariaValueMin = "2";
+        document.getElementById("slider").ariaValueMax = "8";
+        setTimeout(async function() {
+            await waitFor(() => {
+                return slider.minValue === 2 &&
+                    slider.maxValue === 8;
+            });
+
+            testOutput += expect("slider.minValue", "2");
+            testOutput += expect("slider.maxValue", "8");
+
+            debug(testOutput);
+            finishJSTest();
+        }, 0);
     }
 </script>
+</body>
+</html>
 
-<div>
-    <p>In accessibility, the following should be a progress indicator:</p>
-    <p><span tabindex="0" role="slider" id="slider" aria-valuenow=5 aria-valuemin=0 aria-valuemax=10>X</span></p>
-    <span id="result"></span>
-    <script>
-        checkValue();
-    </script>
-  </div>
-  
- </body>
-</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (295383 => 295384)


--- trunk/LayoutTests/platform/ios/TestExpectations	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2022-06-08 17:22:34 UTC (rev 295384)
@@ -2120,6 +2120,7 @@
 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/aria-slider-value.html [ Pass ]
 accessibility/display-contents-element-roles.html [ Pass ]
 accessibility/element-haspopup.html [ Pass ]
 accessibility/heading-level.html [ Pass ]

Modified: trunk/Source/WebCore/accessibility/AXLogger.cpp (295383 => 295384)


--- trunk/Source/WebCore/accessibility/AXLogger.cpp	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/Source/WebCore/accessibility/AXLogger.cpp	2022-06-08 17:22:34 UTC (rev 295384)
@@ -418,6 +418,15 @@
     case AXObjectCache::AXNotification::AXLoadComplete:
         stream << "AXLoadComplete";
         break;
+    case AXObjectCache::AXNotification::AXMaximumValueChanged:
+        stream << "AXMaximumValueChanged";
+        break;
+    case AXObjectCache::AXNotification::AXMinimumValueChanged:
+        stream << "AXMinimumValueChanged";
+        break;
+    case AXObjectCache::AXNotification::AXMultiSelectableStateChanged:
+        stream << "AXMultiSelectableStateChanged";
+        break;
     case AXObjectCache::AXNotification::AXNewDocumentLoadComplete:
         stream << "AXNewDocumentLoadComplete";
         break;

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (295383 => 295384)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-06-08 17:22:34 UTC (rev 295384)
@@ -1954,6 +1954,12 @@
         postNotification(element, AXGrabbedStateChanged);
     else if (attrName == aria_levelAttr)
         postNotification(element, AXLevelChanged);
+    else if (attrName == aria_valuemaxAttr)
+        postNotification(element, AXMaximumValueChanged);
+    else if (attrName == aria_valueminAttr)
+        postNotification(element, AXMinimumValueChanged);
+    else if (attrName == aria_multiselectableAttr)
+        postNotification(element, AXMultiSelectableStateChanged);
     else if (attrName == aria_posinsetAttr)
         postNotification(element, AXPositionInSetChanged);
     else if (attrName == aria_selectedAttr)
@@ -3508,6 +3514,14 @@
         case AXExpandedChanged:
             tree->updateNodeProperty(*notification.first, AXPropertyName::IsExpanded);
             break;
+        case AXMaximumValueChanged:
+            tree->updateNodeProperty(*notification.first, AXPropertyName::MaxValueForRange);
+            tree->updateNodeProperty(*notification.first, AXPropertyName::ValueForRange);
+            break;
+        case AXMinimumValueChanged:
+            tree->updateNodeProperty(*notification.first, AXPropertyName::MinValueForRange);
+            tree->updateNodeProperty(*notification.first, AXPropertyName::ValueForRange);
+            break;
         case AXPositionInSetChanged:
             tree->updateNodeProperty(*notification.first, AXPropertyName::PosInSet);
             tree->updateNodeProperty(*notification.first, AXPropertyName::SupportsPosInSet);
@@ -3541,6 +3555,7 @@
         case AXInvalidStatusChanged:
         case AXLevelChanged:
         case AXMenuListValueChanged:
+        case AXMultiSelectableStateChanged:
         case AXPressedStateChanged:
         case AXSelectedChildrenChanged:
         case AXTextChanged:

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (295383 => 295384)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2022-06-08 17:22:34 UTC (rev 295384)
@@ -303,10 +303,13 @@
         AXScrolledToAnchor,
         AXLiveRegionCreated,
         AXLiveRegionChanged,
+        AXMaximumValueChanged,
         AXMenuListItemSelected,
         AXMenuListValueChanged,
         AXMenuClosed,
         AXMenuOpened,
+        AXMinimumValueChanged,
+        AXMultiSelectableStateChanged,
         AXRowCountChanged,
         AXRowCollapsed,
         AXRowExpanded,

Modified: trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp (295383 => 295384)


--- trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp	2022-06-08 17:22:34 UTC (rev 295384)
@@ -207,6 +207,12 @@
         break;
     case AXLevelChanged:
         break;
+    case AXMaximumValueChanged:
+        break;
+    case AXMinimumValueChanged:
+        break;
+    case AXMultiSelectableStateChanged:
+        break;
     }
 }
 

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (295383 => 295384)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-06-08 17:20:42 UTC (rev 295383)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-06-08 17:22:34 UTC (rev 295384)
@@ -365,6 +365,12 @@
     case AXPropertyName::IsSelected:
         propertyMap.set(AXPropertyName::IsSelected, axObject.isSelected());
         break;
+    case AXPropertyName::MaxValueForRange:
+        propertyMap.set(AXPropertyName::MaxValueForRange, axObject.maxValueForRange());
+        break;
+    case AXPropertyName::MinValueForRange:
+        propertyMap.set(AXPropertyName::MinValueForRange, axObject.minValueForRange());
+        break;
     case AXPropertyName::PosInSet:
         propertyMap.set(AXPropertyName::PosInSet, axObject.posInSet());
         break;
@@ -383,6 +389,9 @@
     case AXPropertyName::SupportsSetSize:
         propertyMap.set(AXPropertyName::SupportsSetSize, axObject.supportsSetSize());
         break;
+    case AXPropertyName::ValueForRange:
+        propertyMap.set(AXPropertyName::ValueForRange, axObject.valueForRange());
+        break;
     default:
         return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to