| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 * @param {!AutomationNode} node | 216 * @param {!AutomationNode} node |
| 217 * @return {boolean} | 217 * @return {boolean} |
| 218 */ | 218 */ |
| 219 AutomationPredicate.object = function(node) { | 219 AutomationPredicate.object = function(node) { |
| 220 // Editable nodes are within a text-like field and don't make sense when | 220 // Editable nodes are within a text-like field and don't make sense when |
| 221 // performing object navigation. Users should use line, word, or character | 221 // performing object navigation. Users should use line, word, or character |
| 222 // navigation. Only navigate to the top level node. | 222 // navigation. Only navigate to the top level node. |
| 223 if (node.parent && node.parent.state.editable) | 223 if (node.parent && node.parent.state.editable) |
| 224 return false; | 224 return false; |
| 225 | 225 |
| 226 // Descend into large nodes. |
| 227 if (node.name && node.name.length > constants.OBJECT_MAX_CHARCOUNT) |
| 228 return false; |
| 229 |
| 226 return node.state.focusable || | 230 return node.state.focusable || |
| 227 (AutomationPredicate.leafOrStaticText(node) && | 231 (AutomationPredicate.leafOrStaticText(node) && |
| 228 (/\S+/.test(node.name) || | 232 (/\S+/.test(node.name) || |
| 229 (node.role != Role.lineBreak && | 233 (node.role != Role.lineBreak && |
| 230 node.role != Role.staticText && | 234 node.role != Role.staticText && |
| 231 node.role != Role.inlineTextBox))); | 235 node.role != Role.inlineTextBox))); |
| 232 }; | 236 }; |
| 233 | 237 |
| 234 /** | 238 /** |
| 235 * Matches against nodes visited during group navigation. An object as | 239 * Matches against nodes visited during group navigation. An object as |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 * @param {number} level 1-6 | 470 * @param {number} level 1-6 |
| 467 * @return {AutomationPredicate.Unary} | 471 * @return {AutomationPredicate.Unary} |
| 468 */ | 472 */ |
| 469 AutomationPredicate.makeHeadingPredicate = function(level) { | 473 AutomationPredicate.makeHeadingPredicate = function(level) { |
| 470 return function(node) { | 474 return function(node) { |
| 471 return node.role == Role.heading && node.hierarchicalLevel == level; | 475 return node.role == Role.heading && node.hierarchicalLevel == level; |
| 472 }; | 476 }; |
| 473 }; | 477 }; |
| 474 | 478 |
| 475 }); // goog.scope | 479 }); // goog.scope |
| OLD | NEW |