| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 /** | 161 /** |
| 162 * Non-inline textbox nodes which have an equivalent in the DOM. | 162 * Non-inline textbox nodes which have an equivalent in the DOM. |
| 163 * @param {!AutomationNode} node | 163 * @param {!AutomationNode} node |
| 164 * @return {boolean} | 164 * @return {boolean} |
| 165 */ | 165 */ |
| 166 AutomationPredicate.leafDomNode = function(node) { | 166 AutomationPredicate.leafDomNode = function(node) { |
| 167 return AutomationPredicate.leaf(node) || | 167 return AutomationPredicate.leaf(node) || |
| 168 node.role == RoleType.staticText; | 168 node.role == RoleType.staticText; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 |
| 172 /** |
| 173 * Matches nodes that are containers that should be ignored during |
| 174 * element navigation. |
| 175 * @param {!AutomationNode} node |
| 176 * @return {boolean} |
| 177 */ |
| 178 AutomationPredicate.ignoredContainer = function(node) { |
| 179 return (node.role == RoleType.rootWebArea || |
| 180 node.role == RoleType.embeddedObject || |
| 181 node.role == RoleType.iframe || |
| 182 node.role == RoleType.iframePresentational || |
| 183 node.role == RoleType.embeddedObject); |
| 184 }; |
| 185 |
| 171 /** | 186 /** |
| 172 * Matches against nodes visited during element navigation. An element as | 187 * Matches against nodes visited during element navigation. An element as |
| 173 * defined below, are all nodes that are focusable or static text. When used in | 188 * defined below, are all nodes that are focusable or static text. When used in |
| 174 * tree walking, it should visit all nodes that tab traversal would as well as | 189 * tree walking, it should visit all nodes that tab traversal would as well as |
| 175 * non-focusable static text. | 190 * non-focusable static text. |
| 176 * @param {!AutomationNode} node | 191 * @param {!AutomationNode} node |
| 177 * @return {boolean} | 192 * @return {boolean} |
| 178 */ | 193 */ |
| 179 AutomationPredicate.element = function(node) { | 194 AutomationPredicate.element = function(node) { |
| 180 return (node.state .focusable && node.role != RoleType.rootWebArea) || | 195 if (AutomationPredicate.ignoredContainer(node)) |
| 196 return false; |
| 197 |
| 198 return node.state.focusable || |
| 181 (AutomationPredicate.leafDomNode(node) && | 199 (AutomationPredicate.leafDomNode(node) && |
| 182 (/\S+/.test(node.name) || | 200 (/\S+/.test(node.name) || |
| 183 (node.role != RoleType.lineBreak && | 201 (node.role != RoleType.lineBreak && |
| 184 node.role != RoleType.staticText && | 202 node.role != RoleType.staticText && |
| 185 node.role != RoleType.inlineTextBox))); | 203 node.role != RoleType.inlineTextBox))); |
| 186 }; | 204 }; |
| 187 | 205 |
| 188 /** | 206 /** |
| 189 * @param {!AutomationNode} first | 207 * @param {!AutomationNode} first |
| 190 * @param {!AutomationNode} second | 208 * @param {!AutomationNode} second |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 246 |
| 229 return AutomationPredicate.leaf(node) && | 247 return AutomationPredicate.leaf(node) && |
| 230 (node.role == RoleType.client || | 248 (node.role == RoleType.client || |
| 231 node.role == RoleType.div || | 249 node.role == RoleType.div || |
| 232 node.role == RoleType.group || | 250 node.role == RoleType.group || |
| 233 node.role == RoleType.image || | 251 node.role == RoleType.image || |
| 234 node.role == RoleType.staticText); | 252 node.role == RoleType.staticText); |
| 235 }; | 253 }; |
| 236 | 254 |
| 237 }); // goog.scope | 255 }); // goog.scope |
| OLD | NEW |