Chromium Code Reviews| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 519 }, | 519 }, |
| 520 region: { | 520 region: { |
| 521 speak: '$nameOrTextContent' | 521 speak: '$nameOrTextContent' |
| 522 }, | 522 }, |
| 523 row: { | 523 row: { |
| 524 enter: '$node(tableRowHeader)' | 524 enter: '$node(tableRowHeader)' |
| 525 }, | 525 }, |
| 526 rowHeader: { | 526 rowHeader: { |
| 527 speak: '$descendants $state' | 527 speak: '$descendants $state' |
| 528 }, | 528 }, |
| 529 slider: { | 529 slider: { |
|
dmazzoni
2016/11/17 23:07:41
You should expose range value attributes for these
David Tseng
2017/01/20 22:18:05
It would be, but it also prevents us from fine-tun
| |
| 530 speak: '$earcon(SLIDER) @describe_slider($value, $name) $description ' + | 530 speak: |
| 531 '$if($valueForRange, $valueForRange) ' + | |
|
dmazzoni
2016/11/17 23:07:41
I think $value is almost always better because it
David Tseng
2017/01/20 22:18:05
ok, done.
| |
| 532 '$if($minValueForRange, @aria_value_min($minValueForRange)) ' + | |
| 533 '$if($maxValueForRange, @aria_value_max($maxValueForRange)) ' + | |
| 534 '$earcon(SLIDER) @describe_slider($value, $name) $description ' + | |
| 531 '$state' | 535 '$state' |
| 532 }, | 536 }, |
| 533 staticText: { | 537 staticText: { |
| 534 speak: '$name=' | 538 speak: '$name=' |
| 535 }, | 539 }, |
| 536 switch: { | 540 switch: { |
| 537 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + | 541 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + |
| 538 '$if($checked, @describe_switch_on($name), ' + | 542 '$if($checked, @describe_switch_on($name), ' + |
| 539 '@describe_switch_off($name)) $description $state' | 543 '@describe_switch_off($name)) $description $state' |
| 540 }, | 544 }, |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1062 this.append_(buff, Msgs.getMsg('selected')); | 1066 this.append_(buff, Msgs.getMsg('selected')); |
| 1063 } else { | 1067 } else { |
| 1064 this.append_(buff, text, options); | 1068 this.append_(buff, text, options); |
| 1065 } | 1069 } |
| 1066 } else if (token == 'name') { | 1070 } else if (token == 'name') { |
| 1067 options.annotation.push(token); | 1071 options.annotation.push(token); |
| 1068 var earcon = node ? this.findEarcon_(node, opt_prevNode) : null; | 1072 var earcon = node ? this.findEarcon_(node, opt_prevNode) : null; |
| 1069 if (earcon) | 1073 if (earcon) |
| 1070 options.annotation.push(earcon); | 1074 options.annotation.push(earcon); |
| 1071 this.append_(buff, node.name, options); | 1075 this.append_(buff, node.name, options); |
| 1076 } else if (token == 'description') { | |
| 1077 if (node.name == node.description) | |
| 1078 return; | |
| 1079 | |
| 1080 options.annotation.push(token); | |
| 1081 this.append_(buff, node.description, options); | |
| 1072 } else if (token == 'urlFilename') { | 1082 } else if (token == 'urlFilename') { |
| 1073 options.annotation.push('name'); | 1083 options.annotation.push('name'); |
| 1074 var url = node.url; | 1084 var url = node.url; |
| 1075 var filename = ''; | 1085 var filename = ''; |
| 1076 if (url.substring(0, 4) != 'data') { | 1086 if (url.substring(0, 4) != 'data') { |
| 1077 filename = | 1087 filename = |
| 1078 url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.')); | 1088 url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.')); |
| 1079 | 1089 |
| 1080 // Hack to not speak the filename if it's ridiculously long. | 1090 // Hack to not speak the filename if it's ridiculously long. |
| 1081 if (filename.length >= 30) | 1091 if (filename.length >= 30) |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1253 var msgId = | 1263 var msgId = |
| 1254 this.formatOptions_.braille ? resolvedInfo.msgId + '_brl' : | 1264 this.formatOptions_.braille ? resolvedInfo.msgId + '_brl' : |
| 1255 resolvedInfo.msgId; | 1265 resolvedInfo.msgId; |
| 1256 var msg = Msgs.getMsg(msgId); | 1266 var msg = Msgs.getMsg(msgId); |
| 1257 this.append_(buff, msg, options); | 1267 this.append_(buff, msg, options); |
| 1258 } else if (tree.firstChild) { | 1268 } else if (tree.firstChild) { |
| 1259 // Custom functions. | 1269 // Custom functions. |
| 1260 if (token == 'if') { | 1270 if (token == 'if') { |
| 1261 var cond = tree.firstChild; | 1271 var cond = tree.firstChild; |
| 1262 var attrib = cond.value.slice(1); | 1272 var attrib = cond.value.slice(1); |
| 1263 if (node[attrib] || node.state[attrib]) | 1273 if (node[attrib] !== undefined || node.state[attrib]) |
| 1264 this.format_(node, cond.nextSibling, buff); | 1274 this.format_(node, cond.nextSibling, buff); |
| 1265 else | 1275 else |
| 1266 this.format_(node, cond.nextSibling.nextSibling, buff); | 1276 this.format_(node, cond.nextSibling.nextSibling, buff); |
| 1267 } else if (token == 'earcon') { | 1277 } else if (token == 'earcon') { |
| 1268 // Ignore unless we're generating speech output. | 1278 // Ignore unless we're generating speech output. |
| 1269 if (!this.formatOptions_.speech) | 1279 if (!this.formatOptions_.speech) |
| 1270 return; | 1280 return; |
| 1271 | 1281 |
| 1272 options.annotation.push( | 1282 options.annotation.push( |
| 1273 new Output.EarconAction(tree.firstChild.value)); | 1283 new Output.EarconAction(tree.firstChild.value)); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1829 /** | 1839 /** |
| 1830 * Gets the output buffer for braille. | 1840 * Gets the output buffer for braille. |
| 1831 * @return {!Spannable} | 1841 * @return {!Spannable} |
| 1832 */ | 1842 */ |
| 1833 get brailleOutputForTest() { | 1843 get brailleOutputForTest() { |
| 1834 return this.mergeBraille_(this.brailleBuffer_); | 1844 return this.mergeBraille_(this.brailleBuffer_); |
| 1835 } | 1845 } |
| 1836 }; | 1846 }; |
| 1837 | 1847 |
| 1838 }); // goog.scope | 1848 }); // goog.scope |
| OLD | NEW |