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 30 matching lines...) Expand all Loading... |
41 * For example, $name= would insert the name attribute only if no name | 41 * For example, $name= would insert the name attribute only if no name |
42 * attribute had been inserted previously. | 42 * attribute had been inserted previously. |
43 * @constructor | 43 * @constructor |
44 */ | 44 */ |
45 Output = function() { | 45 Output = function() { |
46 // TODO(dtseng): Include braille specific rules. | 46 // TODO(dtseng): Include braille specific rules. |
47 /** @type {!cvox.Spannable} */ | 47 /** @type {!cvox.Spannable} */ |
48 this.buffer_ = new cvox.Spannable(); | 48 this.buffer_ = new cvox.Spannable(); |
49 /** @type {!cvox.Spannable} */ | 49 /** @type {!cvox.Spannable} */ |
50 this.brailleBuffer_ = new cvox.Spannable(); | 50 this.brailleBuffer_ = new cvox.Spannable(); |
51 /** @type {!Array.<Object>} */ | 51 /** @type {!Array<Object>} */ |
52 this.locations_ = []; | 52 this.locations_ = []; |
53 /** @type {function()} */ | 53 /** @type {function()} */ |
54 this.speechStartCallback_; | 54 this.speechStartCallback_; |
55 /** @type {function()} */ | 55 /** @type {function()} */ |
56 this.speechEndCallback_; | 56 this.speechEndCallback_; |
57 /** @type {function()} */ | 57 /** @type {function()} */ |
58 this.speechInterruptedCallback_; | 58 this.speechInterruptedCallback_; |
59 | 59 |
60 /** | 60 /** |
61 * Current global options. | 61 * Current global options. |
62 * @type {{speech: boolean, braille: boolean, location: boolean}} | 62 * @type {{speech: boolean, braille: boolean, location: boolean}} |
63 */ | 63 */ |
64 this.formatOptions_ = {speech: true, braille: false, location: true}; | 64 this.formatOptions_ = {speech: true, braille: false, location: true}; |
65 | 65 |
66 /** | 66 /** |
67 * Speech properties to apply to the entire output. | 67 * Speech properties to apply to the entire output. |
68 * @type {!Object.<string, *>} | 68 * @type {!Object<string, *>} |
69 */ | 69 */ |
70 this.speechProperties_ = {}; | 70 this.speechProperties_ = {}; |
71 }; | 71 }; |
72 | 72 |
73 /** | 73 /** |
74 * Delimiter to use between output values. | 74 * Delimiter to use between output values. |
75 * @type {string} | 75 * @type {string} |
76 */ | 76 */ |
77 Output.SPACE = ' '; | 77 Output.SPACE = ' '; |
78 | 78 |
79 /** | 79 /** |
80 * Rules specifying format of AutomationNodes for output. | 80 * Rules specifying format of AutomationNodes for output. |
81 * @type {!Object.<string, Object.<string, Object.<string, string>>>} | 81 * @type {!Object<string, Object<string, Object<string, string>>>} |
82 */ | 82 */ |
83 Output.RULES = { | 83 Output.RULES = { |
84 navigate: { | 84 navigate: { |
85 'default': { | 85 'default': { |
86 speak: '$name $role $value', | 86 speak: '$name $role $value', |
87 braille: '' | 87 braille: '' |
88 }, | 88 }, |
89 alert: { | 89 alert: { |
90 speak: '!doNotInterrupt ' + | 90 speak: '!doNotInterrupt ' + |
91 '@aria_role_alert $name $earcon(ALERT_NONMODAL) $descendants' | 91 '@aria_role_alert $name $earcon(ALERT_NONMODAL) $descendants' |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 alert: { | 187 alert: { |
188 default: { | 188 default: { |
189 speak: '!doNotInterrupt ' + | 189 speak: '!doNotInterrupt ' + |
190 '@aria_role_alert $name $earcon(ALERT_NONMODAL) $descendants' | 190 '@aria_role_alert $name $earcon(ALERT_NONMODAL) $descendants' |
191 } | 191 } |
192 } | 192 } |
193 }; | 193 }; |
194 | 194 |
195 /** | 195 /** |
196 * Alias equivalent attributes. | 196 * Alias equivalent attributes. |
197 * @type {!Object.<string, string>} | 197 * @type {!Object<string, string>} |
198 */ | 198 */ |
199 Output.ATTRIBUTE_ALIAS = { | 199 Output.ATTRIBUTE_ALIAS = { |
200 name: 'value', | 200 name: 'value', |
201 value: 'name' | 201 value: 'name' |
202 }; | 202 }; |
203 | 203 |
204 /** | 204 /** |
205 * Custom actions performed while rendering an output string. | 205 * Custom actions performed while rendering an output string. |
206 * @param {function()} action | 206 * @param {function()} action |
207 * @constructor | 207 * @constructor |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 } | 754 } |
755 | 755 |
756 if (currentNode != root) | 756 if (currentNode != root) |
757 throw 'Unbalanced parenthesis.'; | 757 throw 'Unbalanced parenthesis.'; |
758 | 758 |
759 return root; | 759 return root; |
760 } | 760 } |
761 }; | 761 }; |
762 | 762 |
763 }); // goog.scope | 763 }); // goog.scope |
OLD | NEW |