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

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

Issue 1402463005: Reuse category flush when outputing live regions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Provides output services for ChromeVox. 6 * @fileoverview Provides output services for ChromeVox.
7 */ 7 */
8 8
9 goog.provide('Output'); 9 goog.provide('Output');
10 goog.provide('Output.EventType'); 10 goog.provide('Output.EventType');
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 * @param {chrome.automation.EventType|Output.EventType} type 638 * @param {chrome.automation.EventType|Output.EventType} type
639 * @return {!Output} 639 * @return {!Output}
640 */ 640 */
641 withSpeechAndBraille: function(range, prevRange, type) { 641 withSpeechAndBraille: function(range, prevRange, type) {
642 this.withSpeech(range, prevRange, type); 642 this.withSpeech(range, prevRange, type);
643 this.withBraille(range, prevRange, type); 643 this.withBraille(range, prevRange, type);
644 return this; 644 return this;
645 }, 645 },
646 646
647 /** 647 /**
648 * Applies the given speech category to the output.
649 * @param {cvox.TtsCategory} category
650 * @return {!Output}
651 */
652 withSpeechCategory: function(category) {
653 this.speechProperties_['category'] = category;
654 return this;
655 },
656
657 /**
648 * Apply a format string directly to the output buffer. This lets you 658 * Apply a format string directly to the output buffer. This lets you
649 * output a message directly to the buffer using the format syntax. 659 * output a message directly to the buffer using the format syntax.
650 * @param {string} formatStr 660 * @param {string} formatStr
651 * @return {!Output} 661 * @return {!Output}
652 */ 662 */
653 format: function(formatStr) { 663 format: function(formatStr) {
654 this.formatOptions_ = {speech: true, braille: false, location: true}; 664 this.formatOptions_ = {speech: true, braille: false, location: true};
655 this.format_(null, formatStr, this.speechBuffer_); 665 this.format_(null, formatStr, this.speechBuffer_);
656 666
657 this.formatOptions_ = {speech: false, braille: true, location: false}; 667 this.formatOptions_ = {speech: false, braille: true, location: false};
(...skipping 12 matching lines...) Expand all
670 callback(); 680 callback();
671 }.bind(this); 681 }.bind(this);
672 return this; 682 return this;
673 }, 683 },
674 684
675 /** 685 /**
676 * Executes all specified output. 686 * Executes all specified output.
677 */ 687 */
678 go: function() { 688 go: function() {
679 // Speech. 689 // Speech.
680 var queueMode = cvox.QueueMode.FLUSH; 690 var queueMode = this.speechProperties_['category'] ?
691 cvox.QueueMode.CATEGORY_FLUSH : cvox.QueueMode.FLUSH;
681 this.speechBuffer_.forEach(function(buff, i, a) { 692 this.speechBuffer_.forEach(function(buff, i, a) {
682 if (buff.toString()) { 693 if (buff.toString()) {
683 (function() { 694 (function() {
684 var scopedBuff = buff; 695 var scopedBuff = buff;
685 this.speechProperties_['startCallback'] = function() { 696 this.speechProperties_['startCallback'] = function() {
686 var actions = scopedBuff.getSpansInstanceOf(Output.Action); 697 var actions = scopedBuff.getSpansInstanceOf(Output.Action);
687 if (actions) { 698 if (actions) {
688 actions.forEach(function(a) { 699 actions.forEach(function(a) {
689 a.run(); 700 a.run();
690 }); 701 });
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 elem.end); 1331 elem.end);
1321 }); 1332 });
1322 spansToRemove.forEach(result.removeSpan.bind(result)); 1333 spansToRemove.forEach(result.removeSpan.bind(result));
1323 separator = Output.SPACE; 1334 separator = Output.SPACE;
1324 }); 1335 });
1325 return result; 1336 return result;
1326 } 1337 }
1327 }; 1338 };
1328 1339
1329 }); // goog.scope 1340 }); // goog.scope
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698