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

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

Issue 2948173004: Fix end of line announcements (Closed)
Patch Set: Created 3 years, 6 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 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
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, this state has very little meaning in most
dmazzoni 2017/06/23 18:31:45 I don't know what you mean by "this state has very
David Tseng 2017/06/23 19:17:07 It has little meaning because there's no character
397 // cases. Describe it as a new line. In braille, we simply show the cursor
398 // one cell to the right of the last character.
399 if ((this.start + 1) == evt.start && evt.start == this.value.length) {
400 this.speak('\n', evt.triggeredByUser);
396 return; 401 return;
402 }
397 403
398 cvox.ChromeVoxEditableTextBase.prototype.describeSelectionChanged.call( 404 cvox.ChromeVoxEditableTextBase.prototype.describeSelectionChanged.call(
399 this, evt); 405 this, evt);
400 }, 406 },
401 407
402 /** @override */ 408 /** @override */
403 getLineIndex: function(charIndex) { 409 getLineIndex: function(charIndex) {
404 return 0; 410 return 0;
405 }, 411 },
406 412
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 * @return {boolean} 751 * @return {boolean}
746 */ 752 */
747 isSameLineAndSelection: function(otherLine) { 753 isSameLineAndSelection: function(otherLine) {
748 return this.isSameLine(otherLine) && 754 return this.isSameLine(otherLine) &&
749 this.startOffset == otherLine.startOffset && 755 this.startOffset == otherLine.startOffset &&
750 this.endOffset == otherLine.endOffset; 756 this.endOffset == otherLine.endOffset;
751 } 757 }
752 }; 758 };
753 759
754 }); 760 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698