AX: certain elements not included in accessibility tree
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2016 19:03:11 +0000 (19:03 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2016 19:03:11 +0000 (19:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155480

Reviewed by Beth Dakin.

Source/WebCore:

This test case exposed a hole in the nextSibling logic where you can get into a state where we skip content.
The fix is to check if an inline element continuation has no sibling, to fall back on to the parent case to see if that has a sibling.

Test: accessibility/double-nested-inline-element-missing-from-tree.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::nextSibling):

LayoutTests:

* accessibility/double-nested-inline-element-missing-from-tree-expected.txt: Added.
* accessibility/double-nested-inline-element-missing-from-tree.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/double-nested-inline-element-missing-from-tree-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/double-nested-inline-element-missing-from-tree.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp

index 1352757..f20afe3 100644 (file)
@@ -1,3 +1,13 @@
+2016-03-15  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: certain elements not included in accessibility tree
+        https://bugs.webkit.org/show_bug.cgi?id=155480
+
+        Reviewed by Beth Dakin.
+
+        * accessibility/double-nested-inline-element-missing-from-tree-expected.txt: Added.
+        * accessibility/double-nested-inline-element-missing-from-tree.html: Added.
+
 2016-03-15  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r198203.
diff --git a/LayoutTests/accessibility/double-nested-inline-element-missing-from-tree-expected.txt b/LayoutTests/accessibility/double-nested-inline-element-missing-from-tree-expected.txt
new file mode 100644 (file)
index 0000000..721d28d
--- /dev/null
@@ -0,0 +1,18 @@
+test1
+test2
+End of test
+This tests that when you have a two nested inline continuations and the child one has no siblings, that we go back to the parent to check for its continuation.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXWebArea AXValue: 
+  AXRole: AXGroup AXValue: 
+    AXRole: AXStaticText AXValue: test1
+    AXRole: AXGroup AXValue: 
+      AXRole: AXStaticText AXValue: test2
+  AXRole: AXGroup AXValue: 
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/double-nested-inline-element-missing-from-tree.html b/LayoutTests/accessibility/double-nested-inline-element-missing-from-tree.html
new file mode 100644 (file)
index 0000000..04de971
--- /dev/null
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script>
+    function dumpAccessibilityChildren(element, level) {
+        if (element.stringValue.indexOf('End of test') >= 0)
+            return false;
+
+        var indent = "";
+        for (var k = 0; k < level; k++) { indent += "  "; }
+        debug(indent + element.role + " " + element.stringValue);
+        var childrenCount = element.childrenCount;
+        for (var k = 0; k < childrenCount; k++) {
+            if (!dumpAccessibilityChildren(element.childAtIndex(k), level+1))
+                return false;
+        }
+        return true;
+    }
+</script>
+</head>
+
+<body id="body">
+
+<span>
+    <span>
+        test1
+        <div></div>
+    </span><div>
+    test2
+    </div>
+</span>
+
+<div>End of test</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    if (window.accessibilityController) {
+        description("This tests that when you have a two nested inline continuations and the child one has no siblings, that we go back to the parent to check for its continuation.");
+
+        var content = accessibilityController.rootElement.childAtIndex(0);
+        dumpAccessibilityChildren(content, 0);
+    }
+    successfullyParsed = true;
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index 3157959..bd7b7bb 100644 (file)
@@ -1,3 +1,18 @@
+2016-03-15  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: certain elements not included in accessibility tree
+        https://bugs.webkit.org/show_bug.cgi?id=155480
+
+        Reviewed by Beth Dakin.
+
+        This test case exposed a hole in the nextSibling logic where you can get into a state where we skip content.
+        The fix is to check if an inline element continuation has no sibling, to fall back on to the parent case to see if that has a sibling.
+
+        Test: accessibility/double-nested-inline-element-missing-from-tree.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::nextSibling):
+
 2016-03-15  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r198203.
index 1bfc966..0ca2961 100644 (file)
@@ -388,7 +388,8 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const
         nextSibling = endOfContinuations(*m_renderer)->nextSibling();
 
     // Case 5: node has no next sibling, and its parent is an inline with a continuation.
-    else if (isInlineWithContinuation(*m_renderer->parent())) {
+    // Case 5.1: After case 4, (the element was inline w/ continuation but had no sibling), then check it's parent.
+    if (!nextSibling && isInlineWithContinuation(*m_renderer->parent())) {
         auto& continuation = *downcast<RenderInline>(*m_renderer->parent()).continuation();
         
         // Case 5a: continuation is a block - in this case the block itself is the next sibling.