| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 /** | 296 /** |
| 297 * Matches against nodes that contain interesting nodes, but should never be | 297 * Matches against nodes that contain interesting nodes, but should never be |
| 298 * visited. | 298 * visited. |
| 299 * @param {!AutomationNode} node | 299 * @param {!AutomationNode} node |
| 300 * @return {boolean} | 300 * @return {boolean} |
| 301 */ | 301 */ |
| 302 AutomationPredicate.structuralContainer = AutomationPredicate.roles([ | 302 AutomationPredicate.structuralContainer = AutomationPredicate.roles([ |
| 303 Role.rootWebArea, | 303 Role.rootWebArea, |
| 304 Role.webView, |
| 304 Role.embeddedObject, | 305 Role.embeddedObject, |
| 305 Role.iframe, | 306 Role.iframe, |
| 306 Role.iframePresentational]); | 307 Role.iframePresentational]); |
| 307 | 308 |
| 308 /** | 309 /** |
| 309 * Returns whether the given node should not be crossed when performing | 310 * Returns whether the given node should not be crossed when performing |
| 310 * traversals up the ancestry chain. | 311 * traversals up the ancestry chain. |
| 311 * @param {AutomationNode} node | 312 * @param {AutomationNode} node |
| 312 * @return {boolean} | 313 * @return {boolean} |
| 313 */ | 314 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 338 return true; | 339 return true; |
| 339 | 340 |
| 340 // Ignore structural containres. | 341 // Ignore structural containres. |
| 341 if (AutomationPredicate.structuralContainer(node)) | 342 if (AutomationPredicate.structuralContainer(node)) |
| 342 return true; | 343 return true; |
| 343 | 344 |
| 344 // Ignore list markers since we already announce listitem role. | 345 // Ignore list markers since we already announce listitem role. |
| 345 if (node.role == Role.listMarker) | 346 if (node.role == Role.listMarker) |
| 346 return true; | 347 return true; |
| 347 | 348 |
| 348 // Don't ignore nodes with names. | 349 // Don't ignore nodes with names or name-like attribute. |
| 349 if (node.name || node.value || node.description) | 350 if (node.name || node.value || node.description || node.url) |
| 350 return false; | 351 return false; |
| 351 | 352 |
| 352 // Ignore some roles. | 353 // Ignore some roles. |
| 353 return AutomationPredicate.leaf(node) && | 354 return AutomationPredicate.leaf(node) && |
| 354 (AutomationPredicate.roles([Role.client, | 355 (AutomationPredicate.roles([Role.client, |
| 355 Role.column, | 356 Role.column, |
| 356 Role.div, | 357 Role.div, |
| 357 Role.group, | 358 Role.group, |
| 358 Role.image, | 359 Role.image, |
| 359 Role.staticText, | 360 Role.staticText, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 * @param {number} level 1-6 | 461 * @param {number} level 1-6 |
| 461 * @return {AutomationPredicate.Unary} | 462 * @return {AutomationPredicate.Unary} |
| 462 */ | 463 */ |
| 463 AutomationPredicate.makeHeadingPredicate = function(level) { | 464 AutomationPredicate.makeHeadingPredicate = function(level) { |
| 464 return function(node) { | 465 return function(node) { |
| 465 return node.role == Role.heading && node.hierarchicalLevel == level; | 466 return node.role == Role.heading && node.hierarchicalLevel == level; |
| 466 }; | 467 }; |
| 467 }; | 468 }; |
| 468 | 469 |
| 469 }); // goog.scope | 470 }); // goog.scope |
| OLD | NEW |