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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 } else if (token == 'parentChildCount') { | 1148 } else if (token == 'parentChildCount') { |
1149 if (node.parent) { | 1149 if (node.parent) { |
1150 options.annotation.push(token); | 1150 options.annotation.push(token); |
1151 var count = node.parent.children.filter(function(child) { | 1151 var count = node.parent.children.filter(function(child) { |
1152 return node.role == child.role; | 1152 return node.role == child.role; |
1153 }).length; | 1153 }).length; |
1154 this.append_(buff, String(count)); | 1154 this.append_(buff, String(count)); |
1155 } | 1155 } |
1156 } else if (token == 'checked') { | 1156 } else if (token == 'checked') { |
1157 var msg; | 1157 var msg; |
1158 var ariaChecked = node.htmlAttributes['aria-checked']; | 1158 switch (node.checked) { |
1159 switch (ariaChecked) { | |
1160 case 'mixed': | 1159 case 'mixed': |
1161 msg = 'aria_checked_mixed'; | 1160 msg = 'aria_checked_mixed'; |
1162 break; | 1161 break; |
1163 case 'true': | 1162 case 'true': |
1164 msg = 'aria_checked_true'; | 1163 msg = 'aria_checked_true'; |
1165 break; | 1164 break; |
1166 case 'false': | 1165 default: |
1167 msg = 'aria_checked_false'; | 1166 msg = 'aria_checked_false'; |
1168 break; | 1167 break; |
1169 default: | |
1170 msg = node.state[StateType.CHECKED] ? | |
1171 'aria_checked_true' : 'aria_checked_false'; | |
1172 } | 1168 } |
1173 this.format_(node, '@' + msg, buff); | 1169 this.format_(node, '@' + msg, buff); |
1174 } else if (token == 'state') { | 1170 } else if (token == 'state') { |
1175 if (node.state) { | 1171 if (node.state) { |
1176 Object.getOwnPropertyNames(node.state).forEach(function(s) { | 1172 Object.getOwnPropertyNames(node.state).forEach(function(s) { |
1177 var stateInfo = Output.STATE_INFO_[s]; | 1173 var stateInfo = Output.STATE_INFO_[s]; |
1178 if (stateInfo && !stateInfo.isRoleSpecific && stateInfo.on) | 1174 if (stateInfo && !stateInfo.isRoleSpecific && stateInfo.on) |
1179 this.format_(node, '@' + stateInfo.on.msgId, buff); | 1175 this.format_(node, '@' + stateInfo.on.msgId, buff); |
1180 }.bind(this)); | 1176 }.bind(this)); |
1181 } | 1177 } |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 /** | 1872 /** |
1877 * Gets the output buffer for braille. | 1873 * Gets the output buffer for braille. |
1878 * @return {!Spannable} | 1874 * @return {!Spannable} |
1879 */ | 1875 */ |
1880 get brailleOutputForTest() { | 1876 get brailleOutputForTest() { |
1881 return this.mergeBraille_(this.brailleBuffer_); | 1877 return this.mergeBraille_(this.brailleBuffer_); |
1882 } | 1878 } |
1883 }; | 1879 }; |
1884 | 1880 |
1885 }); // goog.scope | 1881 }); // goog.scope |
OLD | NEW |