Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3298)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js

Issue 2144593003: Merge dom node and node unit types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
},
/**
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698