Title: [201067] trunk
Revision
201067
Author
n_w...@apple.com
Date
2016-05-17 19:14:48 -0700 (Tue, 17 May 2016)

Log Message

AX: Adding children incorrectly when there are nested inline continuations
https://bugs.webkit.org/show_bug.cgi?id=157818

Reviewed by Chris Fleizach.

Source/WebCore:

When getting the inline element continuation's next sibling, if we fall back on to the parent
case, we might end up adding the same node repeatedly. Fixed it by skipping this case.

Test: accessibility/mac/nested-inline-elements-children.html

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

LayoutTests:

* accessibility/mac/nested-inline-elements-children-expected.txt: Added.
* accessibility/mac/nested-inline-elements-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201066 => 201067)


--- trunk/LayoutTests/ChangeLog	2016-05-18 02:11:19 UTC (rev 201066)
+++ trunk/LayoutTests/ChangeLog	2016-05-18 02:14:48 UTC (rev 201067)
@@ -1,3 +1,13 @@
+2016-05-17  Nan Wang  <n_w...@apple.com>
+
+        AX: Adding children incorrectly when there are nested inline continuations
+        https://bugs.webkit.org/show_bug.cgi?id=157818
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/nested-inline-elements-children-expected.txt: Added.
+        * accessibility/mac/nested-inline-elements-children.html: Added.
+
 2016-05-17  Dean Jackson  <d...@apple.com>
 
         Add media query support for wide gamut displays on Mac

Added: trunk/LayoutTests/accessibility/mac/nested-inline-elements-children-expected.txt (0 => 201067)


--- trunk/LayoutTests/accessibility/mac/nested-inline-elements-children-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/nested-inline-elements-children-expected.txt	2016-05-18 02:14:48 UTC (rev 201067)
@@ -0,0 +1,18 @@
+test1
+test2
+test3
+This tests that when you have nested inline continuations, we add the children correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXGroup AXValue: 
+  AXRole: AXStaticText AXValue: test1
+  AXRole: AXStaticText AXValue: test2
+  AXRole: AXGroup AXValue: 
+    AXRole: AXStaticText AXValue: test3
+PASS content.childrenCount is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/nested-inline-elements-children.html (0 => 201067)


--- trunk/LayoutTests/accessibility/mac/nested-inline-elements-children.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/nested-inline-elements-children.html	2016-05-18 02:14:48 UTC (rev 201067)
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<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">
+
+<div>
+<span>
+    <span>
+        test1
+        <div></div>
+        <span> test2</span>
+    </span><div>
+    test3
+    </div>
+</span>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    if (window.accessibilityController) {
+        description("This tests that when you have nested inline continuations, we add the children correctly.");
+
+        var content = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
+        dumpAccessibilityChildren(content, 0);
+        
+        shouldBe("content.childrenCount", "3");
+    }
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (201066 => 201067)


--- trunk/Source/WebCore/ChangeLog	2016-05-18 02:11:19 UTC (rev 201066)
+++ trunk/Source/WebCore/ChangeLog	2016-05-18 02:14:48 UTC (rev 201067)
@@ -1,3 +1,18 @@
+2016-05-17  Nan Wang  <n_w...@apple.com>
+
+        AX: Adding children incorrectly when there are nested inline continuations
+        https://bugs.webkit.org/show_bug.cgi?id=157818
+
+        Reviewed by Chris Fleizach.
+
+        When getting the inline element continuation's next sibling, if we fall back on to the parent
+        case, we might end up adding the same node repeatedly. Fixed it by skipping this case.
+
+        Test: accessibility/mac/nested-inline-elements-children.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::nextSibling):
+
 2016-05-17  Dean Jackson  <d...@apple.com>
 
         Add media query support for wide gamut displays on Mac

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (201066 => 201067)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-05-18 02:11:19 UTC (rev 201066)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-05-18 02:14:48 UTC (rev 201067)
@@ -399,6 +399,13 @@
         // Case 5b: continuation is an inline - in this case the inline's first child is the next sibling
         else
             nextSibling = firstChildConsideringContinuation(continuation);
+        
+        // After case 4, there are chances that nextSibling has the same node as the current renderer,
+        // which might lead to adding the same child repeatedly.
+        if (nextSibling && nextSibling->node() == m_renderer->node()) {
+            if (AccessibilityObject* nextObj = axObjectCache()->getOrCreate(nextSibling))
+                return nextObj->nextSibling();
+        }
     }
 
     if (!nextSibling)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to