Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
index a47944998cf3d49ef86202d8e90b1b4cfec6d3a2..1e1b4d171ece224a8332ea9f0015bae861b7b02c 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
@@ -1082,24 +1082,24 @@ Output.prototype = { |
this.format_(node, formatString, buff); |
} |
} else if (token == 'descendants') { |
- if (!node || AutomationPredicate.leaf(node)) |
+ if (!node || AutomationPredicate.leafOrStaticText(node)) |
return; |
// Construct a range to the leftmost and rightmost leaves. |
var leftmost = AutomationUtil.findNodePre( |
- node, Dir.FORWARD, AutomationPredicate.leaf); |
+ node, Dir.FORWARD, AutomationPredicate.leafOrStaticText); |
var rightmost = AutomationUtil.findNodePre( |
- node, Dir.BACKWARD, AutomationPredicate.leaf); |
+ node, Dir.BACKWARD, AutomationPredicate.leafOrStaticText); |
if (!leftmost || !rightmost) |
return; |
var subrange = new cursors.Range( |
- new cursors.Cursor(leftmost, 0), |
- new cursors.Cursor(rightmost, 0)); |
+ new cursors.Cursor(leftmost, cursors.NODE_INDEX), |
+ new cursors.Cursor(rightmost, cursors.NODE_INDEX)); |
var prev = null; |
if (node) |
prev = cursors.Range.fromNode(node); |
- this.range_(subrange, prev, Output.EventType.NAVIGATE, buff); |
+ this.render_(subrange, prev, Output.EventType.NAVIGATE, buff); |
} else if (token == 'joinedDescendants') { |
var unjoined = []; |
this.format_(node, '$descendants', unjoined); |
@@ -1311,7 +1311,10 @@ Output.prototype = { |
return buff; |
}.bind(this); |
- while (cursor.node != range.end.node) { |
+ while (cursor.node && |
+ range.end.node && |
+ AutomationUtil.getDirection(cursor.node, range.end.node) == |
+ Dir.FORWARD) { |
var node = cursor.node; |
rangeBuff.push.apply(rangeBuff, formatNodeAndAncestors(node, prevNode)); |
prevNode = node; |
@@ -1323,8 +1326,6 @@ Output.prototype = { |
if (cursor.node == prevNode) |
break; |
} |
- var lastNode = range.end.node; |
- rangeBuff.push.apply(rangeBuff, formatNodeAndAncestors(lastNode, prevNode)); |
}, |
/** |