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

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

Issue 1458723002: Finish implementing ChromeVox Next active indicator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@load_key_map
Patch Set: Made test expectations approximate Created 5 years, 1 month 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
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 15a556e8dc36395b80803454f1e75f2089d95fdf..d5f3e83c606410b3cf45e54b0f2c329518a904d6 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -63,9 +63,9 @@ Output = function() {
/**
* Current global options.
- * @type {{speech: boolean, braille: boolean, location: boolean}}
+ * @type {{speech: boolean, braille: boolean}}
*/
- this.formatOptions_ = {speech: true, braille: false, location: true};
+ this.formatOptions_ = {speech: true, braille: false};
/**
* Speech properties to apply to the entire output.
@@ -618,7 +618,7 @@ Output.prototype = {
* @return {!Output}
*/
withSpeech: function(range, prevRange, type) {
- this.formatOptions_ = {speech: true, braille: false, location: true};
+ this.formatOptions_ = {speech: true, braille: false};
this.render_(range, prevRange, type, this.speechBuffer_);
return this;
},
@@ -631,12 +631,25 @@ Output.prototype = {
* @return {!Output}
*/
withBraille: function(range, prevRange, type) {
- this.formatOptions_ = {speech: false, braille: true, location: false};
+ this.formatOptions_ = {speech: false, braille: true};
this.render_(range, prevRange, type, this.brailleBuffer_);
return this;
},
/**
+ * Specify ranges for location.
+ * @param {!cursors.Range} range
+ * @param {cursors.Range} prevRange
+ * @param {chrome.automation.EventType|Output.EventType} type
+ * @return {!Output}
+ */
+ withLocation: function(range, prevRange, type) {
+ this.formatOptions_ = {speech: false, braille: false};
+ this.render_(range, prevRange, type, this.speechBuffer_);
+ return this;
+ },
+
+ /**
* Specify the same ranges for speech and braille.
* @param {!cursors.Range} range
* @param {cursors.Range} prevRange
@@ -666,10 +679,10 @@ Output.prototype = {
* @return {!Output}
*/
format: function(formatStr) {
- this.formatOptions_ = {speech: true, braille: false, location: true};
+ this.formatOptions_ = {speech: true, braille: false};
this.format_(null, formatStr, this.speechBuffer_);
- this.formatOptions_ = {speech: false, braille: true, location: false};
+ this.formatOptions_ = {speech: false, braille: true};
this.format_(null, formatStr, this.brailleBuffer_);
return this;
@@ -1054,8 +1067,7 @@ Output.prototype = {
var buff = [];
this.ancestry_(node, prevNode, type, buff);
this.node_(node, prevNode, type, buff);
- if (this.formatOptions_.location)
- this.locations_.push(node.location);
+ this.locations_.push(node.location);
return buff;
}.bind(this);
@@ -1183,6 +1195,8 @@ Output.prototype = {
endIndex++;
this.append_(
buff, range.start.getText().substring(startIndex, endIndex));
+ this.locations_.push(
+ range.start.node.boundsForRange(startIndex, endIndex));
},
/**

Powered by Google App Engine
This is Rietveld 408576698