| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js
|
| index bb028e04d715eff8dfdb175bb2e9257de75eb76c..04f3bd5a80087cfb5f6bb110f4dd3ea3aeda0f47 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js
|
| @@ -16,6 +16,7 @@ goog.scope(function() {
|
| var AutomationNode = chrome.automation.AutomationNode;
|
| var Dir = constants.Dir;
|
| var Role = chrome.automation.RoleType;
|
| +var State = chrome.automation.StateType;
|
|
|
| /**
|
| * @constructor
|
| @@ -58,21 +59,21 @@ AutomationPredicate.match = function(params) {
|
|
|
| /** @type {AutomationPredicate.Unary} */
|
| AutomationPredicate.checkBox =
|
| - AutomationPredicate.roles([Role.checkBox, Role.switch]);
|
| + AutomationPredicate.roles([Role.CHECK_BOX, Role.SWITCH]);
|
| /** @type {AutomationPredicate.Unary} */
|
| AutomationPredicate.comboBox = AutomationPredicate.roles(
|
| - [Role.comboBox, Role.popUpButton, Role.menuListPopup]);
|
| + [Role.COMBO_BOX, Role.POP_UP_BUTTON, Role.MENU_LIST_POPUP]);
|
| /** @type {AutomationPredicate.Unary} */
|
| -AutomationPredicate.heading = AutomationPredicate.roles([Role.heading]);
|
| +AutomationPredicate.heading = AutomationPredicate.roles([Role.HEADING]);
|
| /** @type {AutomationPredicate.Unary} */
|
| AutomationPredicate.inlineTextBox =
|
| - AutomationPredicate.roles([Role.inlineTextBox]);
|
| + AutomationPredicate.roles([Role.INLINE_TEXT_BOX]);
|
| /** @type {AutomationPredicate.Unary} */
|
| -AutomationPredicate.link = AutomationPredicate.roles([Role.link]);
|
| +AutomationPredicate.link = AutomationPredicate.roles([Role.LINK]);
|
| /** @type {AutomationPredicate.Unary} */
|
| -AutomationPredicate.row = AutomationPredicate.roles([Role.row]);
|
| +AutomationPredicate.row = AutomationPredicate.roles([Role.ROW]);
|
| /** @type {AutomationPredicate.Unary} */
|
| -AutomationPredicate.table = AutomationPredicate.roles([Role.grid, Role.table]);
|
| +AutomationPredicate.table = AutomationPredicate.roles([Role.GRID, Role.TABLE]);
|
|
|
| /**
|
| * @param {!AutomationNode} node
|
| @@ -100,13 +101,13 @@ AutomationPredicate.formField = AutomationPredicate.match({
|
| AutomationPredicate.editText
|
| ],
|
| anyRole: [
|
| - Role.checkBox,
|
| - Role.colorWell,
|
| - Role.listBox,
|
| - Role.slider,
|
| - Role.switch,
|
| - Role.tab,
|
| - Role.tree
|
| + Role.CHECK_BOX,
|
| + Role.COLOR_WELL,
|
| + Role.LIST_BOX,
|
| + Role.SLIDER,
|
| + Role.SWITCH,
|
| + Role.TAB,
|
| + Role.TREE
|
| ]
|
| });
|
|
|
| @@ -116,12 +117,12 @@ AutomationPredicate.control = AutomationPredicate.match({
|
| AutomationPredicate.formField,
|
| ],
|
| anyRole: [
|
| - Role.disclosureTriangle,
|
| - Role.menuItem,
|
| - Role.menuItemCheckBox,
|
| - Role.menuItemRadio,
|
| - Role.menuListOption,
|
| - Role.scrollBar
|
| + Role.DISCLOSURE_TRIANGLE,
|
| + Role.MENU_ITEM,
|
| + Role.MENU_ITEM_CHECK_BOX,
|
| + Role.MENU_ITEM_RADIO,
|
| + Role.MENU_LIST_OPTION,
|
| + Role.SCROLL_BAR
|
| ]
|
| });
|
|
|
| @@ -130,7 +131,7 @@ AutomationPredicate.control = AutomationPredicate.match({
|
| * @return {boolean}
|
| */
|
| AutomationPredicate.image = function(node) {
|
| - return node.role == Role.image && !!(node.name || node.url);
|
| + return node.role == Role.IMAGE && !!(node.name || node.url);
|
| };
|
|
|
| /** @type {AutomationPredicate.Unary} */
|
| @@ -139,21 +140,21 @@ AutomationPredicate.linkOrControl = AutomationPredicate.match({
|
| AutomationPredicate.control
|
| ],
|
| anyRole: [
|
| - Role.link
|
| + Role.LINK
|
| ]
|
| });
|
|
|
| /** @type {AutomationPredicate.Unary} */
|
| AutomationPredicate.landmark = AutomationPredicate.roles([
|
| - Role.application,
|
| - Role.banner,
|
| - Role.complementary,
|
| - Role.contentInfo,
|
| - Role.form,
|
| - Role.main,
|
| - Role.navigation,
|
| - Role.region,
|
| - Role.search]);
|
| + Role.APPLICATION,
|
| + Role.BANNER,
|
| + Role.COMPLEMENTARY,
|
| + Role.CONTENT_INFO,
|
| + Role.FORM,
|
| + Role.MAIN,
|
| + Role.NAVIGATION,
|
| + Role.REGION,
|
| + Role.SEARCH]);
|
|
|
| /**
|
| * @param {!AutomationNode} node
|
| @@ -177,14 +178,14 @@ AutomationPredicate.focused = function(node) {
|
| */
|
| AutomationPredicate.leaf = function(node) {
|
| return !node.firstChild ||
|
| - node.role == Role.button ||
|
| - node.role == Role.buttonDropDown ||
|
| - node.role == Role.popUpButton ||
|
| - node.role == Role.slider ||
|
| - node.role == Role.textField ||
|
| - node.state.invisible ||
|
| + node.role == Role.BUTTON ||
|
| + node.role == Role.BUTTON_DROP_DOWN ||
|
| + node.role == Role.POP_UP_BUTTON ||
|
| + node.role == Role.SLIDER ||
|
| + node.role == Role.TEXT_FIELD ||
|
| + node.state[State.INVISIBLE] ||
|
| node.children.every(function(n) {
|
| - return n.state.invisible;
|
| + return n.state[State.INVISIBLE];
|
| });
|
| };
|
|
|
| @@ -206,7 +207,7 @@ AutomationPredicate.leafWithText = function(node) {
|
| */
|
| AutomationPredicate.leafOrStaticText = function(node) {
|
| return AutomationPredicate.leaf(node) ||
|
| - node.role == Role.staticText;
|
| + node.role == Role.STATIC_TEXT;
|
| };
|
|
|
| /**
|
| @@ -231,9 +232,9 @@ AutomationPredicate.object = function(node) {
|
| return node.state.focusable ||
|
| (AutomationPredicate.leafOrStaticText(node) &&
|
| (/\S+/.test(node.name) ||
|
| - (node.role != Role.lineBreak &&
|
| - node.role != Role.staticText &&
|
| - node.role != Role.inlineTextBox)));
|
| + (node.role != Role.LINE_BREAK &&
|
| + node.role != Role.STATIC_TEXT &&
|
| + node.role != Role.INLINE_TEXT_BOX)));
|
| };
|
|
|
| /**
|
| @@ -243,9 +244,9 @@ AutomationPredicate.object = function(node) {
|
| */
|
| AutomationPredicate.group = AutomationPredicate.match({
|
| anyRole: [
|
| - Role.heading,
|
| - Role.list,
|
| - Role.paragraph
|
| + Role.HEADING,
|
| + Role.LIST,
|
| + Role.PARAGRAPH
|
| ],
|
| anyPredicate: [
|
| AutomationPredicate.editText,
|
| @@ -277,18 +278,18 @@ AutomationPredicate.linebreak = function(first, second) {
|
| AutomationPredicate.container = function(node) {
|
| return AutomationPredicate.match({
|
| anyRole: [
|
| - Role.div,
|
| - Role.document,
|
| - Role.group,
|
| - Role.listItem,
|
| - Role.toolbar,
|
| - Role.window],
|
| + Role.DIV,
|
| + Role.DOCUMENT,
|
| + Role.GROUP,
|
| + Role.LIST_ITEM,
|
| + Role.TOOLBAR,
|
| + Role.WINDOW],
|
| anyPredicate: [
|
| AutomationPredicate.landmark,
|
| AutomationPredicate.structuralContainer,
|
| function(node) {
|
| // For example, crosh.
|
| - return (node.role == Role.textField && node.state.readOnly);
|
| + return (node.role == Role.TEXT_FIELD && node.state.readOnly);
|
| },
|
| function(node) {
|
| return (node.state.editable &&
|
| @@ -305,14 +306,14 @@ AutomationPredicate.container = function(node) {
|
| * @return {boolean}
|
| */
|
| AutomationPredicate.structuralContainer = AutomationPredicate.roles([
|
| - Role.alertDialog,
|
| - Role.dialog,
|
| - Role.rootWebArea,
|
| - Role.webView,
|
| - Role.window,
|
| - Role.embeddedObject,
|
| - Role.iframe,
|
| - Role.iframePresentational]);
|
| + Role.ALERT_DIALOG,
|
| + Role.DIALOG,
|
| + Role.ROOT_WEB_AREA,
|
| + Role.WEB_VIEW,
|
| + Role.WINDOW,
|
| + Role.EMBEDDED_OBJECT,
|
| + Role.IFRAME,
|
| + Role.IFRAME_PRESENTATIONAL]);
|
|
|
| /**
|
| * Returns whether the given node should not be crossed when performing
|
| @@ -322,21 +323,21 @@ AutomationPredicate.structuralContainer = AutomationPredicate.roles([
|
| */
|
| AutomationPredicate.root = function(node) {
|
| switch (node.role) {
|
| - case Role.window:
|
| + case Role.WINDOW:
|
| return true;
|
| - case Role.dialog:
|
| + case Role.DIALOG:
|
| // The below logic handles nested dialogs properly in the desktop tree
|
| // like that found in a bubble view.
|
| - return node.root.role != Role.desktop ||
|
| + return node.root.role != Role.DESKTOP ||
|
| (!!node.parent &&
|
| - node.parent.role == Role.window &&
|
| + node.parent.role == Role.WINDOW &&
|
| node.parent.children.every(function(child) {
|
| - return node.role == Role.window || node.role == Role.dialog;
|
| + return node.role == Role.WINDOW || node.role == Role.DIALOG;
|
| }));
|
| - case Role.toolbar:
|
| - return node.root.role == Role.desktop;
|
| - case Role.rootWebArea:
|
| - return !node.parent || node.parent.root.role == Role.desktop;
|
| + case Role.TOOLBAR:
|
| + return node.root.role == Role.DESKTOP;
|
| + case Role.ROOT_WEB_AREA:
|
| + return !node.parent || node.parent.root.role == Role.DESKTOP;
|
| default:
|
| return false;
|
| }
|
| @@ -359,7 +360,7 @@ AutomationPredicate.shouldIgnoreNode = function(node) {
|
| return true;
|
|
|
| // Ignore list markers since we already announce listitem role.
|
| - if (node.role == Role.listMarker)
|
| + if (node.role == Role.LIST_MARKER)
|
| return true;
|
|
|
| // Don't ignore nodes with names or name-like attribute.
|
| @@ -368,15 +369,15 @@ AutomationPredicate.shouldIgnoreNode = function(node) {
|
|
|
| // Ignore some roles.
|
| return AutomationPredicate.leaf(node) &&
|
| - (AutomationPredicate.roles([Role.client,
|
| - Role.column,
|
| - Role.div,
|
| - Role.group,
|
| - Role.image,
|
| - Role.staticText,
|
| - Role.svgRoot,
|
| - Role.tableHeaderContainer,
|
| - Role.unknown
|
| + (AutomationPredicate.roles([Role.CLIENT,
|
| + Role.COLUMN,
|
| + Role.DIV,
|
| + Role.GROUP,
|
| + Role.IMAGE,
|
| + Role.STATIC_TEXT,
|
| + Role.SVG_ROOT,
|
| + Role.TABLE_HEADER_CONTAINER,
|
| + Role.UNKNOWN
|
| ])(node));
|
| };
|
|
|
| @@ -386,11 +387,11 @@ AutomationPredicate.shouldIgnoreNode = function(node) {
|
| * @return {boolean}
|
| */
|
| AutomationPredicate.checkable = AutomationPredicate.roles([
|
| - Role.checkBox,
|
| - Role.radioButton,
|
| - Role.menuItemCheckBox,
|
| - Role.menuItemRadio,
|
| - Role.treeItem]);
|
| + Role.CHECK_BOX,
|
| + Role.RADIO_BUTTON,
|
| + Role.MENU_ITEM_CHECK_BOX,
|
| + Role.MENU_ITEM_RADIO,
|
| + Role.TREE_ITEM]);
|
|
|
| // Table related predicates.
|
| /**
|
| @@ -399,9 +400,9 @@ AutomationPredicate.checkable = AutomationPredicate.roles([
|
| * @return {boolean}
|
| */
|
| AutomationPredicate.cellLike = AutomationPredicate.roles([
|
| - Role.cell,
|
| - Role.rowHeader,
|
| - Role.columnHeader]);
|
| + Role.CELL,
|
| + Role.ROW_HEADER,
|
| + Role.COLUMN_HEADER]);
|
|
|
| /**
|
| * Returns a predicate that will match against the directed next cell taking
|
| @@ -481,7 +482,7 @@ AutomationPredicate.makeTableCellPredicate = function(start, opts) {
|
| */
|
| AutomationPredicate.makeHeadingPredicate = function(level) {
|
| return function(node) {
|
| - return node.role == Role.heading && node.hierarchicalLevel == level;
|
| + return node.role == Role.HEADING && node.hierarchicalLevel == level;
|
| };
|
| };
|
|
|
|
|