Chromium Code Reviews| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 newNode = newNode || originalNode; | 307 newNode = newNode || originalNode; |
| 308 newIndex = goog.isDef(newIndex) ? newIndex : this.index_; | 308 newIndex = goog.isDef(newIndex) ? newIndex : this.index_; |
| 309 return new cursors.Cursor(newNode, newIndex); | 309 return new cursors.Cursor(newNode, newIndex); |
| 310 }, | 310 }, |
| 311 | 311 |
| 312 /** | 312 /** |
| 313 * Returns whether this cursor points to a valid position. | 313 * Returns whether this cursor points to a valid position. |
| 314 * @return {boolean} | 314 * @return {boolean} |
| 315 */ | 315 */ |
| 316 isValid: function() { | 316 isValid: function() { |
| 317 return !!this.node && !!this.node.root; | 317 return this.node != null; |
|
dmazzoni
2016/06/20 19:49:03
Why this change? Did you not want to check the roo
David Tseng
2016/06/20 22:31:08
Your node recovery getter now does that.
| |
| 318 } | 318 } |
| 319 }; | 319 }; |
| 320 | 320 |
| 321 /** | 321 /** |
| 322 * A cursors.Cursor that wraps from beginning to end and vice versa when moved. | 322 * A cursors.Cursor that wraps from beginning to end and vice versa when moved. |
| 323 * @constructor | 323 * @constructor |
| 324 * @param {!AutomationNode} node | 324 * @param {!AutomationNode} node |
| 325 * @param {number} index A 0-based index into this cursor node's primary | 325 * @param {number} index A 0-based index into this cursor node's primary |
| 326 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole | 326 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole |
| 327 * is pointed to and covers the case where the accessible text is empty. | 327 * is pointed to and covers the case where the accessible text is empty. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 /** | 590 /** |
| 591 * Returns whether this range has valid start and end cursors. | 591 * Returns whether this range has valid start and end cursors. |
| 592 * @return {boolean} | 592 * @return {boolean} |
| 593 */ | 593 */ |
| 594 isValid: function() { | 594 isValid: function() { |
| 595 return this.start.isValid() && this.end.isValid(); | 595 return this.start.isValid() && this.end.isValid(); |
| 596 } | 596 } |
| 597 }; | 597 }; |
| 598 | 598 |
| 599 }); // goog.scope | 599 }); // goog.scope |
| OLD | NEW |