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

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

Issue 2390763002: Don't output earcons when constructing output from descendants (Closed)
Patch Set: Created 4 years, 2 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/desktop_automation_handler.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 30d36566f3c36b19afde6c3caf81f9beeec3c98f..2bd8a40bd468b557c559c7d7e297d5da0b986c3e 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -69,10 +69,14 @@ Output = function() {
/**
* Current global options.
- * @type {{speech: boolean, braille: boolean, auralStyle: boolean}}
+ * @type {{speech: boolean,
+ * braille: boolean,
+ * auralStyle: boolean,
+ * earcons: boolean}}
* @private
*/
- this.formatOptions_ = {speech: true, braille: false, auralStyle: false};
+ this.formatOptions_ =
+ {speech: true, braille: false, auralStyle: false, earcons: true};
/**
* The speech category for the generated speech utterance.
@@ -437,7 +441,7 @@ Output.RULES = {
},
div: {
enter: '$nameFromNode',
- speak: '$name $description $descendants'
+ speak: '$name $description $descendantsNoEarcons'
},
grid: {
enter: '$nameFromNode $role $description'
@@ -714,7 +718,8 @@ Output.prototype = {
* @return {!Output}
*/
withSpeech: function(range, prevRange, type) {
- this.formatOptions_ = {speech: true, braille: false, auralStyle: false};
+ this.formatOptions_ =
+ {speech: true, braille: false, auralStyle: false, earcons: true};
this.render_(range, prevRange, type, this.speechBuffer_);
return this;
},
@@ -727,7 +732,8 @@ Output.prototype = {
* @return {!Output}
*/
withRichSpeech: function(range, prevRange, type) {
- this.formatOptions_ = {speech: true, braille: false, auralStyle: true};
+ this.formatOptions_ =
+ {speech: true, braille: false, auralStyle: true, earcons: true};
this.render_(range, prevRange, type, this.speechBuffer_);
return this;
},
@@ -740,7 +746,8 @@ Output.prototype = {
* @return {!Output}
*/
withBraille: function(range, prevRange, type) {
- this.formatOptions_ = {speech: false, braille: true, auralStyle: false};
+ this.formatOptions_ =
+ {speech: false, braille: true, auralStyle: false, earcons: false};
this.render_(range, prevRange, type, this.brailleBuffer_);
return this;
},
@@ -753,7 +760,8 @@ Output.prototype = {
* @return {!Output}
*/
withLocation: function(range, prevRange, type) {
- this.formatOptions_ = {speech: false, braille: false, auralStyle: false};
+ this.formatOptions_ =
+ {speech: false, braille: false, auralStyle: false, earcons: false};
this.render_(range, prevRange, type, [] /*unused output*/);
return this;
},
@@ -850,7 +858,8 @@ Output.prototype = {
formatForSpeech: function(formatStr, opt_node) {
var node = opt_node || null;
- this.formatOptions_ = {speech: true, braille: false, auralStyle: false};
+ this.formatOptions_ =
+ {speech: true, braille: false, auralStyle: false, earcons: true};
this.format_(node, formatStr, this.speechBuffer_);
return this;
@@ -867,7 +876,8 @@ Output.prototype = {
formatForBraille: function(formatStr, opt_node) {
var node = opt_node || null;
- this.formatOptions_ = {speech: false, braille: true, auralStyle: false};
+ this.formatOptions_ =
+ {speech: false, braille: true, auralStyle: false, earcons: false};
this.format_(node, formatStr, this.brailleBuffer_);
return this;
@@ -1124,6 +1134,11 @@ Output.prototype = {
var unjoined = [];
this.format_(node, '$descendants', unjoined);
this.append_(buff, unjoined.join(' '), options);
+ } else if (token == 'descendantsNoEarcons') {
+ var state = this.formatOptions_.earcons;
+ this.formatOptions_.earcons = false;
+ this.format_(node, '$descendants', buff);
+ this.formatOptions_.earcons = state;
} else if (token == 'role') {
if (localStorage['useVerboseMode'] == 'false')
return;
@@ -1202,7 +1217,7 @@ Output.prototype = {
this.format_(node, cond.nextSibling.nextSibling, buff);
} else if (token == 'earcon') {
// Ignore unless we're generating speech output.
- if (!this.formatOptions_.speech)
+ if (!this.formatOptions_.speech || !this.formatOptions_.earcons)
return;
options.annotation.push(
@@ -1655,6 +1670,8 @@ Output.prototype = {
* @return {Output.Action}
*/
findEarcon_: function(node, opt_prevNode) {
+ if (!this.formatOptions_.earcons)
+ return null;
if (node === opt_prevNode)
return null;
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698