Title: [198806] trunk
Revision
198806
Author
n_w...@apple.com
Date
2016-03-29 15:19:40 -0700 (Tue, 29 Mar 2016)

Log Message

AX: VoiceOver: Navigating Numbered Lists Causes Number to be announced On Each Line of List
https://bugs.webkit.org/show_bug.cgi?id=155984

Reviewed by Chris Fleizach.

Source/WebCore:

We should limit the list marker text only to the first line of that list item.

Test: accessibility/mac/attributed-string-with-listitem-multiple-lines.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):
(WebCore::AccessibilityObject::stringForRange):

LayoutTests:

* accessibility/mac/attributed-string-with-listitem-multiple-lines-expected.txt: Added.
* accessibility/mac/attributed-string-with-listitem-multiple-lines.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198805 => 198806)


--- trunk/LayoutTests/ChangeLog	2016-03-29 22:17:04 UTC (rev 198805)
+++ trunk/LayoutTests/ChangeLog	2016-03-29 22:19:40 UTC (rev 198806)
@@ -1,3 +1,13 @@
+2016-03-29  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver: Navigating Numbered Lists Causes Number to be announced On Each Line of List
+        https://bugs.webkit.org/show_bug.cgi?id=155984
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/attributed-string-with-listitem-multiple-lines-expected.txt: Added.
+        * accessibility/mac/attributed-string-with-listitem-multiple-lines.html: Added.
+
 2016-03-29  Antonio Gomes  <toniki...@webkit.org>
 
         Wheel events' latching state is not reset when appropriate

Added: trunk/LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines-expected.txt (0 => 198806)


--- trunk/LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines-expected.txt	2016-03-29 22:19:40 UTC (rev 198806)
@@ -0,0 +1,17 @@
+First line
+
+second line
+Long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long
+This tests that when list item has text of multiple lines we only speak the list marker for the first line.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+1. First line
+second line
+2. Long long long long long long long long long long long long long long long long long long long long long long 
+long long long long long long long long long long long long long
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines.html (0 => 198806)


--- trunk/LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines.html	2016-03-29 22:19:40 UTC (rev 198806)
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<script src=""
+<body id="body" tabindex="0">
+
+<ol>
+<li id="item1"><p>First line</p>second line</li>
+<li id="item2">Long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long</p></li>
+</ol>
+
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that when list item has text of multiple lines we only speak the list marker for the first line.");
+
+    if (window.accessibilityController) {
+        var listItem1 = accessibilityController.accessibleElementById("item1");
+        var p1 = listItem1.childAtIndex(0);
+        var firstLineRange = p1.textMarkerRangeForElement(p1);
+        debug(p1.stringForTextMarkerRange(firstLineRange));
+        
+        // Get second line.
+        var firstLineEnd = p1.endTextMarkerForTextMarkerRange(firstLineRange);
+        var secondLineRange = p1.lineTextMarkerRangeForTextMarker(p1.nextTextMarker(firstLineEnd));
+        debug(p1.stringForTextMarkerRange(secondLineRange));
+        
+        // Soft lines.
+        var listItem2 = accessibilityController.accessibleElementById("item2");
+        var item2Range = listItem2.textMarkerRangeForElement(listItem2);
+        var firstLineStart = listItem2.startTextMarkerForTextMarkerRange(item2Range);
+        firstLineRange = listItem2.lineTextMarkerRangeForTextMarker(firstLineStart);
+        debug(listItem2.stringForTextMarkerRange(firstLineRange));
+        
+        firstLineEnd = listItem2.endTextMarkerForTextMarkerRange(firstLineRange);
+        secondLineRange = listItem2.lineTextMarkerRangeForTextMarker(listItem2.nextTextMarker(firstLineEnd));
+        debug(listItem2.stringForTextMarkerRange(secondLineRange));
+    }
+
+</script>
+
+<script src=""
+
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (198805 => 198806)


--- trunk/Source/WebCore/ChangeLog	2016-03-29 22:17:04 UTC (rev 198805)
+++ trunk/Source/WebCore/ChangeLog	2016-03-29 22:19:40 UTC (rev 198806)
@@ -1,3 +1,18 @@
+2016-03-29  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver: Navigating Numbered Lists Causes Number to be announced On Each Line of List
+        https://bugs.webkit.org/show_bug.cgi?id=155984
+
+        Reviewed by Chris Fleizach.
+
+        We should limit the list marker text only to the first line of that list item.
+
+        Test: accessibility/mac/attributed-string-with-listitem-multiple-lines.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):
+        (WebCore::AccessibilityObject::stringForRange):
+
 2016-03-29  Antonio Gomes  <toniki...@webkit.org>
 
         Wheel events' latching state is not reset when appropriate

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (198805 => 198806)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-03-29 22:17:04 UTC (rev 198805)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-03-29 22:19:40 UTC (rev 198806)
@@ -1264,6 +1264,13 @@
     if (!isStartOfLine(visiblePositionStart))
         return String();
 
+    // We should speak the list marker only for the first line.
+    RenderListItem* listItem = renderListItemContainerForNode(node);
+    if (!listItem)
+        return String();
+    if (!inSameLine(visiblePositionStart, firstPositionInNode(&listItem->element())))
+        return String();
+    
     return listMarkerTextForNode(node);
 }
 
@@ -1281,7 +1288,9 @@
         // non-zero length means textual node, zero length means replaced node (AKA "attachments" in AX)
         if (it.text().length()) {
             // Add a textual representation for list marker text.
-            builder.append(listMarkerTextForNode(it.node()));
+            // Don't add list marker text for new line character.
+            if (it.text().length() != 1 || !isSpaceOrNewline(it.text()[0]))
+                builder.append(listMarkerTextForNodeAndPosition(it.node(), VisiblePosition(range->startPosition())));
             it.appendTextToStringBuilder(builder);
         } else {
             // locate the node and starting offset for this replaced range
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to