| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * Class containing predicates for the chrome automation API. Each predicate | 6 * Class containing predicates for the chrome automation API. Each predicate |
| 7 * can be run on one or more AutomationNodes and returns a boolean value. | 7 * can be run on one or more AutomationNodes and returns a boolean value. |
| 8 * | 8 * |
| 9 * @constructor | 9 * @constructor |
| 10 */ | 10 */ |
| 11 function AutomationPredicate() {}; | 11 function AutomationPredicate() {} |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Returns true if |node| is a subtreeLeaf, meaning that |node| is either | 14 * Returns true if |node| is a subtreeLeaf, meaning that |node| is either |
| 15 * interesting or a group (both defined below). | 15 * interesting or a group (both defined below). |
| 16 * | 16 * |
| 17 * @param {!chrome.automation.AutomationNode} node | 17 * @param {!chrome.automation.AutomationNode} node |
| 18 * @param {!chrome.automation.AutomationNode} scope | 18 * @param {!chrome.automation.AutomationNode} scope |
| 19 * @return {boolean} | 19 * @return {boolean} |
| 20 */ | 20 */ |
| 21 AutomationPredicate.isSubtreeLeaf = function(node, scope) { | 21 AutomationPredicate.isSubtreeLeaf = function(node, scope) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Work around for browser tabs | 116 // Work around for browser tabs |
| 117 if (role === chrome.automation.RoleType.TAB | 117 if (role === chrome.automation.RoleType.TAB |
| 118 && parent.role === chrome.automation.RoleType.TAB_LIST | 118 && parent.role === chrome.automation.RoleType.TAB_LIST |
| 119 && root.role === chrome.automation.RoleType.DESKTOP) | 119 && root.role === chrome.automation.RoleType.DESKTOP) |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // The general rule that applies to everything. | 123 // The general rule that applies to everything. |
| 124 return state[chrome.automation.StateType.FOCUSABLE] === true; | 124 return state[chrome.automation.StateType.FOCUSABLE] === true; |
| 125 } | 125 } |
| OLD | NEW |