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

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

Issue 2263513004: Add support for rich output inside of content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@editable_nav
Patch Set: Test fixes. Created 4 years, 3 months 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 /** 187 /**
188 * Matches against nodes visited during object navigation. An object as 188 * Matches against nodes visited during object navigation. An object as
189 * defined below, are all nodes that are focusable or static text. When used in 189 * defined below, are all nodes that are focusable or static text. When used in
190 * tree walking, it should visit all nodes that tab traversal would as well as 190 * tree walking, it should visit all nodes that tab traversal would as well as
191 * non-focusable static text. 191 * non-focusable static text.
192 * @param {!AutomationNode} node 192 * @param {!AutomationNode} node
193 * @return {boolean} 193 * @return {boolean}
194 */ 194 */
195 AutomationPredicate.object = function(node) { 195 AutomationPredicate.object = function(node) {
196 // Editable nodes are within a text-like field and don't make sense when
197 // performing object navigation. Users should use line, word, or character
198 // navigation. Only navigate to the top level node.
199 if (node.parent && node.parent.state.editable)
200 return false;
201
202 return node.state.focusable || 196 return node.state.focusable ||
203 (AutomationPredicate.leafOrStaticText(node) && 197 (AutomationPredicate.leafOrStaticText(node) &&
204 (/\S+/.test(node.name) || 198 (/\S+/.test(node.name) ||
205 (node.role != RoleType.lineBreak && 199 (node.role != RoleType.lineBreak &&
206 node.role != RoleType.staticText && 200 node.role != RoleType.staticText &&
207 node.role != RoleType.inlineTextBox))); 201 node.role != RoleType.inlineTextBox)));
208 }; 202 };
209 203
210 /** 204 /**
211 * @param {!AutomationNode} first 205 * @param {!AutomationNode} first
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 * @param {number} level 1-6 403 * @param {number} level 1-6
410 * @return {AutomationPredicate.Unary} 404 * @return {AutomationPredicate.Unary}
411 */ 405 */
412 AutomationPredicate.makeHeadingPredicate = function(level) { 406 AutomationPredicate.makeHeadingPredicate = function(level) {
413 return function(node) { 407 return function(node) {
414 return node.role == RoleType.heading && node.hierarchicalLevel == level; 408 return node.role == RoleType.heading && node.hierarchicalLevel == level;
415 }; 409 };
416 }; 410 };
417 411
418 }); // goog.scope 412 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698