Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js

Issue 2557713003: Don't consider large static text nodes as objects (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 return node.state.focusable || 226 return node.state.focusable ||
227 (AutomationPredicate.leafOrStaticText(node) && 227 (AutomationPredicate.leafOrStaticText(node) &&
228 (!node.name || node.name.length < constants.MAX_CHARCOUNT) &&
228 (/\S+/.test(node.name) || 229 (/\S+/.test(node.name) ||
229 (node.role != Role.lineBreak && 230 (node.role != Role.lineBreak &&
230 node.role != Role.staticText && 231 node.role != Role.staticText &&
231 node.role != Role.inlineTextBox))); 232 node.role != Role.inlineTextBox)));
232 }; 233 };
233 234
234 /** 235 /**
235 * Matches against nodes visited during group navigation. An object as 236 * Matches against nodes visited during group navigation. An object as
236 * @param {!AutomationNode} node 237 * @param {!AutomationNode} node
237 * @return {boolean} 238 * @return {boolean}
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 * @param {number} level 1-6 467 * @param {number} level 1-6
467 * @return {AutomationPredicate.Unary} 468 * @return {AutomationPredicate.Unary}
468 */ 469 */
469 AutomationPredicate.makeHeadingPredicate = function(level) { 470 AutomationPredicate.makeHeadingPredicate = function(level) {
470 return function(node) { 471 return function(node) {
471 return node.role == Role.heading && node.hierarchicalLevel == level; 472 return node.role == Role.heading && node.hierarchicalLevel == level;
472 }; 473 };
473 }; 474 };
474 475
475 }); // goog.scope 476 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698