| 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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 if (node.name) | 1024 if (node.name) |
| 1025 this.append_(buff, node.name, options); | 1025 this.append_(buff, node.name, options); |
| 1026 else | 1026 else |
| 1027 this.format_(node, '$descendants', buff); | 1027 this.format_(node, '$descendants', buff); |
| 1028 } else if (token == 'description') { | 1028 } else if (token == 'description') { |
| 1029 if (node.name == node.description || node.value == node.description) | 1029 if (node.name == node.description || node.value == node.description) |
| 1030 return; | 1030 return; |
| 1031 options.annotation.push(token); | 1031 options.annotation.push(token); |
| 1032 this.append_(buff, node.description, options); | 1032 this.append_(buff, node.description, options); |
| 1033 } else if (token == 'indexInParent') { | 1033 } else if (token == 'indexInParent') { |
| 1034 options.annotation.push(token); | 1034 if (node.parent) { |
| 1035 this.append_(buff, String(node.indexInParent + 1)); | 1035 options.annotation.push(token); |
| 1036 var count = 0; |
| 1037 for (var i = 0, child; child = node.parent.children[i]; i++) { |
| 1038 if (node.role == child.role) |
| 1039 count++; |
| 1040 if (node === child) |
| 1041 break; |
| 1042 } |
| 1043 this.append_(buff, String(count)); |
| 1044 } |
| 1036 } else if (token == 'parentChildCount') { | 1045 } else if (token == 'parentChildCount') { |
| 1037 options.annotation.push(token); | 1046 if (node.parent) { |
| 1038 if (node.parent) | 1047 options.annotation.push(token); |
| 1039 this.append_(buff, String(node.parent.children.length)); | 1048 var count = node.parent.children.filter(function(child) { |
| 1049 return node.role == child.role; |
| 1050 }).length; |
| 1051 this.append_(buff, String(count)); |
| 1052 } |
| 1040 } else if (token == 'state') { | 1053 } else if (token == 'state') { |
| 1041 options.annotation.push(token); | 1054 options.annotation.push(token); |
| 1042 Object.getOwnPropertyNames(node.state).forEach(function(s) { | 1055 Object.getOwnPropertyNames(node.state).forEach(function(s) { |
| 1043 this.append_(buff, s, options); | 1056 this.append_(buff, s, options); |
| 1044 }.bind(this)); | 1057 }.bind(this)); |
| 1045 } else if (token == 'find') { | 1058 } else if (token == 'find') { |
| 1046 // Find takes two arguments: JSON query string and format string. | 1059 // Find takes two arguments: JSON query string and format string. |
| 1047 if (tree.firstChild) { | 1060 if (tree.firstChild) { |
| 1048 var jsonQuery = tree.firstChild.value; | 1061 var jsonQuery = tree.firstChild.value; |
| 1049 node = node.find( | 1062 node = node.find( |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 break; | 1622 break; |
| 1610 } | 1623 } |
| 1611 earconFinder = earconFinder.parent; | 1624 earconFinder = earconFinder.parent; |
| 1612 } | 1625 } |
| 1613 } | 1626 } |
| 1614 return null; | 1627 return null; |
| 1615 } | 1628 } |
| 1616 }; | 1629 }; |
| 1617 | 1630 |
| 1618 }); // goog.scope | 1631 }); // goog.scope |
| OLD | NEW |