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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return true; | 269 return true; |
270 case RoleType.toolbar: | 270 case RoleType.toolbar: |
271 return node.root.role == RoleType.desktop; | 271 return node.root.role == RoleType.desktop; |
272 case RoleType.rootWebArea: | 272 case RoleType.rootWebArea: |
273 return !!(node.parent && node.parent.root.role == RoleType.desktop); | 273 return !!(node.parent && node.parent.root.role == RoleType.desktop); |
274 default: | 274 default: |
275 return false; | 275 return false; |
276 } | 276 } |
277 }; | 277 }; |
278 | 278 |
| 279 /** |
| 280 * Determines whether the two given nodes come from the same webpage. |
| 281 * @param {AutomationNode} a |
| 282 * @param {AutomationNode} b |
| 283 * @return {boolean} |
| 284 */ |
| 285 AutomationUtil.isInSameWebpage = function(a, b) { |
| 286 if (!a || !b) |
| 287 return false; |
| 288 |
| 289 a = a.root; |
| 290 while (a && a.parent && AutomationUtil.isInSameTree(a.parent, a)) |
| 291 a = a.parent.root; |
| 292 |
| 293 b = b.root; |
| 294 while (b && b.parent && AutomationUtil.isInSameTree(b.parent, b)) |
| 295 b = b.parent.root; |
| 296 |
| 297 return a == b; |
| 298 }; |
| 299 |
279 }); // goog.scope | 300 }); // goog.scope |
OLD | NEW |