Title: [273252] branches/safari-611-branch
Revision
273252
Author
[email protected]
Date
2021-02-22 09:54:45 -0800 (Mon, 22 Feb 2021)

Log Message

Cherry-pick r272490. rdar://problem/74409784

    Add support for aria-sort change notifications.
    https://bugs.webkit.org/show_bug.cgi?id=221495

    Reviewed by Chris Fleizach.

    Source/WebCore:

    Test: accessibility/aria-sort-changed-notification.html

    This patch adds support for aria-sort changes. Some code cleanup by
    using the notificationPlatformName helper function.

    * accessibility/AXLogger.cpp:
    (WebCore::operator<<):
    Logging of the new notification.
    * accessibility/AXObjectCache.cpp:
    Handles the aria-sort change notification. Updates the isolated tree.
    (WebCore::AXObjectCache::handleAttributeChange):
    (WebCore::AXObjectCache::updateIsolatedTree):
    * accessibility/AXObjectCache.h:
    * accessibility/ios/AXObjectCacheIOS.mm:
    (WebCore::AXObjectCache::notificationPlatformName):
    Helper to map AXCore notifications to platform notifications.
    (WebCore::AXObjectCache::postPlatformNotification):
    Handles the AXSortDirectionChanged notification. Some code cleanup using
    the notificationPlatformName helper.
    * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
    * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
    (-[WebAccessibilityObjectWrapper postNotification:]):
    To be overridden by system AX bundles.
    (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
    Only ascending and descending sort directions are relevant for clients.
    * accessibility/isolatedtree/AXIsolatedTree.cpp:
    (WebCore::AXIsolatedTree::updateNodeProperty):
    Updates the SortDirection property.
    * accessibility/mac/AXObjectCacheMac.mm:
    (WebCore::AXObjectCache::postPlatformNotification):
    Handles the AXSortDirectionChanged notification.

    Tools:

    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
    (WTR::AccessibilityUIElement::sortDirection const):
    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
    * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
    * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
    (WTR::AccessibilityUIElement::sortDirection const):
    * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
    (WTR::AccessibilityUIElement::currentStateValue const):
    (WTR::AccessibilityUIElement::sortDirection const):

    LayoutTests:

    * accessibility/aria-sort-changed-notification-expected.txt: Added.
    * accessibility/aria-sort-changed-notification.html: Added.
    * accessibility/aria-sort-expected.txt:
    * accessibility/aria-sort.html:
    Calls sortDirection property on the JS accessible element instead of
    retrieving the aria-sort attribute. This matches more accurately what an
    actual client would do. Changed the expected file accordingly.
    * accessibility/ios-simulator/aria-sort-ios-expected.txt:
    * accessibility/ios-simulator/aria-sort-ios.html:
    Same as in the Mac test above.
    * platform/ios/TestExpectations:
    Added the new test to be run on the ios-simulator.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272490 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-22 17:54:45 UTC (rev 273252)
@@ -1,5 +1,97 @@
 2021-02-17  Ruben Turcios  <[email protected]>
 
+        Cherry-pick r272490. rdar://problem/74409784
+
+    Add support for aria-sort change notifications.
+    https://bugs.webkit.org/show_bug.cgi?id=221495
+    
+    Reviewed by Chris Fleizach.
+    
+    Source/WebCore:
+    
+    Test: accessibility/aria-sort-changed-notification.html
+    
+    This patch adds support for aria-sort changes. Some code cleanup by
+    using the notificationPlatformName helper function.
+    
+    * accessibility/AXLogger.cpp:
+    (WebCore::operator<<):
+    Logging of the new notification.
+    * accessibility/AXObjectCache.cpp:
+    Handles the aria-sort change notification. Updates the isolated tree.
+    (WebCore::AXObjectCache::handleAttributeChange):
+    (WebCore::AXObjectCache::updateIsolatedTree):
+    * accessibility/AXObjectCache.h:
+    * accessibility/ios/AXObjectCacheIOS.mm:
+    (WebCore::AXObjectCache::notificationPlatformName):
+    Helper to map AXCore notifications to platform notifications.
+    (WebCore::AXObjectCache::postPlatformNotification):
+    Handles the AXSortDirectionChanged notification. Some code cleanup using
+    the notificationPlatformName helper.
+    * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
+    * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+    (-[WebAccessibilityObjectWrapper postNotification:]):
+    To be overridden by system AX bundles.
+    (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
+    Only ascending and descending sort directions are relevant for clients.
+    * accessibility/isolatedtree/AXIsolatedTree.cpp:
+    (WebCore::AXIsolatedTree::updateNodeProperty):
+    Updates the SortDirection property.
+    * accessibility/mac/AXObjectCacheMac.mm:
+    (WebCore::AXObjectCache::postPlatformNotification):
+    Handles the AXSortDirectionChanged notification.
+    
+    Tools:
+    
+    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+    (WTR::AccessibilityUIElement::sortDirection const):
+    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+    * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+    * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+    (WTR::AccessibilityUIElement::sortDirection const):
+    * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+    (WTR::AccessibilityUIElement::currentStateValue const):
+    (WTR::AccessibilityUIElement::sortDirection const):
+    
+    LayoutTests:
+    
+    * accessibility/aria-sort-changed-notification-expected.txt: Added.
+    * accessibility/aria-sort-changed-notification.html: Added.
+    * accessibility/aria-sort-expected.txt:
+    * accessibility/aria-sort.html:
+    Calls sortDirection property on the JS accessible element instead of
+    retrieving the aria-sort attribute. This matches more accurately what an
+    actual client would do. Changed the expected file accordingly.
+    * accessibility/ios-simulator/aria-sort-ios-expected.txt:
+    * accessibility/ios-simulator/aria-sort-ios.html:
+    Same as in the Mac test above.
+    * platform/ios/TestExpectations:
+    Added the new test to be run on the ios-simulator.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-08  Andres Gonzalez  <[email protected]>
+
+            Add support for aria-sort change notifications.
+            https://bugs.webkit.org/show_bug.cgi?id=221495
+
+            Reviewed by Chris Fleizach.
+
+            * accessibility/aria-sort-changed-notification-expected.txt: Added.
+            * accessibility/aria-sort-changed-notification.html: Added.
+            * accessibility/aria-sort-expected.txt:
+            * accessibility/aria-sort.html:
+            Calls sortDirection property on the JS accessible element instead of
+            retrieving the aria-sort attribute. This matches more accurately what an
+            actual client would do. Changed the expected file accordingly.
+            * accessibility/ios-simulator/aria-sort-ios-expected.txt:
+            * accessibility/ios-simulator/aria-sort-ios.html:
+            Same as in the Mac test above.
+            * platform/ios/TestExpectations:
+            Added the new test to be run on the ios-simulator.
+
+2021-02-17  Ruben Turcios  <[email protected]>
+
         Cherry-pick r271381. rdar://problem/74451875
 
     Make SpeechRecognition permission error more informative

Added: branches/safari-611-branch/LayoutTests/accessibility/aria-sort-changed-notification-expected.txt (0 => 273252)


--- branches/safari-611-branch/LayoutTests/accessibility/aria-sort-changed-notification-expected.txt	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/accessibility/aria-sort-changed-notification-expected.txt	2021-02-22 17:54:45 UTC (rev 273252)
@@ -0,0 +1,20 @@
+This tests that changing the aria-sort value results in a SortDirectionChanged notification.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS axColumnHeader.sortDirection is 'AXAscendingSortDirection'
+Toggling aria-sort
+AXSortDirectionChanged notification for Account
+PASS axColumnHeader.sortDirection is 'AXDescendingSortDirection'
+Setting aria-sort to a random value
+AXSortDirectionChanged notification for Account
+PASS axColumnHeader.sortDirection is 'AXUnknownSortDirection'
+Toggling aria-sort
+AXSortDirectionChanged notification for Account
+PASS axColumnHeader.sortDirection is 'AXAscendingSortDirection'
+PASS notificationCount is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-611-branch/LayoutTests/accessibility/aria-sort-changed-notification.html (0 => 273252)


--- branches/safari-611-branch/LayoutTests/accessibility/aria-sort-changed-notification.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/accessibility/aria-sort-changed-notification.html	2021-02-22 17:54:45 UTC (rev 273252)
@@ -0,0 +1,78 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<table id="content" role="grid">
+    <thead>
+        <tr aria-label="Header" role="row">
+            <th id="Account" role="columnheader" _onclick_="toggleAriaSort()" aria-sort="ascending" aria-label="Acount Name" title="Account Name">Account Name</th>
+        </tr>
+    </thead>
+</table>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that changing the aria-sort value results in a SortDirectionChanged notification.");
+    window.jsTestIsAsync = true;
+
+    if (window.accessibilityController) {
+        var notificationCount = 0;
+
+        accessibilityController.addNotificationListener(function(element, notification) {
+            if (notification != "AXSortDirectionChanged")
+                return;
+
+            ++notificationCount;
+            debug(notification + " notification for " + element.domIdentifier);
+        });
+
+        function toggleAriaSort(element) {
+            var sortingState = element.getAttribute("aria-sort");
+            if (sortingState == "ascending")
+                element.setAttribute("aria-sort", "descending");
+            else
+                element.setAttribute("aria-sort", "ascending");
+        }
+
+        var columnHeader = document.getElementById("Account");
+        var axColumnHeader = accessibilityController.accessibleElementById("Account");
+        shouldBe("axColumnHeader.sortDirection", "'AXAscendingSortDirection'");
+
+        debug("Toggling aria-sort");
+        toggleAriaSort(columnHeader);
+        setTimeout(async function() {
+            await waitFor(() => {
+                return notificationCount == 1;//axColumnHeader.sortDirection == "AXDescendingSortDirection";
+            });
+            shouldBe("axColumnHeader.sortDirection", "'AXDescendingSortDirection'");
+
+            debug("Setting aria-sort to a random value");
+            columnHeader.setAttribute("aria-sort", "blah blah blah");
+            await waitFor(() => {
+                return notificationCount == 2;//axColumnHeader.sortDirection == "AXUnknownSortDirection";
+            });
+            shouldBe("axColumnHeader.sortDirection", "'AXUnknownSortDirection'");
+
+            debug("Toggling aria-sort");
+            toggleAriaSort(columnHeader);
+            await waitFor(() => {
+                return notificationCount == 3;//axColumnHeader.sortDirection == "AXAscendingSortDirection";
+            });
+            shouldBe("axColumnHeader.sortDirection", "'AXAscendingSortDirection'");
+
+            shouldBe("notificationCount", "3");
+
+            document.getElementById("content").style.visibility = "hidden";
+            accessibilityController.removeNotificationListener();
+            finishJSTest();
+        }, 0);
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-611-branch/LayoutTests/accessibility/aria-sort-expected.txt (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/accessibility/aria-sort-expected.txt	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/accessibility/aria-sort-expected.txt	2021-02-22 17:54:45 UTC (rev 273252)
@@ -6,11 +6,11 @@
 
 
 PASS col1.isAttributeSupported('AXSortDirection') is true
-PASS col1.stringAttributeValue('AXSortDirection') is 'AXAscendingSortDirection'
+PASS col1.sortDirection is 'AXAscendingSortDirection'
 PASS col2.isAttributeSupported('AXSortDirection') is true
-PASS col2.stringAttributeValue('AXSortDirection') is 'AXDescendingSortDirection'
+PASS col2.sortDirection is 'AXDescendingSortDirection'
 PASS col3.isAttributeSupported('AXSortDirection') is true
-PASS col3.stringAttributeValue('AXSortDirection') is 'AXUnknownSortDirection'
+PASS col3.sortDirection is 'AXUnknownSortDirection'
 PASS row1.isAttributeSupported('AXSortDirection') is false
 PASS successfullyParsed is true
 

Modified: branches/safari-611-branch/LayoutTests/accessibility/aria-sort.html (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/accessibility/aria-sort.html	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/accessibility/aria-sort.html	2021-02-22 17:54:45 UTC (rev 273252)
@@ -30,25 +30,24 @@
 
 <script>
     description("This tests that aria-sort is exposed correctly to the Mac accessibility API.");
-    
+
     if (window.accessibilityController) {
         var col1 = accessibilityController.accessibleElementById("col1");
         shouldBe("col1.isAttributeSupported('AXSortDirection')", "true");
-        shouldBe("col1.stringAttributeValue('AXSortDirection')", "'AXAscendingSortDirection'");
-        
+        shouldBe("col1.sortDirection", "'AXAscendingSortDirection'");
+
         var col2 = accessibilityController.accessibleElementById("col2");
         shouldBe("col2.isAttributeSupported('AXSortDirection')", "true");
-        shouldBe("col2.stringAttributeValue('AXSortDirection')", "'AXDescendingSortDirection'");
-        
+        shouldBe("col2.sortDirection", "'AXDescendingSortDirection'");
+
         var col3 = accessibilityController.accessibleElementById("col3");
         shouldBe("col3.isAttributeSupported('AXSortDirection')", "true");
-        shouldBe("col3.stringAttributeValue('AXSortDirection')", "'AXUnknownSortDirection'");
-        
+        shouldBe("col3.sortDirection", "'AXUnknownSortDirection'");
+
         var row1 = accessibilityController.accessibleElementById("row1");
         shouldBe("row1.isAttributeSupported('AXSortDirection')", "false");
     }
 </script>
-
 <script src=""
 </body>
 </html>

Modified: branches/safari-611-branch/LayoutTests/accessibility/ios-simulator/aria-sort-ios-expected.txt (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/accessibility/ios-simulator/aria-sort-ios-expected.txt	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/accessibility/ios-simulator/aria-sort-ios-expected.txt	2021-02-22 17:54:45 UTC (rev 273252)
@@ -5,10 +5,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS col1.stringAttributeValue('AXSortDirection') is 'ascending'
-PASS col2.stringAttributeValue('AXSortDirection') is 'descending'
-PASS col3.stringAttributeValue('AXSortDirection') is 'other'
-PASS row1.stringAttributeValue('AXSortDirection') is null
+PASS col1.sortDirection is 'AXAscendingSortDirection'
+PASS col2.sortDirection is 'AXDescendingSortDirection'
+PASS col3.sortDirection is 'AXUnknownSortDirection'
+PASS row1.sortDirection is 'AXUnknownSortDirection'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-611-branch/LayoutTests/accessibility/ios-simulator/aria-sort-ios.html (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/accessibility/ios-simulator/aria-sort-ios.html	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/accessibility/ios-simulator/aria-sort-ios.html	2021-02-22 17:54:45 UTC (rev 273252)
@@ -27,22 +27,21 @@
 
 <script>
     description("This tests that aria-sort is exposed correctly to the iOS accessibility API.");
-    
+
     if (window.accessibilityController) {
         var col1 = accessibilityController.accessibleElementById("col1");
-        shouldBe("col1.stringAttributeValue('AXSortDirection')", "'ascending'");
-        
+        shouldBe("col1.sortDirection", "'AXAscendingSortDirection'");
+
         var col2 = accessibilityController.accessibleElementById("col2");
-        shouldBe("col2.stringAttributeValue('AXSortDirection')", "'descending'");
-        
+        shouldBe("col2.sortDirection", "'AXDescendingSortDirection'");
+
         var col3 = accessibilityController.accessibleElementById("col3");
-        shouldBe("col3.stringAttributeValue('AXSortDirection')", "'other'");
-        
+        shouldBe("col3.sortDirection", "'AXUnknownSortDirection'");
+
         var row1 = accessibilityController.accessibleElementById("row1");
-        shouldBe("row1.stringAttributeValue('AXSortDirection')", "null");
+        shouldBe("row1.sortDirection", "'AXUnknownSortDirection'");
     }
 </script>
-
 <script src=""
 </body>
 </html>

Modified: branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations	2021-02-22 17:54:45 UTC (rev 273252)
@@ -2162,6 +2162,7 @@
 # Enable "aria-current" tests for iOS.
 webkit.org/b/149297 accessibility/aria-current.html [ Pass ]
 accessibility/aria-current-state-changed-notification.html [ Pass ]
+accessibility/aria-sort-changed-notification.html [ Pass ]
 
 # Enable "aria-table-attributes" test for iOS
 webkit.org/b/150366 accessibility/aria-table-attributes.html [ Pass ]

Modified: branches/safari-611-branch/LayoutTests/platform/mac-wk1/TestExpectations (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/platform/mac-wk1/TestExpectations	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/platform/mac-wk1/TestExpectations	2021-02-22 17:54:45 UTC (rev 273252)
@@ -967,6 +967,8 @@
 accessibility/mac/isolated-tree-mode-on-off.html [ Skip ]
 accessibility/aria-current-state-changed-notification.html [ Skip ]
 accessibility/aria-current.html [ Skip ]
+accessibility/aria-sort-changed-notification.html [ Skip ]
+accessibility/aria-sort.html [ Skip ]
 
 # <rdar://problem/61066929> [ Stress GC ] flaky JSC::ExceptionScope::assertNoException crash under WebCore::ReadableStreamDefaultController
 webkit.org/b/211923 imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.html [ Pass Crash ]

Modified: branches/safari-611-branch/LayoutTests/platform/win/TestExpectations (273251 => 273252)


--- branches/safari-611-branch/LayoutTests/platform/win/TestExpectations	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/LayoutTests/platform/win/TestExpectations	2021-02-22 17:54:45 UTC (rev 273252)
@@ -1422,6 +1422,7 @@
 webkit.org/b/140798 [ Debug ] accessibility/aria-namefrom-author.html [ Skip ] # Debug assertion
 webkit.org/b/140798 [ Release ] accessibility/aria-sort.html [ Failure ]
 webkit.org/b/140798 [ Debug ] accessibility/aria-sort.html [ Skip ] # Debug assertion
+accessibility/aria-sort-changed-notification.html [ Skip ]
 webkit.org/b/140798 [ Release ] accessibility/aria-tables.html [ Failure ]
 webkit.org/b/140798 [ Debug ] accessibility/aria-tables.html [ Skip ] # Debug assertion
 webkit.org/b/140798 [ Release ] accessibility/aria-text-role.html [ Failure ]

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-22 17:54:45 UTC (rev 273252)
@@ -1,5 +1,116 @@
 2021-02-17  Ruben Turcios  <[email protected]>
 
+        Cherry-pick r272490. rdar://problem/74409784
+
+    Add support for aria-sort change notifications.
+    https://bugs.webkit.org/show_bug.cgi?id=221495
+    
+    Reviewed by Chris Fleizach.
+    
+    Source/WebCore:
+    
+    Test: accessibility/aria-sort-changed-notification.html
+    
+    This patch adds support for aria-sort changes. Some code cleanup by
+    using the notificationPlatformName helper function.
+    
+    * accessibility/AXLogger.cpp:
+    (WebCore::operator<<):
+    Logging of the new notification.
+    * accessibility/AXObjectCache.cpp:
+    Handles the aria-sort change notification. Updates the isolated tree.
+    (WebCore::AXObjectCache::handleAttributeChange):
+    (WebCore::AXObjectCache::updateIsolatedTree):
+    * accessibility/AXObjectCache.h:
+    * accessibility/ios/AXObjectCacheIOS.mm:
+    (WebCore::AXObjectCache::notificationPlatformName):
+    Helper to map AXCore notifications to platform notifications.
+    (WebCore::AXObjectCache::postPlatformNotification):
+    Handles the AXSortDirectionChanged notification. Some code cleanup using
+    the notificationPlatformName helper.
+    * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
+    * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+    (-[WebAccessibilityObjectWrapper postNotification:]):
+    To be overridden by system AX bundles.
+    (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
+    Only ascending and descending sort directions are relevant for clients.
+    * accessibility/isolatedtree/AXIsolatedTree.cpp:
+    (WebCore::AXIsolatedTree::updateNodeProperty):
+    Updates the SortDirection property.
+    * accessibility/mac/AXObjectCacheMac.mm:
+    (WebCore::AXObjectCache::postPlatformNotification):
+    Handles the AXSortDirectionChanged notification.
+    
+    Tools:
+    
+    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+    (WTR::AccessibilityUIElement::sortDirection const):
+    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+    * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+    * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+    (WTR::AccessibilityUIElement::sortDirection const):
+    * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+    (WTR::AccessibilityUIElement::currentStateValue const):
+    (WTR::AccessibilityUIElement::sortDirection const):
+    
+    LayoutTests:
+    
+    * accessibility/aria-sort-changed-notification-expected.txt: Added.
+    * accessibility/aria-sort-changed-notification.html: Added.
+    * accessibility/aria-sort-expected.txt:
+    * accessibility/aria-sort.html:
+    Calls sortDirection property on the JS accessible element instead of
+    retrieving the aria-sort attribute. This matches more accurately what an
+    actual client would do. Changed the expected file accordingly.
+    * accessibility/ios-simulator/aria-sort-ios-expected.txt:
+    * accessibility/ios-simulator/aria-sort-ios.html:
+    Same as in the Mac test above.
+    * platform/ios/TestExpectations:
+    Added the new test to be run on the ios-simulator.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-08  Andres Gonzalez  <[email protected]>
+
+            Add support for aria-sort change notifications.
+            https://bugs.webkit.org/show_bug.cgi?id=221495
+
+            Reviewed by Chris Fleizach.
+
+            Test: accessibility/aria-sort-changed-notification.html
+
+            This patch adds support for aria-sort changes. Some code cleanup by
+            using the notificationPlatformName helper function.
+
+            * accessibility/AXLogger.cpp:
+            (WebCore::operator<<):
+            Logging of the new notification.
+            * accessibility/AXObjectCache.cpp:
+            Handles the aria-sort change notification. Updates the isolated tree.
+            (WebCore::AXObjectCache::handleAttributeChange):
+            (WebCore::AXObjectCache::updateIsolatedTree):
+            * accessibility/AXObjectCache.h:
+            * accessibility/ios/AXObjectCacheIOS.mm:
+            (WebCore::AXObjectCache::notificationPlatformName):
+            Helper to map AXCore notifications to platform notifications.
+            (WebCore::AXObjectCache::postPlatformNotification):
+            Handles the AXSortDirectionChanged notification. Some code cleanup using
+            the notificationPlatformName helper.
+            * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
+            * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+            (-[WebAccessibilityObjectWrapper postNotification:]):
+            To be overridden by system AX bundles.
+            (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
+            Only ascending and descending sort directions are relevant for clients.
+            * accessibility/isolatedtree/AXIsolatedTree.cpp:
+            (WebCore::AXIsolatedTree::updateNodeProperty):
+            Updates the SortDirection property.
+            * accessibility/mac/AXObjectCacheMac.mm:
+            (WebCore::AXObjectCache::postPlatformNotification):
+            Handles the AXSortDirectionChanged notification.
+
+2021-02-17  Ruben Turcios  <[email protected]>
+
         Cherry-pick r272067. rdar://problem/74444347
 
     Support for aria-current state changed notifications.

Modified: branches/safari-611-branch/Source/WebCore/accessibility/AXLogger.cpp (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/AXLogger.cpp	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/AXLogger.cpp	2021-02-22 17:54:45 UTC (rev 273252)
@@ -444,6 +444,9 @@
     case AXObjectCache::AXNotification::AXRequiredStatusChanged:
         stream << "AXRequiredStatusChanged";
         break;
+    case AXObjectCache::AXNotification::AXSortDirectionChanged:
+        stream << "AXSortDirectionChanged";
+        break;
     case AXObjectCache::AXNotification::AXTextChanged:
         stream << "AXTextChanged";
         break;

Modified: branches/safari-611-branch/Source/WebCore/accessibility/AXObjectCache.cpp (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/AXObjectCache.cpp	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/AXObjectCache.cpp	2021-02-22 17:54:45 UTC (rev 273252)
@@ -1782,6 +1782,8 @@
         postNotification(element, AXObjectCache::AXReadOnlyStatusChanged);
     else if (attrName == aria_requiredAttr)
         postNotification(element, AXObjectCache::AXRequiredStatusChanged);
+    else if (attrName == aria_sortAttr)
+        postNotification(element, AXObjectCache::AXSortDirectionChanged);
     else
         postNotification(element, AXObjectCache::AXAriaAttributeChanged);
 }
@@ -3197,6 +3199,9 @@
     case AXCheckedStateChanged:
         tree->updateNodeProperty(object, AXPropertyName::IsChecked);
         break;
+    case AXSortDirectionChanged:
+        tree->updateNodeProperty(object, AXPropertyName::SortDirection);
+        break;
     case AXIdAttributeChanged:
         tree->updateNodeProperty(object, AXPropertyName::IdentifierAttribute);
         break;
@@ -3266,6 +3271,9 @@
         case AXCheckedStateChanged:
             tree->updateNodeProperty(*notification.first, AXPropertyName::IsChecked);
             break;
+        case AXSortDirectionChanged:
+            tree->updateNodeProperty(*notification.first, AXPropertyName::SortDirection);
+            break;
         case AXIdAttributeChanged:
             tree->updateNodeProperty(*notification.first, AXPropertyName::IdentifierAttribute);
             break;

Modified: branches/safari-611-branch/Source/WebCore/accessibility/AXObjectCache.h (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/AXObjectCache.h	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/AXObjectCache.h	2021-02-22 17:54:45 UTC (rev 273252)
@@ -307,6 +307,7 @@
         AXPressedStateChanged,
         AXReadOnlyStatusChanged,
         AXRequiredStatusChanged,
+        AXSortDirectionChanged,
         AXTextChanged,
         AXElementBusyChanged,
         AXDraggingStarted,
@@ -382,6 +383,7 @@
 #endif
 
 protected:
+    static String notificationPlatformName(AXNotification);
     void postPlatformNotification(AXCoreObject*, AXNotification);
     void platformHandleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode);
 

Modified: branches/safari-611-branch/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm	2021-02-22 17:54:45 UTC (rev 273252)
@@ -42,17 +42,42 @@
     obj->setWrapper(wrapper.get());
 }
 
+String AXObjectCache::notificationPlatformName(AXNotification notification)
+{
+    String name;
+
+    switch (notification) {
+    case AXActiveDescendantChanged:
+    case AXFocusedUIElementChanged:
+        name = "AXFocusChanged";
+        break;
+    case AXCheckedStateChanged:
+    case AXValueChanged:
+        name = "AXValueChanged";
+        break;
+    case AXCurrentStateChanged:
+        name = "AXCurrentStateChanged";
+        break;
+    case AXSortDirectionChanged:
+        name = "AXSortDirectionChanged";
+        break;
+    default:
+        break;
+    }
+
+    return name;
+}
+
 void AXObjectCache::postPlatformNotification(AXCoreObject* obj, AXNotification notification)
 {
     if (!obj)
         return;
 
-    NSString *notificationString = nil;
+    String notificationName = AXObjectCache::notificationPlatformName(notification);
     switch (notification) {
     case AXActiveDescendantChanged:
     case AXFocusedUIElementChanged:
         [obj->wrapper() postFocusChangeNotification];
-        notificationString = @"AXFocusChanged";
         break;
     case AXSelectedTextChanged:
         [obj->wrapper() postSelectedTextChangeNotification];
@@ -78,7 +103,6 @@
     case AXCheckedStateChanged:
     case AXValueChanged:
         [obj->wrapper() postValueChangedNotification];
-        notificationString = @"AXValueChanged";
         break;
     case AXExpandedChanged:
         [obj->wrapper() postExpandedChangedNotification];
@@ -85,15 +109,17 @@
         break;
     case AXCurrentStateChanged:
         [obj->wrapper() postCurrentStateChangedNotification];
-        notificationString = @"AXCurrentStateChanged";
         break;
+    case AXSortDirectionChanged:
+        [obj->wrapper() postNotification:notificationName];
+        break;
     default:
         break;
     }
 
     // Used by DRT to know when notifications are posted.
-    if (notificationString)
-        [obj->wrapper() accessibilityPostedNotification:notificationString];
+    if (!notificationName.isEmpty())
+        [obj->wrapper() accessibilityPostedNotification:notificationName];
 }
 
 void AXObjectCache::postTextStateChangePlatformNotification(AXCoreObject* object, const AXTextStateChangeIntent&, const VisibleSelection&)

Modified: branches/safari-611-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.h	2021-02-22 17:54:45 UTC (rev 273252)
@@ -67,7 +67,7 @@
 - (void)postValueChangedNotification;
 - (void)postExpandedChangedNotification;
 - (void)postCurrentStateChangedNotification;
-
+- (void)postNotification:(NSString *)notificationName;
 @end
 
 #endif // ENABLE(ACCESSIBILITY) && PLATFORM(IOS_FAMILY)

Modified: branches/safari-611-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-02-22 17:54:45 UTC (rev 273252)
@@ -2017,6 +2017,11 @@
     // The UIKit accessibility wrapper will override and post appropriate notification.
 }
 
+- (void)postNotification:(NSString *)notificationName
+{
+    // The UIKit accessibility wrapper will override and post appropriate notification.
+}
+
 // These will be used by the UIKit wrapper to calculate an appropriate description of scroll status.
 - (CGPoint)_accessibilityScrollPosition
 {
@@ -3056,17 +3061,14 @@
 {
     if (![self _prepareAccessibilityCall])
         return nil;
-    
+
     switch (self.axBackingObject->sortDirection()) {
     case AccessibilitySortDirection::Ascending:
-        return @"ascending";
+        return @"AXAscendingSortDirection";
     case AccessibilitySortDirection::Descending:
-        return @"descending";
-    case AccessibilitySortDirection::Other:
-        return @"other";
-    case AccessibilitySortDirection::Invalid:
-    case AccessibilitySortDirection::None:
-        return nil;
+        return @"AXDescendingSortDirection";
+    default:
+        return @"AXUnknownSortDirection";
     }
 }
 

Modified: branches/safari-611-branch/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2021-02-22 17:54:45 UTC (rev 273252)
@@ -260,6 +260,9 @@
     case AXPropertyName::IsChecked:
         propertyMap.set(AXPropertyName::IsChecked, axObject.isChecked());
         break;
+    case AXPropertyName::SortDirection:
+        propertyMap.set(AXPropertyName::SortDirection, static_cast<int>(axObject.sortDirection()));
+        break;
     case AXPropertyName::IdentifierAttribute:
         propertyMap.set(AXPropertyName::IdentifierAttribute, axObject.identifierAttribute().isolatedCopy());
         break;

Modified: branches/safari-611-branch/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (273251 => 273252)


--- branches/safari-611-branch/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2021-02-22 17:54:45 UTC (rev 273252)
@@ -368,6 +368,9 @@
     case AXExpandedChanged:
         macNotification = @"AXExpandedChanged";
         break;
+    case AXSortDirectionChanged:
+        macNotification = @"AXSortDirectionChanged";
+        break;
     case AXMenuClosed:
         macNotification = (id)kAXMenuClosedNotification;
         break;

Modified: branches/safari-611-branch/Tools/ChangeLog (273251 => 273252)


--- branches/safari-611-branch/Tools/ChangeLog	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Tools/ChangeLog	2021-02-22 17:54:45 UTC (rev 273252)
@@ -1,5 +1,94 @@
 2021-02-17  Ruben Turcios  <[email protected]>
 
+        Cherry-pick r272490. rdar://problem/74409784
+
+    Add support for aria-sort change notifications.
+    https://bugs.webkit.org/show_bug.cgi?id=221495
+    
+    Reviewed by Chris Fleizach.
+    
+    Source/WebCore:
+    
+    Test: accessibility/aria-sort-changed-notification.html
+    
+    This patch adds support for aria-sort changes. Some code cleanup by
+    using the notificationPlatformName helper function.
+    
+    * accessibility/AXLogger.cpp:
+    (WebCore::operator<<):
+    Logging of the new notification.
+    * accessibility/AXObjectCache.cpp:
+    Handles the aria-sort change notification. Updates the isolated tree.
+    (WebCore::AXObjectCache::handleAttributeChange):
+    (WebCore::AXObjectCache::updateIsolatedTree):
+    * accessibility/AXObjectCache.h:
+    * accessibility/ios/AXObjectCacheIOS.mm:
+    (WebCore::AXObjectCache::notificationPlatformName):
+    Helper to map AXCore notifications to platform notifications.
+    (WebCore::AXObjectCache::postPlatformNotification):
+    Handles the AXSortDirectionChanged notification. Some code cleanup using
+    the notificationPlatformName helper.
+    * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
+    * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+    (-[WebAccessibilityObjectWrapper postNotification:]):
+    To be overridden by system AX bundles.
+    (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
+    Only ascending and descending sort directions are relevant for clients.
+    * accessibility/isolatedtree/AXIsolatedTree.cpp:
+    (WebCore::AXIsolatedTree::updateNodeProperty):
+    Updates the SortDirection property.
+    * accessibility/mac/AXObjectCacheMac.mm:
+    (WebCore::AXObjectCache::postPlatformNotification):
+    Handles the AXSortDirectionChanged notification.
+    
+    Tools:
+    
+    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+    (WTR::AccessibilityUIElement::sortDirection const):
+    * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+    * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+    * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+    (WTR::AccessibilityUIElement::sortDirection const):
+    * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+    (WTR::AccessibilityUIElement::currentStateValue const):
+    (WTR::AccessibilityUIElement::sortDirection const):
+    
+    LayoutTests:
+    
+    * accessibility/aria-sort-changed-notification-expected.txt: Added.
+    * accessibility/aria-sort-changed-notification.html: Added.
+    * accessibility/aria-sort-expected.txt:
+    * accessibility/aria-sort.html:
+    Calls sortDirection property on the JS accessible element instead of
+    retrieving the aria-sort attribute. This matches more accurately what an
+    actual client would do. Changed the expected file accordingly.
+    * accessibility/ios-simulator/aria-sort-ios-expected.txt:
+    * accessibility/ios-simulator/aria-sort-ios.html:
+    Same as in the Mac test above.
+    * platform/ios/TestExpectations:
+    Added the new test to be run on the ios-simulator.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-08  Andres Gonzalez  <[email protected]>
+
+            Add support for aria-sort change notifications.
+            https://bugs.webkit.org/show_bug.cgi?id=221495
+
+            Reviewed by Chris Fleizach.
+
+            * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+            (WTR::AccessibilityUIElement::sortDirection const):
+            * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+            * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+            * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+            (WTR::AccessibilityUIElement::sortDirection const):
+            * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+            (WTR::AccessibilityUIElement::currentStateValue const):
+            (WTR::AccessibilityUIElement::sortDirection const):
+
+2021-02-17  Ruben Turcios  <[email protected]>
+
         Cherry-pick r271381. rdar://problem/74451875
 
     Make SpeechRecognition permission error more informative

Modified: branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (273251 => 273252)


--- branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-02-22 17:54:45 UTC (rev 273252)
@@ -113,6 +113,7 @@
 #if !PLATFORM(COCOA) || !HAVE(ACCESSIBILITY)
 JSRetainPtr<JSStringRef> AccessibilityUIElement::domIdentifier() const { return nullptr; }
 JSRetainPtr<JSStringRef> AccessibilityUIElement::currentStateValue() const { return nullptr; }
+JSRetainPtr<JSStringRef> AccessibilityUIElement::sortDirection() const { return nullptr; }
 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
 RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }

Modified: branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (273251 => 273252)


--- branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-02-22 17:54:45 UTC (rev 273252)
@@ -174,6 +174,7 @@
     bool isExpanded() const;
     bool isChecked() const;
     JSRetainPtr<JSStringRef> currentStateValue() const;
+    JSRetainPtr<JSStringRef> sortDirection() const;
     bool isIndeterminate() const;
     bool isVisible() const;
     bool isOnScreen() const;

Modified: branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (273251 => 273252)


--- branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-02-22 17:54:45 UTC (rev 273252)
@@ -93,6 +93,7 @@
     readonly attribute boolean isExpanded;
     readonly attribute boolean isChecked;
     readonly attribute DOMString currentStateValue;
+    readonly attribute DOMString sortDirection;
     readonly attribute boolean isIndeterminate;
     readonly attribute boolean isVisible;
     readonly attribute boolean isCollapsed;

Modified: branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (273251 => 273252)


--- branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2021-02-22 17:54:45 UTC (rev 273252)
@@ -627,6 +627,14 @@
     return nullptr;
 }
 
+JSRetainPtr<JSStringRef> AccessibilityUIElement::sortDirection() const
+{
+    id value = [m_element accessibilitySortDirection];
+    if ([value isKindOfClass:[NSString class]])
+        return [value createJSStringRef];
+    return nullptr;
+}
+
 int AccessibilityUIElement::hierarchicalLevel() const
 {
     return 0;

Modified: branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (273251 => 273252)


--- branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-02-22 17:54:38 UTC (rev 273251)
+++ branches/safari-611-branch/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-02-22 17:54:45 UTC (rev 273252)
@@ -998,6 +998,14 @@
     return nullptr;
 }
 
+JSRetainPtr<JSStringRef> AccessibilityUIElement::sortDirection() const
+{
+    id value = attributeValue(m_element.get(), NSAccessibilitySortDirectionAttribute);
+    if ([value isKindOfClass:[NSString class]])
+        return [value createJSStringRef];
+    return nullptr;
+}
+
 int AccessibilityUIElement::hierarchicalLevel() const
 {
     BEGIN_AX_OBJC_EXCEPTIONS
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to