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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 alert: { | 162 alert: { |
163 speak: '!doNotInterrupt $role $descendants' | 163 speak: '!doNotInterrupt $role $descendants' |
164 }, | 164 }, |
165 checkBox: { | 165 checkBox: { |
166 speak: '$name $role $checked' | 166 speak: '$name $role $checked' |
167 }, | 167 }, |
168 dialog: { | 168 dialog: { |
169 enter: '$name $role' | 169 enter: '$name $role' |
170 }, | 170 }, |
171 heading: { | 171 heading: { |
172 enter: '@aria_role_heading', | 172 enter: '@tag_h+$hierarchicalLevel', |
173 speak: '@aria_role_heading $name=' | 173 speak: '@tag_h+$hierarchicalLevel $name=' |
174 }, | 174 }, |
175 inlineTextBox: { | 175 inlineTextBox: { |
176 speak: '$value=' | 176 speak: '$value=' |
177 }, | 177 }, |
178 link: { | 178 link: { |
179 enter: '$name $visited $role', | 179 enter: '$name $visited $role', |
180 stay: '$name= $visited $role', | 180 stay: '$name= $visited $role', |
181 speak: '$name= $visited $role' | 181 speak: '$name= $visited $role' |
182 }, | 182 }, |
183 list: { | 183 list: { |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 // Assumes there's existing output in our buffer. | 616 // Assumes there's existing output in our buffer. |
617 var lastBuff = buff[buff.length - 1]; | 617 var lastBuff = buff[buff.length - 1]; |
618 if (!lastBuff) | 618 if (!lastBuff) |
619 return; | 619 return; |
620 | 620 |
621 lastBuff.setSpan( | 621 lastBuff.setSpan( |
622 new Output.EarconAction(tree.firstChild.value), 0, 0); | 622 new Output.EarconAction(tree.firstChild.value), 0, 0); |
623 } | 623 } |
624 } | 624 } |
625 } else if (prefix == '@') { | 625 } else if (prefix == '@') { |
| 626 // Tokens can have substitutions. |
| 627 var pieces = token.split('+'); |
| 628 token = pieces.reduce(function(prev, cur) { |
| 629 var lookup = cur; |
| 630 if (cur[0] == '$') |
| 631 lookup = node.attributes[cur.slice(1)]; |
| 632 return prev + lookup; |
| 633 }.bind(this), ''); |
626 var msgId = token; | 634 var msgId = token; |
627 var msgArgs = []; | 635 var msgArgs = []; |
628 var curMsg = tree.firstChild; | 636 var curMsg = tree.firstChild; |
629 | 637 |
630 while (curMsg) { | 638 while (curMsg) { |
631 var arg = curMsg.value; | 639 var arg = curMsg.value; |
632 if (arg[0] != '$') { | 640 if (arg[0] != '$') { |
633 console.error('Unexpected value: ' + arg); | 641 console.error('Unexpected value: ' + arg); |
634 return; | 642 return; |
635 } | 643 } |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 } | 867 } |
860 | 868 |
861 if (currentNode != root) | 869 if (currentNode != root) |
862 throw 'Unbalanced parenthesis.'; | 870 throw 'Unbalanced parenthesis.'; |
863 | 871 |
864 return root; | 872 return root; |
865 } | 873 } |
866 }; | 874 }; |
867 | 875 |
868 }); // goog.scope | 876 }); // goog.scope |
OLD | NEW |