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