| 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 | 10 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 return hit; | 284 return hit; |
| 285 child = child.nextSibling; | 285 child = child.nextSibling; |
| 286 } | 286 } |
| 287 | 287 |
| 288 if (point.x <= (loc.left + loc.width) && point.x >= loc.left && | 288 if (point.x <= (loc.left + loc.width) && point.x >= loc.left && |
| 289 point.y <= (loc.top + loc.height) && point.y >= loc.top) | 289 point.y <= (loc.top + loc.height) && point.y >= loc.top) |
| 290 return node; | 290 return node; |
| 291 return null; | 291 return null; |
| 292 }; | 292 }; |
| 293 | 293 |
| 294 /** | |
| 295 * Gets a top level root. | |
| 296 * @param {!AutomationNode} node | |
| 297 * @return {AutomationNode} | |
| 298 */ | |
| 299 AutomationUtil.getTopLevelRoot = function(node) { | |
| 300 var root = node.root; | |
| 301 if (!root || root.role == RoleType.desktop) | |
| 302 return null; | |
| 303 | |
| 304 while (root && | |
| 305 root.parent && | |
| 306 root.parent.root && | |
| 307 root.parent.root.role != RoleType.desktop) { | |
| 308 root = root.parent.root; | |
| 309 } | |
| 310 return root; | |
| 311 }; | |
| 312 | |
| 313 }); // goog.scope | 294 }); // goog.scope |
| OLD | NEW |