| 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 Classes related to cursors that point to and select parts of | 6 * @fileoverview Classes related to cursors that point to and select parts of |
| 7 * the automation tree. | 7 * the automation tree. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 goog.provide('cursors.Cursor'); | 10 goog.provide('cursors.Cursor'); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 newNode = newNode || this.node_; | 284 newNode = newNode || this.node_; |
| 285 newIndex = goog.isDef(newIndex) ? newIndex : this.index_; | 285 newIndex = goog.isDef(newIndex) ? newIndex : this.index_; |
| 286 return new cursors.Cursor(newNode, newIndex); | 286 return new cursors.Cursor(newNode, newIndex); |
| 287 }, | 287 }, |
| 288 | 288 |
| 289 /** | 289 /** |
| 290 * Returns whether this cursor points to a valid position. | 290 * Returns whether this cursor points to a valid position. |
| 291 * @return {boolean} | 291 * @return {boolean} |
| 292 */ | 292 */ |
| 293 isValid: function() { | 293 isValid: function() { |
| 294 return this.node.role !== undefined; | 294 return !!this.node.root; |
| 295 } | 295 } |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 /** | 298 /** |
| 299 * A cursors.Cursor that wraps from beginning to end and vice versa when moved. | 299 * A cursors.Cursor that wraps from beginning to end and vice versa when moved. |
| 300 * @constructor | 300 * @constructor |
| 301 * @param {!AutomationNode} node | 301 * @param {!AutomationNode} node |
| 302 * @param {number} index A 0-based index into this cursor node's primary | 302 * @param {number} index A 0-based index into this cursor node's primary |
| 303 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole | 303 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole |
| 304 * is pointed to and covers the case where the accessible text is empty. | 304 * is pointed to and covers the case where the accessible text is empty. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 /** | 541 /** |
| 542 * Returns whether this range has valid start and end cursors. | 542 * Returns whether this range has valid start and end cursors. |
| 543 * @return {boolean} | 543 * @return {boolean} |
| 544 */ | 544 */ |
| 545 isValid: function() { | 545 isValid: function() { |
| 546 return this.start.isValid() && this.end.isValid(); | 546 return this.start.isValid() && this.end.isValid(); |
| 547 } | 547 } |
| 548 }; | 548 }; |
| 549 | 549 |
| 550 }); // goog.scope | 550 }); // goog.scope |
| OLD | NEW |