| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 'url': 'input_type_url', | 399 'url': 'input_type_url', |
| 400 }; | 400 }; |
| 401 | 401 |
| 402 /** | 402 /** |
| 403 * Rules specifying format of AutomationNodes for output. | 403 * Rules specifying format of AutomationNodes for output. |
| 404 * @type {!Object<Object<Object<string>>>} | 404 * @type {!Object<Object<Object<string>>>} |
| 405 */ | 405 */ |
| 406 Output.RULES = { | 406 Output.RULES = { |
| 407 navigate: { | 407 navigate: { |
| 408 'default': { | 408 'default': { |
| 409 speak: '$name $value $state $role $description', | 409 speak: '$name $value $role $description', |
| 410 braille: '' | 410 braille: '' |
| 411 }, | 411 }, |
| 412 abstractContainer: { | 412 abstractContainer: { |
| 413 enter: '$nameFromNode $role $description', | 413 enter: '$nameFromNode $role $description', |
| 414 leave: '@exited_container($role)' | 414 leave: '@exited_container($role)' |
| 415 }, | 415 }, |
| 416 alert: { | 416 alert: { |
| 417 speak: '!doNotInterrupt $role $descendants' | 417 speak: '!doNotInterrupt $role $descendants' |
| 418 }, | 418 }, |
| 419 alertDialog: { | 419 alertDialog: { |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 if (node.parent) { | 1061 if (node.parent) { |
| 1062 options.annotation.push(token); | 1062 options.annotation.push(token); |
| 1063 var count = node.parent.children.filter(function(child) { | 1063 var count = node.parent.children.filter(function(child) { |
| 1064 return node.role == child.role; | 1064 return node.role == child.role; |
| 1065 }).length; | 1065 }).length; |
| 1066 this.append_(buff, String(count)); | 1066 this.append_(buff, String(count)); |
| 1067 } | 1067 } |
| 1068 } else if (token == 'state') { | 1068 } else if (token == 'state') { |
| 1069 options.annotation.push(token); | 1069 options.annotation.push(token); |
| 1070 Object.getOwnPropertyNames(node.state).forEach(function(s) { | 1070 Object.getOwnPropertyNames(node.state).forEach(function(s) { |
| 1071 var stateInfo = Output.STATE_INFO_[s]; | 1071 this.append_(buff, s, options); |
| 1072 if (stateInfo && stateInfo.on) | |
| 1073 this.append_(buff, Msgs.getMsg(stateInfo.on.msgId), options); | |
| 1074 }.bind(this)); | 1072 }.bind(this)); |
| 1075 } else if (token == 'find') { | 1073 } else if (token == 'find') { |
| 1076 // Find takes two arguments: JSON query string and format string. | 1074 // Find takes two arguments: JSON query string and format string. |
| 1077 if (tree.firstChild) { | 1075 if (tree.firstChild) { |
| 1078 var jsonQuery = tree.firstChild.value; | 1076 var jsonQuery = tree.firstChild.value; |
| 1079 node = node.find( | 1077 node = node.find( |
| 1080 /** @type {Object}*/(JSON.parse(jsonQuery))); | 1078 /** @type {Object}*/(JSON.parse(jsonQuery))); |
| 1081 var formatString = tree.firstChild.nextSibling; | 1079 var formatString = tree.firstChild.nextSibling; |
| 1082 if (node) | 1080 if (node) |
| 1083 this.format_(node, formatString, buff); | 1081 this.format_(node, formatString, buff); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 * @param {!cursors.Range} range | 1285 * @param {!cursors.Range} range |
| 1288 * @param {cursors.Range} prevRange | 1286 * @param {cursors.Range} prevRange |
| 1289 * @param {EventType|Output.EventType} type | 1287 * @param {EventType|Output.EventType} type |
| 1290 * @param {!Array<Spannable>} rangeBuff | 1288 * @param {!Array<Spannable>} rangeBuff |
| 1291 * @private | 1289 * @private |
| 1292 */ | 1290 */ |
| 1293 range_: function(range, prevRange, type, rangeBuff) { | 1291 range_: function(range, prevRange, type, rangeBuff) { |
| 1294 if (!range.start.node || !range.end.node) | 1292 if (!range.start.node || !range.end.node) |
| 1295 return; | 1293 return; |
| 1296 | 1294 |
| 1297 if (!prevRange && range.start.node.root) | 1295 if (!prevRange) |
| 1298 prevRange = cursors.Range.fromNode(range.start.node.root); | 1296 prevRange = cursors.Range.fromNode(range.start.node.root); |
| 1299 var cursor = cursors.Cursor.fromNode(range.start.node); | 1297 var cursor = cursors.Cursor.fromNode(range.start.node); |
| 1300 var prevNode = prevRange.start.node; | 1298 var prevNode = prevRange.start.node; |
| 1301 | 1299 |
| 1302 var formatNodeAndAncestors = function(node, prevNode) { | 1300 var formatNodeAndAncestors = function(node, prevNode) { |
| 1303 var buff = []; | 1301 var buff = []; |
| 1304 var outputContextFirst = localStorage['outputContextFirst'] == 'true'; | 1302 var outputContextFirst = localStorage['outputContextFirst'] == 'true'; |
| 1305 if (outputContextFirst) | 1303 if (outputContextFirst) |
| 1306 this.ancestry_(node, prevNode, type, buff); | 1304 this.ancestry_(node, prevNode, type, buff); |
| 1307 this.node_(node, prevNode, type, buff); | 1305 this.node_(node, prevNode, type, buff); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 break; | 1642 break; |
| 1645 } | 1643 } |
| 1646 earconFinder = earconFinder.parent; | 1644 earconFinder = earconFinder.parent; |
| 1647 } | 1645 } |
| 1648 } | 1646 } |
| 1649 return null; | 1647 return null; |
| 1650 } | 1648 } |
| 1651 }; | 1649 }; |
| 1652 | 1650 |
| 1653 }); // goog.scope | 1651 }); // goog.scope |
| OLD | NEW |