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

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

Issue 1948213002: Add a |skipInitialAncestry| option to tree walking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 utilities for the automation extension API. 6 * @fileoverview ChromeVox utilities for the automation extension API.
7 */ 7 */
8 8
9 goog.provide('AutomationUtil'); 9 goog.provide('AutomationUtil');
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 root: undefined, 96 root: undefined,
97 visit: undefined, 97 visit: undefined,
98 skipInitialSubtree: !AutomationPredicate.container(cur)}; 98 skipInitialSubtree: !AutomationPredicate.container(cur)};
99 restrictions.leaf = opt_restrictions.leaf || function(node) { 99 restrictions.leaf = opt_restrictions.leaf || function(node) {
100 // Treat nodes matched by |pred| as leaves except for containers. 100 // Treat nodes matched by |pred| as leaves except for containers.
101 return !AutomationPredicate.container(node) && pred(node); 101 return !AutomationPredicate.container(node) && pred(node);
102 }; 102 };
103 103
104 restrictions.root = opt_restrictions.root || AutomationUtil.isTraversalRoot; 104 restrictions.root = opt_restrictions.root || AutomationUtil.isTraversalRoot;
105 restrictions.skipInitialSubtree = opt_restrictions.skipInitialSubtree; 105 restrictions.skipInitialSubtree = opt_restrictions.skipInitialSubtree;
106 restrictions.skipInitialAncestry = opt_restrictions.skipInitialAncestry;
106 107
107 restrictions.visit = function(node) { 108 restrictions.visit = function(node) {
108 if (pred(node) && !AutomationPredicate.shouldIgnoreLeaf(node)) 109 if (pred(node) && !AutomationPredicate.shouldIgnoreLeaf(node))
109 return true; 110 return true;
110 if (AutomationPredicate.container(node)) 111 if (AutomationPredicate.container(node))
111 return true; 112 return true;
112 }; 113 };
113 114
114 var walker = new AutomationTreeWalker(cur, dir, restrictions); 115 var walker = new AutomationTreeWalker(cur, dir, restrictions);
115 return walker.next().node; 116 return walker.next().node;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 * @return {boolean} 276 * @return {boolean}
276 */ 277 */
277 AutomationUtil.isDescendantOf = function(node, ancestor) { 278 AutomationUtil.isDescendantOf = function(node, ancestor) {
278 var testNode = node; 279 var testNode = node;
279 while (testNode && testNode !== ancestor) 280 while (testNode && testNode !== ancestor)
280 testNode = testNode.parent; 281 testNode = testNode.parent;
281 return testNode === ancestor; 282 return testNode === ancestor;
282 }; 283 };
283 284
284 }); // goog.scope 285 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698