| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 AutomationPredicate.match = function(params) { | 50 AutomationPredicate.match = function(params) { |
| 51 var anyRole = params.anyRole || []; | 51 var anyRole = params.anyRole || []; |
| 52 var anyPredicate = params.anyPredicate || []; | 52 var anyPredicate = params.anyPredicate || []; |
| 53 return function(node) { | 53 return function(node) { |
| 54 return anyRole.some(function(role) { return role == node.role; }) || | 54 return anyRole.some(function(role) { return role == node.role; }) || |
| 55 anyPredicate.some(function(p) { return p(node); }); | 55 anyPredicate.some(function(p) { return p(node); }); |
| 56 }; | 56 }; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 /** @type {AutomationPredicate.Unary} */ | 59 /** @type {AutomationPredicate.Unary} */ |
| 60 AutomationPredicate.checkBox = AutomationPredicate.roles([Role.checkBox]); | 60 AutomationPredicate.checkBox = |
| 61 AutomationPredicate.roles([Role.checkBox, Role.switch]); |
| 61 /** @type {AutomationPredicate.Unary} */ | 62 /** @type {AutomationPredicate.Unary} */ |
| 62 AutomationPredicate.comboBox = AutomationPredicate.roles( | 63 AutomationPredicate.comboBox = AutomationPredicate.roles( |
| 63 [Role.comboBox, Role.popUpButton, Role.menuListPopup]); | 64 [Role.comboBox, Role.popUpButton, Role.menuListPopup]); |
| 64 /** @type {AutomationPredicate.Unary} */ | 65 /** @type {AutomationPredicate.Unary} */ |
| 65 AutomationPredicate.heading = AutomationPredicate.roles([Role.heading]); | 66 AutomationPredicate.heading = AutomationPredicate.roles([Role.heading]); |
| 66 /** @type {AutomationPredicate.Unary} */ | 67 /** @type {AutomationPredicate.Unary} */ |
| 67 AutomationPredicate.inlineTextBox = | 68 AutomationPredicate.inlineTextBox = |
| 68 AutomationPredicate.roles([Role.inlineTextBox]); | 69 AutomationPredicate.roles([Role.inlineTextBox]); |
| 69 /** @type {AutomationPredicate.Unary} */ | 70 /** @type {AutomationPredicate.Unary} */ |
| 70 AutomationPredicate.link = AutomationPredicate.roles([Role.link]); | 71 AutomationPredicate.link = AutomationPredicate.roles([Role.link]); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 * @param {number} level 1-6 | 471 * @param {number} level 1-6 |
| 471 * @return {AutomationPredicate.Unary} | 472 * @return {AutomationPredicate.Unary} |
| 472 */ | 473 */ |
| 473 AutomationPredicate.makeHeadingPredicate = function(level) { | 474 AutomationPredicate.makeHeadingPredicate = function(level) { |
| 474 return function(node) { | 475 return function(node) { |
| 475 return node.role == Role.heading && node.hierarchicalLevel == level; | 476 return node.role == Role.heading && node.hierarchicalLevel == level; |
| 476 }; | 477 }; |
| 477 }; | 478 }; |
| 478 | 479 |
| 479 }); // goog.scope | 480 }); // goog.scope |
| OLD | NEW |