| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return fl.top != sl.top || | 193 return fl.top != sl.top || |
| 194 (fl.top + fl.height != sl.top + sl.height); | 194 (fl.top + fl.height != sl.top + sl.height); |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 /** | 197 /** |
| 198 * Matches against a node that should be visited but not considered a leaf. | 198 * Matches against a node that should be visited but not considered a leaf. |
| 199 * @param {!AutomationNode} node | 199 * @param {!AutomationNode} node |
| 200 * @return {boolean} | 200 * @return {boolean} |
| 201 */ | 201 */ |
| 202 AutomationPredicate.container = function(node) { | 202 AutomationPredicate.container = function(node) { |
| 203 if (node.role == RoleType.rootWebArea) |
| 204 return !node.parent || node.parent.root.role != RoleType.rootWebArea; |
| 205 |
| 203 return node.role == RoleType.toolbar || | 206 return node.role == RoleType.toolbar || |
| 204 node.role == RoleType.rootWebArea || | |
| 205 node.role == RoleType.window; | 207 node.role == RoleType.window; |
| 206 }; | 208 }; |
| 207 | 209 |
| 208 /** | 210 /** |
| 209 * Leaf nodes that should be ignored while traversing the automation tree. For | 211 * Leaf nodes that should be ignored while traversing the automation tree. For |
| 210 * example, apply this predicate when moving to the next element. | 212 * example, apply this predicate when moving to the next element. |
| 211 * @param {!AutomationNode} node | 213 * @param {!AutomationNode} node |
| 212 * @return {boolean} | 214 * @return {boolean} |
| 213 */ | 215 */ |
| 214 AutomationPredicate.shouldIgnoreLeaf = function(node) { | 216 AutomationPredicate.shouldIgnoreLeaf = function(node) { |
| 215 if (node.state.invisible || | 217 if (node.state.invisible || |
| 216 (node.location.height == 0 && node.location.width == 0)) | 218 (node.location.height == 0 && node.location.width == 0)) |
| 217 return true; | 219 return true; |
| 218 | 220 |
| 219 if (node.name || node.value) | 221 if (node.name || node.value) |
| 220 return false; | 222 return false; |
| 221 | 223 |
| 222 return AutomationPredicate.leaf(node) && | 224 return AutomationPredicate.leaf(node) && |
| 223 (node.role == RoleType.client || | 225 (node.role == RoleType.client || |
| 224 node.role == RoleType.div || | 226 node.role == RoleType.div || |
| 225 node.role == RoleType.group || | 227 node.role == RoleType.group || |
| 226 node.role == RoleType.image || | 228 node.role == RoleType.image || |
| 227 node.role == RoleType.staticText); | 229 node.role == RoleType.staticText); |
| 228 }; | 230 }; |
| 229 | 231 |
| 230 }); // goog.scope | 232 }); // goog.scope |
| OLD | NEW |