Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/233804@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
AndresGonzalezApple committed Feb 8, 2021
1 parent 1374fcf commit 7accd8367b2a8fd55f62de4485743c4fca09458b
Showing 25 changed files with 282 additions and 40 deletions.
@@ -1,3 +1,23 @@
2021-02-08 Andres Gonzalez <andresg_22@apple.com>

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-08 Manuel Rego Casasnovas <rego@igalia.com>

[GTK] event.ctrlKey and other are false in keydown event
@@ -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

@@ -0,0 +1,78 @@
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</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="../resources/js-test-post.js"></script>
</body>
</html>
@@ -6,11 +6,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE


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

@@ -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="../resources/js-test-post.js"></script>
</body>
</html>
@@ -5,10 +5,10 @@ This tests that aria-sort is exposed correctly to the iOS accessibility API.
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
@@ -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="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -2166,6 +2166,7 @@ fast/dom/linkify-phone-numbers.html [ Pass ]
# 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 ]
@@ -968,6 +968,8 @@ webkit.org/b/208477 accessibility/mac/text-marker-for-index.html [ Skip ]
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 ]
@@ -1236,4 +1238,4 @@ webkit.org/b/221300 [ BigSur ] imported/w3c/web-platform-tests/media-source/medi
webkit.org/b/221300 [ BigSur ] imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framerate.html [ Failure ]
webkit.org/b/221300 [ BigSur ] imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html [ Failure ]

webkit.org/b/221369 [ BigSur+ ] media/media-source/media-source-webm-append-buffer-after-abort.html [ Skip ]
webkit.org/b/221369 [ BigSur+ ] media/media-source/media-source-webm-append-buffer-after-abort.html [ Skip ]
@@ -1422,6 +1422,7 @@ webkit.org/b/140798 [ Debug ] accessibility/aria-labelledby-with-descendants.htm
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 ]
@@ -1,3 +1,42 @@
2021-02-08 Andres Gonzalez <andresg_22@apple.com>

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-08 Frédéric Wang <fwang@igalia.com>

Perform layout before running Editor::findString
@@ -444,6 +444,9 @@ TextStream& operator<<(TextStream& stream, AXObjectCache::AXNotification notific
case AXObjectCache::AXNotification::AXRequiredStatusChanged:
stream << "AXRequiredStatusChanged";
break;
case AXObjectCache::AXNotification::AXSortDirectionChanged:
stream << "AXSortDirectionChanged";
break;
case AXObjectCache::AXNotification::AXTextChanged:
stream << "AXTextChanged";
break;
@@ -1782,6 +1782,8 @@ void AXObjectCache::handleAttributeChange(const QualifiedName& attrName, Element
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 @@ void AXObjectCache::updateIsolatedTree(AXCoreObject& object, AXNotification noti
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 @@ void AXObjectCache::updateIsolatedTree(const Vector<std::pair<RefPtr<AXCoreObjec
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;
@@ -307,6 +307,7 @@ class AXObjectCache {
AXPressedStateChanged,
AXReadOnlyStatusChanged,
AXRequiredStatusChanged,
AXSortDirectionChanged,
AXTextChanged,
AXElementBusyChanged,
AXDraggingStarted,
@@ -382,6 +383,7 @@ class AXObjectCache {
#endif

protected:
static String notificationPlatformName(AXNotification);
void postPlatformNotification(AXCoreObject*, AXNotification);
void platformHandleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode);

0 comments on commit 7accd83

Please sign in to comment.