OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 Processes events related to editing text and emits the | 6 * @fileoverview Processes events related to editing text and emits the |
7 * appropriate spoken and braille feedback. | 7 * appropriate spoken and braille feedback. |
8 */ | 8 */ |
9 | 9 |
10 goog.provide('editing.TextEditHandler'); | 10 goog.provide('editing.TextEditHandler'); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 var value = cur.value_; | 384 var value = cur.value_; |
385 value.setSpan(new cvox.ValueSpan(0), 0, cur.value_.length); | 385 value.setSpan(new cvox.ValueSpan(0), 0, cur.value_.length); |
386 value.setSpan( | 386 value.setSpan( |
387 new cvox.ValueSelectionSpan(), cur.startOffset, cur.endOffset); | 387 new cvox.ValueSelectionSpan(), cur.startOffset, cur.endOffset); |
388 cvox.ChromeVox.braille.write(new cvox.NavBraille( | 388 cvox.ChromeVox.braille.write(new cvox.NavBraille( |
389 {text: value, startIndex: cur.startOffset, endIndex: cur.endOffset})); | 389 {text: value, startIndex: cur.startOffset, endIndex: cur.endOffset})); |
390 }, | 390 }, |
391 | 391 |
392 /** @override */ | 392 /** @override */ |
393 describeSelectionChanged: function(evt) { | 393 describeSelectionChanged: function(evt) { |
394 // Ignore end of text announcements. | 394 // Note that since Chrome allows for selection to be placed immediately at |
395 if ((this.start + 1) == evt.start && evt.start == this.value.length) | 395 // the end of a line (i.e. end == value.length) and since we try to describe |
| 396 // the character to the right, just describe it as a new line. |
| 397 if ((this.start + 1) == evt.start && evt.start == this.value.length) { |
| 398 this.speak('\n', evt.triggeredByUser); |
396 return; | 399 return; |
| 400 } |
397 | 401 |
398 cvox.ChromeVoxEditableTextBase.prototype.describeSelectionChanged.call( | 402 cvox.ChromeVoxEditableTextBase.prototype.describeSelectionChanged.call( |
399 this, evt); | 403 this, evt); |
400 }, | 404 }, |
401 | 405 |
402 /** @override */ | 406 /** @override */ |
403 getLineIndex: function(charIndex) { | 407 getLineIndex: function(charIndex) { |
404 return 0; | 408 return 0; |
405 }, | 409 }, |
406 | 410 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 * @return {boolean} | 749 * @return {boolean} |
746 */ | 750 */ |
747 isSameLineAndSelection: function(otherLine) { | 751 isSameLineAndSelection: function(otherLine) { |
748 return this.isSameLine(otherLine) && | 752 return this.isSameLine(otherLine) && |
749 this.startOffset == otherLine.startOffset && | 753 this.startOffset == otherLine.startOffset && |
750 this.endOffset == otherLine.endOffset; | 754 this.endOffset == otherLine.endOffset; |
751 } | 755 } |
752 }; | 756 }; |
753 | 757 |
754 }); | 758 }); |
OLD | NEW |