| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * Class to move to the appropriate node in the accessibility tree. Stays in a | 6 * Class to move to the appropriate node in the accessibility tree. Stays in a |
| 7 * subtree determined by restrictions passed to it. | 7 * subtree determined by restrictions passed to it. |
| 8 * | 8 * |
| 9 * @constructor | 9 * @constructor |
| 10 * @param {!chrome.automation.AutomationNode} start | 10 * @param {!chrome.automation.AutomationNode} start |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (node === this.scope_) | 138 if (node === this.scope_) |
| 139 return undefined; | 139 return undefined; |
| 140 | 140 |
| 141 // Check for left-sibling. If a left-sibling exists, return its youngest | 141 // Check for left-sibling. If a left-sibling exists, return its youngest |
| 142 // descendant if it has one, or otherwise return the sibling. | 142 // descendant if it has one, or otherwise return the sibling. |
| 143 let sibling = node.previousSibling; | 143 let sibling = node.previousSibling; |
| 144 if (sibling) | 144 if (sibling) |
| 145 return this.getYoungestDescendant_(sibling) || sibling; | 145 return this.getYoungestDescendant_(sibling) || sibling; |
| 146 | 146 |
| 147 // No left-sibling. Return parent if it exists; otherwise return undefined. | 147 // No left-sibling. Return parent if it exists; otherwise return undefined. |
| 148 // return node.parent; | |
| 149 let parent = node.parent; | 148 let parent = node.parent; |
| 150 if (parent) | 149 if (parent) |
| 151 return parent; | 150 return parent; |
| 152 | 151 |
| 153 return undefined; | 152 return undefined; |
| 154 }, | 153 }, |
| 155 | 154 |
| 156 /** | 155 /** |
| 157 * Get the youngest descendant of |node|, if it has one, within the current | 156 * Get the youngest descendant of |node|, if it has one, within the current |
| 158 * scope. | 157 * scope. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 let parent = node.parent; | 243 let parent = node.parent; |
| 245 if (parent) { | 244 if (parent) { |
| 246 return parent; | 245 return parent; |
| 247 } else { | 246 } else { |
| 248 console.log('Node has no parent'); | 247 console.log('Node has no parent'); |
| 249 console.log('\n'); | 248 console.log('\n'); |
| 250 return null; | 249 return null; |
| 251 } | 250 } |
| 252 } | 251 } |
| 253 }; | 252 }; |
| OLD | NEW |