| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 * For example, $value $role $enabled | 34 * For example, $value $role $enabled |
| 35 * @ prefix: used to substitute a message. Note the ability to specify params to | 35 * @ prefix: used to substitute a message. Note the ability to specify params to |
| 36 * the message. For example, '@tag_html' '@selected_index($text_sel_start, | 36 * the message. For example, '@tag_html' '@selected_index($text_sel_start, |
| 37 * $text_sel_end'). | 37 * $text_sel_end'). |
| 38 * = suffix: used to specify substitution only if not previously appended. | 38 * = suffix: used to specify substitution only if not previously appended. |
| 39 * For example, $name= would insert the name attribute only if no name | 39 * For example, $name= would insert the name attribute only if no name |
| 40 * attribute had been inserted previously. | 40 * attribute had been inserted previously. |
| 41 * @param {!cursors.Range} range | 41 * @param {!cursors.Range} range |
| 42 * @param {cursors.Range} prevRange | 42 * @param {cursors.Range} prevRange |
| 43 * @param {chrome.automation.EventType|Output.EventType} type | 43 * @param {chrome.automation.EventType|Output.EventType} type |
| 44 * @param {{braille: (boolean|undefined), speech: (boolean|undefined)}=} |
| 45 * opt_options |
| 44 * @constructor | 46 * @constructor |
| 45 */ | 47 */ |
| 46 Output = function(range, prevRange, type) { | 48 Output = function(range, prevRange, type, opt_options) { |
| 49 opt_options = opt_options || {braille: true, speech: true}; |
| 47 // TODO(dtseng): Include braille specific rules. | 50 // TODO(dtseng): Include braille specific rules. |
| 48 /** @type {!cvox.Spannable} */ | 51 /** @type {!cvox.Spannable} */ |
| 49 this.buffer_ = new cvox.Spannable(); | 52 this.buffer_ = new cvox.Spannable(); |
| 50 /** @type {!cvox.Spannable} */ | 53 /** @type {!cvox.Spannable} */ |
| 51 this.brailleBuffer_ = new cvox.Spannable(); | 54 this.brailleBuffer_ = new cvox.Spannable(); |
| 52 /** @type {!Array.<Object>} */ | 55 /** @type {!Array.<Object>} */ |
| 53 this.locations_ = []; | 56 this.locations_ = []; |
| 54 | 57 |
| 55 /** | 58 /** |
| 56 * Current global options. | 59 * Current global options. |
| 57 * @type {{speech: boolean, braille: boolean, location: boolean}} | 60 * @type {{speech: boolean, braille: boolean, location: boolean}} |
| 58 */ | 61 */ |
| 59 this.formatOptions_ = {speech: true, braille: false, location: true}; | 62 this.formatOptions_ = {speech: true, braille: false, location: true}; |
| 60 | 63 |
| 61 this.render_(range, prevRange, type); | 64 this.render_(range, prevRange, type); |
| 62 this.handleSpeech(); | 65 if (opt_options.speech) |
| 63 this.handleBraille(); | 66 this.handleSpeech(); |
| 67 if (opt_options.braille) |
| 68 this.handleBraille(); |
| 64 this.handleDisplay(); | 69 this.handleDisplay(); |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 /** | 72 /** |
| 68 * Delimiter to use between output values. | 73 * Delimiter to use between output values. |
| 69 * @type {string} | 74 * @type {string} |
| 70 */ | 75 */ |
| 71 Output.SPACE = ' '; | 76 Output.SPACE = ' '; |
| 72 | 77 |
| 73 /** | 78 /** |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 566 } |
| 562 | 567 |
| 563 if (currentNode != root) | 568 if (currentNode != root) |
| 564 throw 'Unbalanced parenthesis.'; | 569 throw 'Unbalanced parenthesis.'; |
| 565 | 570 |
| 566 return root; | 571 return root; |
| 567 } | 572 } |
| 568 }; | 573 }; |
| 569 | 574 |
| 570 }); // goog.scope | 575 }); // goog.scope |
| OLD | NEW |