Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js

Issue 2099833002: For a range surrounding a node, set selection index to 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add simple test. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return this.index_; 130 return this.index_;
131 }, 131 },
132 132
133 /** 133 /**
134 * An index appropriate for making selections. 134 * An index appropriate for making selections.
135 * @return {number} 135 * @return {number}
136 * @private 136 * @private
137 */ 137 */
138 get selectionIndex_() { 138 get selectionIndex_() {
139 if (this.index_ == cursors.NODE_INDEX) 139 if (this.index_ == cursors.NODE_INDEX)
140 return cursors.NODE_INDEX; 140 return 0;
141 141
142 var adjustedIndex = this.index_; 142 var adjustedIndex = this.index_;
143 143
144 if (this.node.role == RoleType.inlineTextBox) { 144 if (this.node.role == RoleType.inlineTextBox) {
145 var sibling = this.node.previousSibling; 145 var sibling = this.node.previousSibling;
146 while (sibling) { 146 while (sibling) {
147 adjustedIndex += sibling.name.length; 147 adjustedIndex += sibling.name.length;
148 sibling = sibling.previousSibling; 148 sibling = sibling.previousSibling;
149 } 149 }
150 } 150 }
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 /** 593 /**
594 * Returns whether this range has valid start and end cursors. 594 * Returns whether this range has valid start and end cursors.
595 * @return {boolean} 595 * @return {boolean}
596 */ 596 */
597 isValid: function() { 597 isValid: function() {
598 return this.start.isValid() && this.end.isValid(); 598 return this.start.isValid() && this.end.isValid();
599 } 599 }
600 }; 600 };
601 601
602 }); // goog.scope 602 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698