| 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 ChromeVox predicates for the automation extension API. | 6 * @fileoverview ChromeVox predicates for the automation extension API. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('AutomationPredicate'); | 9 goog.provide('AutomationPredicate'); |
| 10 goog.provide('AutomationPredicate.Binary'); | 10 goog.provide('AutomationPredicate.Binary'); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return function(node) { | 38 return function(node) { |
| 39 return node.role == role; | 39 return node.role == role; |
| 40 }; | 40 }; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 /** @type {AutomationPredicate.Unary} */ | 43 /** @type {AutomationPredicate.Unary} */ |
| 44 AutomationPredicate.checkBox = AutomationPredicate.withRole(RoleType.checkBox); | 44 AutomationPredicate.checkBox = AutomationPredicate.withRole(RoleType.checkBox); |
| 45 /** @type {AutomationPredicate.Unary} */ | 45 /** @type {AutomationPredicate.Unary} */ |
| 46 AutomationPredicate.comboBox = AutomationPredicate.withRole(RoleType.comboBox); | 46 AutomationPredicate.comboBox = AutomationPredicate.withRole(RoleType.comboBox); |
| 47 /** @type {AutomationPredicate.Unary} */ | 47 /** @type {AutomationPredicate.Unary} */ |
| 48 AutomationPredicate.editText = AutomationPredicate.withRole(RoleType.textField); | |
| 49 /** @type {AutomationPredicate.Unary} */ | |
| 50 AutomationPredicate.heading = AutomationPredicate.withRole(RoleType.heading); | 48 AutomationPredicate.heading = AutomationPredicate.withRole(RoleType.heading); |
| 51 /** @type {AutomationPredicate.Unary} */ | 49 /** @type {AutomationPredicate.Unary} */ |
| 52 AutomationPredicate.inlineTextBox = | 50 AutomationPredicate.inlineTextBox = |
| 53 AutomationPredicate.withRole(RoleType.inlineTextBox); | 51 AutomationPredicate.withRole(RoleType.inlineTextBox); |
| 54 /** @type {AutomationPredicate.Unary} */ | 52 /** @type {AutomationPredicate.Unary} */ |
| 55 AutomationPredicate.link = AutomationPredicate.withRole(RoleType.link); | 53 AutomationPredicate.link = AutomationPredicate.withRole(RoleType.link); |
| 56 /** @type {AutomationPredicate.Unary} */ | 54 /** @type {AutomationPredicate.Unary} */ |
| 57 AutomationPredicate.table = AutomationPredicate.withRole(RoleType.table); | 55 AutomationPredicate.table = AutomationPredicate.withRole(RoleType.table); |
| 58 | 56 |
| 59 /** | 57 /** |
| 60 * @param {!AutomationNode} node | 58 * @param {!AutomationNode} node |
| 61 * @return {boolean} | 59 * @return {boolean} |
| 62 */ | 60 */ |
| 63 AutomationPredicate.button = function(node) { | 61 AutomationPredicate.button = function(node) { |
| 64 return /button/i.test(node.role); | 62 return /button/i.test(node.role); |
| 65 }; | 63 }; |
| 66 | 64 |
| 65 |
| 66 /** |
| 67 * @param {!AutomationNode} node |
| 68 * @return {boolean} |
| 69 */ |
| 70 AutomationPredicate.editText = function(node) { |
| 71 return node.state.editable && |
| 72 node.parent && |
| 73 !node.parent.state.editable; |
| 74 }; |
| 75 |
| 67 /** | 76 /** |
| 68 * @param {!AutomationNode} node | 77 * @param {!AutomationNode} node |
| 69 * @return {boolean} | 78 * @return {boolean} |
| 70 */ | 79 */ |
| 71 AutomationPredicate.formField = function(node) { | 80 AutomationPredicate.formField = function(node) { |
| 72 switch (node.role) { | 81 switch (node.role) { |
| 73 case 'button': | 82 case 'button': |
| 74 case 'buttonDropDown': | 83 case 'buttonDropDown': |
| 75 case 'checkBox': | 84 case 'checkBox': |
| 76 case 'comboBox': | 85 case 'comboBox': |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 237 |
| 229 return AutomationPredicate.leaf(node) && | 238 return AutomationPredicate.leaf(node) && |
| 230 (node.role == RoleType.client || | 239 (node.role == RoleType.client || |
| 231 node.role == RoleType.div || | 240 node.role == RoleType.div || |
| 232 node.role == RoleType.group || | 241 node.role == RoleType.group || |
| 233 node.role == RoleType.image || | 242 node.role == RoleType.image || |
| 234 node.role == RoleType.staticText); | 243 node.role == RoleType.staticText); |
| 235 }; | 244 }; |
| 236 | 245 |
| 237 }); // goog.scope | 246 }); // goog.scope |
| OLD | NEW |