AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Feb 2019 04:31:33 +0000 (04:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Feb 2019 04:31:33 +0000 (04:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194923

Patch by Eric Liang <ericliang@apple.com> on 2019-02-22
Reviewed by Chris Fleizach.

Source/WebCore:

Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.

Test: accessibility/mac/children-in-navigation-order-returns-children.html

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

Added test to check AXChildrenInNavigationOrder returns non-empty array from AXChildren.
* accessibility/mac/children-in-navigation-order-returns-children-expected.txt: Added.
* accessibility/mac/children-in-navigation-order-returns-children.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/mac/children-in-navigation-order-returns-children-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/mac/children-in-navigation-order-returns-children.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 491bcb2..955dc5e 100644 (file)
@@ -1,3 +1,14 @@
+2019-02-22  Eric Liang  <ericliang@apple.com>
+
+        AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
+        https://bugs.webkit.org/show_bug.cgi?id=194923
+
+        Reviewed by Chris Fleizach.
+
+        Added test to check AXChildrenInNavigationOrder returns non-empty array from AXChildren.
+        * accessibility/mac/children-in-navigation-order-returns-children-expected.txt: Added.
+        * accessibility/mac/children-in-navigation-order-returns-children.html: Added.
+
 2019-02-22  Basuke Suzuki  <basuke.suzuki@sony.com>
 
         [WinCairo] Enable wk1/wk2 suffix for platform search path.
diff --git a/LayoutTests/accessibility/mac/children-in-navigation-order-returns-children-expected.txt b/LayoutTests/accessibility/mac/children-in-navigation-order-returns-children-expected.txt
new file mode 100644 (file)
index 0000000..aa86423
--- /dev/null
@@ -0,0 +1,14 @@
+This tests that AXChildrenInNavigationOrder returns non-empty array from AXChildren.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS children0.length is 3
+PASS children1.length is 3
+PASS children0[i].role == children1[i].role is true
+PASS children0[i].role == children1[i].role is true
+PASS children0[i].role == children1[i].role is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/mac/children-in-navigation-order-returns-children.html b/LayoutTests/accessibility/mac/children-in-navigation-order-returns-children.html
new file mode 100644 (file)
index 0000000..312dc4f
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.span-absolute {
+    position: absolute;
+    overflow: hidden;
+    height: 1px;
+}
+.lineheight{
+    line-height: 1.32;
+}
+</style>
+</head>
+<body id="body">
+<script src="../../resources/js-test-pre.js"></script>
+<div id="content">
+<div>
+    <a id="test0" href="https://www.apple.com">Learn more <span class="span-absolute">about Apple</span> <button>Click</button></a>
+</div>
+<div class="lineheight">
+    <a id="test1" href="https://www.apple.com">Learn more <span class="span-absolute">about Apple</span> <button>Click</button></a>
+</div>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that AXChildrenInNavigationOrder returns non-empty array from AXChildren.");
+
+    if (window.accessibilityController) {
+        var testElement0 = accessibilityController.accessibleElementById("test0");
+        var testElement1 = accessibilityController.accessibleElementById("test1");
+        var children0 = testElement0.uiElementArrayAttributeValue("AXChildren");
+        var children1 = testElement1.uiElementArrayAttributeValue("AXChildrenInNavigationOrder");
+        shouldBe("children0.length", "3");
+        shouldBe("children1.length", "3");
+        for (var i = 0; i < 3; i++) {
+            shouldBeTrue("children0[i].role == children1[i].role");
+        }
+
+        document.getElementById("content").style.visibility = 'hidden';
+    } else {
+        testFailed("Could not load accessibility controller");
+    }
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index b3caad6..9c84720 100644 (file)
@@ -1,3 +1,17 @@
+2019-02-22  Eric Liang  <ericliang@apple.com>
+
+        AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
+        https://bugs.webkit.org/show_bug.cgi?id=194923
+
+        Reviewed by Chris Fleizach.
+
+        Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.
+
+        Test: accessibility/mac/children-in-navigation-order-returns-children.html
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2019-02-22  Tim Horton  <timothy_horton@apple.com>
 
         ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds
index f744591..446d358 100644 (file)
@@ -153,6 +153,10 @@ using namespace HTMLNames;
 #define NSAccessibilityBlockQuoteLevelAttribute @"AXBlockQuoteLevel"
 #endif
 
+#ifndef NSAccessibilityChildrenInNavigationOrderAttribute
+#define NSAccessibilityChildrenInNavigationOrderAttribute @"AXChildrenInNavigationOrder"
+#endif
+
 #ifndef NSAccessibilityAccessKeyAttribute
 #define NSAccessibilityAccessKeyAttribute @"AXAccessKey"
 #endif
@@ -2482,7 +2486,7 @@ IGNORE_WARNINGS_END
         return parent->wrapper();
     }
     
-    if ([attributeName isEqualToString: NSAccessibilityChildrenAttribute]) {
+    if ([attributeName isEqualToString: NSAccessibilityChildrenAttribute] || [attributeName isEqualToString: NSAccessibilityChildrenInNavigationOrderAttribute]) {
         if (!self.childrenVectorSize) {
             NSArray* children = [self renderWidgetChildren];
             if (children != nil)