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

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

Issue 2331253002: Use category flush for focus events. (Closed)
Patch Set: fix test Created 4 years, 3 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/keyboard_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 f0a9aecd6499f0dfbbdc5a7a1e93889bba9feaed..a352f0ec193ea2a722b1bb25c54eed393c48d8e2 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -58,13 +58,13 @@ var RoleType = chrome.automation.RoleType;
*/
Output = function() {
// TODO(dtseng): Include braille specific rules.
- /** @type {!Array<!Spannable>} */
+ /** @type {!Array<!Spannable>} @private */
this.speechBuffer_ = [];
- /** @type {!Array<!Spannable>} */
+ /** @type {!Array<!Spannable>} @private */
this.brailleBuffer_ = [];
- /** @type {!Array<!Object>} */
+ /** @type {!Array<!Object>} @private */
this.locations_ = [];
- /** @type {function(?)} */
+ /** @type {function(?)} @private */
this.speechEndCallback_;
/**
@@ -688,19 +688,21 @@ Output.EventType = {
};
/**
- * If true, the next speech utterance will flush instead of the normal
+ * If set, the next speech utterance will use this value instead of the normal
* queueing mode.
- * @type {boolean}
+ * @type {cvox.QueueMode|undefined}
* @private
*/
-Output.flushNextSpeechUtterance_ = false;
+Output.forceModeForNextSpeechUtterance_;
/**
- * Calling this will make the next speech utterance flush even if it would
- * normally queue or do a category flush.
+ * Calling this will make the next speech utterance use |mode| even if it would
+ * normally queue or do a category flush. This differs from the |withQueueMode|
+ * instance method as it can apply to future output.
+ * @param {cvox.QueueMode} mode
*/
-Output.flushNextSpeechUtterance = function() {
- Output.flushNextSpeechUtterance_ = true;
+Output.forceModeForNextSpeechUtterance = function(mode) {
+ Output.forceModeForNextSpeechUtterance_ = mode;
};
Output.prototype = {
@@ -907,6 +909,7 @@ Output.prototype = {
/**
* Triggers callback for a speech event.
* @param {function()} callback
+ * @return {Output}
*/
onSpeechEnd: function(callback) {
this.speechEndCallback_ = function(opt_cleanupOnly) {
@@ -923,9 +926,10 @@ Output.prototype = {
// Speech.
var queueMode = this.queueMode_;
this.speechBuffer_.forEach(function(buff, i, a) {
- if (Output.flushNextSpeechUtterance_ && buff.length > 0) {
- queueMode = cvox.QueueMode.FLUSH;
- Output.flushNextSpeechUtterance_ = false;
+ if (Output.forceModeForNextSpeechUtterance_ !== undefined &&
+ buff.length > 0) {
+ queueMode = Output.forceModeForNextSpeechUtterance_;
+ Output.forceModeForNextSpeechUtterance_ = undefined;
}
var speechProps = {};
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/keyboard_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698