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

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

Issue 2067713002: Fix child index and child count to respect role filtering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/background_test.extjs ('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 c556d59aed984ef9eb3677a760d940927a28bbf3..b0d8f52d6957ae171d686e40c0a20647cb02971c 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -1031,12 +1031,25 @@ Output.prototype = {
options.annotation.push(token);
this.append_(buff, node.description, options);
} else if (token == 'indexInParent') {
- options.annotation.push(token);
- this.append_(buff, String(node.indexInParent + 1));
+ if (node.parent) {
+ options.annotation.push(token);
+ var count = 0;
+ for (var i = 0, child; child = node.parent.children[i]; i++) {
+ if (node.role == child.role)
+ count++;
+ if (node === child)
+ break;
+ }
+ this.append_(buff, String(count));
+ }
} else if (token == 'parentChildCount') {
- options.annotation.push(token);
- if (node.parent)
- this.append_(buff, String(node.parent.children.length));
+ if (node.parent) {
+ options.annotation.push(token);
+ var count = node.parent.children.filter(function(child) {
+ return node.role == child.role;
+ }).length;
+ this.append_(buff, String(count));
+ }
} else if (token == 'state') {
options.annotation.push(token);
Object.getOwnPropertyNames(node.state).forEach(function(s) {
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698