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 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 goog.provide('AutomationUtil.Dir'); | 10 goog.provide('AutomationUtil.Dir'); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 * to a candidate node. | 106 * to a candidate node. |
107 * @return {AutomationNode} | 107 * @return {AutomationNode} |
108 */ | 108 */ |
109 AutomationUtil.findNextNode = function(cur, dir, pred) { | 109 AutomationUtil.findNextNode = function(cur, dir, pred) { |
110 var next = cur; | 110 var next = cur; |
111 do { | 111 do { |
112 if (!(next = AutomationUtil.findNextSubtree(cur, dir))) | 112 if (!(next = AutomationUtil.findNextSubtree(cur, dir))) |
113 return null; | 113 return null; |
114 cur = next; | 114 cur = next; |
115 next = AutomationUtil.findNodePre(next, dir, pred); | 115 next = AutomationUtil.findNodePre(next, dir, pred); |
116 if (next && AutomationPredicate.shouldIgnoreLeaf(next)) | |
117 next = null; | |
118 } while (!next); | 116 } while (!next); |
119 return next; | 117 return next; |
120 }; | 118 }; |
121 | 119 |
122 /** | 120 /** |
123 * Given nodes a_1, ..., a_n starting at |cur| in pre order traversal, apply | 121 * Given nodes a_1, ..., a_n starting at |cur| in pre order traversal, apply |
124 * |pred| to a_i and a_(i - 1) until |pred| is satisfied. Returns a_(i - 1) or | 122 * |pred| to a_i and a_(i - 1) until |pred| is satisfied. Returns a_(i - 1) or |
125 * a_i (depending on opt_options.before) or null if no match was found. | 123 * a_i (depending on opt_options.before) or null if no match was found. |
126 * @param {AutomationNode} cur | 124 * @param {AutomationNode} cur |
127 * @param {Dir} dir | 125 * @param {Dir} dir |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 * @return {boolean} | 241 * @return {boolean} |
244 */ | 242 */ |
245 AutomationUtil.isInSameTree = function(a, b) { | 243 AutomationUtil.isInSameTree = function(a, b) { |
246 if (!a || !b) | 244 if (!a || !b) |
247 return true; | 245 return true; |
248 | 246 |
249 return a.root === b.root; | 247 return a.root === b.root; |
250 }; | 248 }; |
251 | 249 |
252 }); // goog.scope | 250 }); // goog.scope |
OLD | NEW |