https://bugs.webkit.org/show_bug.cgi?id=177955
Reviewed by Chris Fleizach.
Source/WebCore:
Expose "none" as the value of aria-sort when the attribute is present and not
one of the other valid sort types. Also add a new AccessibilitySortDirection,
SortDirectionInvalid. This is currently only being used when the sort direction
is sought for a role which does not support this ARIA attribute, but might come
in handy if we want to add further sanity checks on the author-provided values.
Test: accessibility/gtk/aria-sort-values.html
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::sortDirection const):
* accessibility/AccessibilityObject.h:
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
LayoutTests:
* accessibility/gtk/aria-sort-values-expected.txt: Added.
* accessibility/gtk/aria-sort-values.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223048
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-10-09 Joanmarie Diggs <jdiggs@igalia.com>
+
+ AX: [ATK] Explicitly-set aria-sort value of "none" should be exposed as an object attribute
+ https://bugs.webkit.org/show_bug.cgi?id=177955
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/gtk/aria-sort-values-expected.txt: Added.
+ * accessibility/gtk/aria-sort-values.html: Added.
+
2017-10-09 Ryan Haddad <ryanhaddad@apple.com>
Mark media/media-source/media-source-paint-to-canvas.html as failing.
--- /dev/null
+This verifies that explicitly-set values of aria-sort are exposed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+test1 AXRole: AXColumnHeader (sort attribute not exposed)
+test2 AXRole: AXColumnHeader sort:ascending
+test3 AXRole: AXColumnHeader sort:descending
+test4 AXRole: AXColumnHeader sort:other
+test5 AXRole: AXColumnHeader sort:none
+test6 AXRole: AXColumnHeader sort:none
+test7 AXRole: AXColumnHeader sort:none
+test8 AXRole: AXCell (sort attribute not exposed)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+ <div id="content">
+ <div role="grid">
+ <div role="row">
+ <div role="columnheader" id="test1">content</div>
+ <div role="columnheader" id="test2" aria-sort="ascending">content</div>
+ <div role="columnheader" id="test3" aria-sort="descending">content</div>
+ <div role="columnheader" id="test4" aria-sort="other">content</div>
+ <div role="columnheader" id="test5" aria-sort="none">content</div>
+ <div role="columnheader" id="test6" aria-sort="foo">content</div>
+ <div role="columnheader" id="test7" aria-sort="">content</div>
+ <div role="gridcell" id="test8" aria-sort="other">content</div>
+ </div>
+ </div>
+ </div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+ function sortAttribute(axElement) {
+ var allAttributes = axElement.allAttributes();
+ var index = allAttributes.search("sort:");
+ if (index == -1)
+ return "(sort attribute not exposed)";
+ string = allAttributes.substring(index);
+ return string.substring(0, string.search(","));
+ }
+
+ description("This verifies that explicitly-set values of aria-sort are exposed.");
+ if (window.accessibilityController) {
+ for (var i = 1; i <= 8; i++) {
+ var axElement = accessibilityController.accessibleElementById("test" + i);
+ debug("test" + i + " " + axElement.role + " " + sortAttribute(axElement));
+ }
+
+ document.getElementById("content").style.visibility = "hidden";
+ }
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
+
+2017-10-09 Joanmarie Diggs <jdiggs@igalia.com>
+
+ AX: [ATK] Explicitly-set aria-sort value of "none" should be exposed as an object attribute
+ https://bugs.webkit.org/show_bug.cgi?id=177955
+
+ Reviewed by Chris Fleizach.
+
+ Expose "none" as the value of aria-sort when the attribute is present and not
+ one of the other valid sort types. Also add a new AccessibilitySortDirection,
+ SortDirectionInvalid. This is currently only being used when the sort direction
+ is sought for a role which does not support this ARIA attribute, but might come
+ in handy if we want to add further sanity checks on the author-provided values.
+
+ Test: accessibility/gtk/aria-sort-values.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::sortDirection const):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+ (webkitAccessibleGetAttributes):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+
2017-10-09 Robin Morisset <rmorisset@apple.com>
Make the names of the options consistent
AccessibilitySortDirection AccessibilityObject::sortDirection() const
{
+ AccessibilityRole role = roleValue();
+ if (role != RowHeaderRole && role != ColumnHeaderRole)
+ return SortDirectionInvalid;
+
const AtomicString& sortAttribute = getAttribute(aria_sortAttr);
if (equalLettersIgnoringASCIICase(sortAttribute, "ascending"))
return SortDirectionAscending;
SortDirectionNone,
SortDirectionAscending,
SortDirectionDescending,
- SortDirectionOther
+ SortDirectionOther,
+ SortDirectionInvalid
};
enum AccessibilitySearchDirection {
if (coreObject->supportsARIACurrent())
attributeSet = addToAtkAttributeSet(attributeSet, "current", coreObject->ariaCurrentValue().utf8().data());
- AccessibilitySortDirection sortDirection = coreObject->sortDirection();
- if (sortDirection != SortDirectionNone) {
- // WAI-ARIA spec says to translate the value as is from the attribute.
- const AtomicString& sortAttribute = coreObject->getAttribute(HTMLNames::aria_sortAttr);
- attributeSet = addToAtkAttributeSet(attributeSet, "sort", sortAttribute.string().utf8().data());
+ // The Core AAM states that an explicitly-set value should be exposed, including "none".
+ if (coreObject->hasAttribute(HTMLNames::aria_sortAttr)) {
+ switch (coreObject->sortDirection()) {
+ case SortDirectionInvalid:
+ break;
+ case SortDirectionAscending:
+ attributeSet = addToAtkAttributeSet(attributeSet, "sort", "ascending");
+ break;
+ case SortDirectionDescending:
+ attributeSet = addToAtkAttributeSet(attributeSet, "sort", "descending");
+ break;
+ case SortDirectionOther:
+ attributeSet = addToAtkAttributeSet(attributeSet, "sort", "other");
+ break;
+ default:
+ attributeSet = addToAtkAttributeSet(attributeSet, "sort", "none");
+ }
}
if (coreObject->supportsARIAPosInSet())
if (m_object->supportsARIAPosInSet())
[additional addObject:NSAccessibilityARIAPosInSetAttribute];
- if (m_object->sortDirection() != SortDirectionNone)
+ AccessibilitySortDirection sortDirection = m_object->sortDirection();
+ if (sortDirection != SortDirectionNone && sortDirection != SortDirectionInvalid)
[additional addObject:NSAccessibilitySortDirectionAttribute];
// If an object is a child of a live region, then add these