AX: [ATK] The value of aria-level is not exposed on non-heading roles
authorjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2017 01:02:47 +0000 (01:02 +0000)
committerjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2017 01:02:47 +0000 (01:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177775

Reviewed by Chris Fleizach.

Source/WebCore:

Expose the value of aria-level via the "level" AtkObject attribute, as is currently
done for headings.

Test: accessibility/gtk/aria-level.html

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetAttributes):

Tools:

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::hierarchicalLevel const):

LayoutTests:

* accessibility/gtk/aria-level-expected.txt: Added.
* accessibility/gtk/aria-level.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/gtk/aria-level-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/gtk/aria-level.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

index b115e49..bd0eb1e 100644 (file)
@@ -1,3 +1,13 @@
+2017-10-02  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] The value of aria-level is not exposed on non-heading roles
+        https://bugs.webkit.org/show_bug.cgi?id=177775
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/gtk/aria-level-expected.txt: Added.
+        * accessibility/gtk/aria-level.html: Added.
+
 2017-10-02  Brent Fulgham  <bfulgham@apple.com>
 
         [Mac] Use safer decoding practices for NSKeyedUnarchiver
diff --git a/LayoutTests/accessibility/gtk/aria-level-expected.txt b/LayoutTests/accessibility/gtk/aria-level-expected.txt
new file mode 100644 (file)
index 0000000..19b83de
--- /dev/null
@@ -0,0 +1,15 @@
+This tests the exposure of aria-level.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXTable level: 1
+AXRole: AXHeading level: 2
+AXRole: AXListItem level: 3
+AXRole: AXTreeGrid level: 4
+AXRole: AXRow level: 5
+AXRole: AXTreeItem level: 6
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/gtk/aria-level.html b/LayoutTests/accessibility/gtk/aria-level.html
new file mode 100644 (file)
index 0000000..080dbb0
--- /dev/null
@@ -0,0 +1,36 @@
+<!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 id="test1" role="grid" aria-level="1">X</div>
+  <div id="test2" role="heading" aria-level="2">X</div>
+  <div role="list">
+    <div id="test3" role="listitem" aria-level="3">X</div>
+  </div>
+  <div id="test4" role="treegrid" aria-level="4">
+    <div id="test5" role="row" aria-level="5">
+    </div>
+  </div>
+  <div role="tree">
+    <div id="test6" role="treeitem" aria-level="6">X</div>
+  </div>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    description("This tests the exposure of aria-level.");
+    if (window.accessibilityController) {
+        for (var i = 1; i <= 6; i++) {
+            var axElement = accessibilityController.accessibleElementById("test" + i);
+            debug(axElement.role + " level: " + axElement.hierarchicalLevel);
+        }
+
+        document.getElementById("content").style.visibility = "hidden";
+    }
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index be0bd32..bf9192d 100644 (file)
@@ -1,3 +1,18 @@
+2017-10-02  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] The value of aria-level is not exposed on non-heading roles
+        https://bugs.webkit.org/show_bug.cgi?id=177775
+
+        Reviewed by Chris Fleizach.
+
+        Expose the value of aria-level via the "level" AtkObject attribute, as is currently
+        done for headings.
+
+        Test: accessibility/gtk/aria-level.html
+
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (webkitAccessibleGetAttributes):
+
 2017-10-02  Andy Estes  <aestes@apple.com>
 
         [Payment Request] Validate payment method identifiers
index 8f16127..f604482 100644 (file)
@@ -448,9 +448,9 @@ static AtkAttributeSet* webkitAccessibleGetAttributes(AtkObject* object)
             attributeSet = addToAtkAttributeSet(attributeSet, "html-id", id.utf8().data());
     }
 
-    int headingLevel = coreObject->headingLevel();
-    if (headingLevel) {
-        String value = String::number(headingLevel);
+    int level = coreObject->isHeading() ? coreObject->headingLevel() : coreObject->hierarchicalLevel();
+    if (level) {
+        String value = String::number(level);
         attributeSet = addToAtkAttributeSet(attributeSet, "level", value.utf8().data());
     }
 
index 3057f54..9504100 100644 (file)
@@ -1,3 +1,13 @@
+2017-10-02  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] The value of aria-level is not exposed on non-heading roles
+        https://bugs.webkit.org/show_bug.cgi?id=177775
+
+        Reviewed by Chris Fleizach.
+
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::hierarchicalLevel const):
+
 2017-10-02  Geoffrey Garen  <ggaren@apple.com>
 
         WeakPtr should have a move constructor
index a48c096..c31f716 100644 (file)
@@ -1680,7 +1680,10 @@ bool AccessibilityUIElement::isIndeterminate() const
 
 int AccessibilityUIElement::hierarchicalLevel() const
 {
-    // FIXME: implement
+    String level = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "level");
+    if (!level.isEmpty())
+        return level.toInt();
+
     return 0;
 }