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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 /** | 105 /** |
106 * @return {number} | 106 * @return {number} |
107 */ | 107 */ |
108 get index() { | 108 get index() { |
109 return this.index_; | 109 return this.index_; |
110 }, | 110 }, |
111 | 111 |
112 /** | 112 /** |
113 * Gets the accessible text of the node associated with this cursor. | 113 * Gets the accessible text of the node associated with this cursor. |
114 * | 114 * |
115 * Note that only one of |name| or |value| attribute is ever nonempty on an | |
116 * automation node. If either contains whitespace, we still treat it as we do | |
117 * for a nonempty string. | |
118 * @param {!AutomationNode=} opt_node Use this node rather than this cursor's | 115 * @param {!AutomationNode=} opt_node Use this node rather than this cursor's |
119 * node. | 116 * node. |
120 * @return {string} | 117 * @return {string} |
121 */ | 118 */ |
122 getText: function(opt_node) { | 119 getText: function(opt_node) { |
123 var node = opt_node || this.node_; | 120 var node = opt_node || this.node_; |
124 return node.name || node.value || ''; | 121 return node.name || ''; |
125 }, | 122 }, |
126 | 123 |
127 /** | 124 /** |
128 * Makes a Cursor which has been moved from this cursor by the unit in the | 125 * Makes a Cursor which has been moved from this cursor by the unit in the |
129 * given direction using the given movement type. | 126 * given direction using the given movement type. |
130 * @param {Unit} unit | 127 * @param {Unit} unit |
131 * @param {Movement} movement | 128 * @param {Movement} movement |
132 * @param {Dir} dir | 129 * @param {Dir} dir |
133 * @return {!cursors.Cursor} The moved cursor. | 130 * @return {!cursors.Cursor} The moved cursor. |
134 */ | 131 */ |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 case Unit.DOM_NODE: | 429 case Unit.DOM_NODE: |
433 newStart = newStart.move(unit, Movement.DIRECTIONAL, dir); | 430 newStart = newStart.move(unit, Movement.DIRECTIONAL, dir); |
434 newEnd = newStart; | 431 newEnd = newStart; |
435 break; | 432 break; |
436 } | 433 } |
437 return new cursors.Range(newStart, newEnd); | 434 return new cursors.Range(newStart, newEnd); |
438 } | 435 } |
439 }; | 436 }; |
440 | 437 |
441 }); // goog.scope | 438 }); // goog.scope |
OLD | NEW |