Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
1374fcf
commit 7accd83
Showing
25 changed files
with
282 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
LayoutTests/accessibility/aria-sort-changed-notification-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
78 changes: 78 additions & 0 deletions
78
LayoutTests/accessibility/aria-sort-changed-notification.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.