Chromium Code Reviews| 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 goog.provide('cvox.ChromeVoxEditableTextBase'); | 5 goog.provide('cvox.ChromeVoxEditableTextBase'); |
| 6 goog.provide('cvox.TextChangeEvent'); | 6 goog.provide('cvox.TextChangeEvent'); |
| 7 goog.provide('cvox.TypingEcho'); | 7 goog.provide('cvox.TypingEcho'); |
| 8 | 8 |
| 9 goog.require('cvox.AbstractTts'); | 9 goog.require('cvox.AbstractTts'); |
| 10 goog.require('cvox.ChromeVox'); | 10 goog.require('cvox.ChromeVox'); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 // Next, see if one or more characters were deleted from the previous | 486 // Next, see if one or more characters were deleted from the previous |
| 487 // cursor position and the new cursor is in the expected place. This | 487 // cursor position and the new cursor is in the expected place. This |
| 488 // handles backspace, forward-delete, and similar shortcuts that delete | 488 // handles backspace, forward-delete, and similar shortcuts that delete |
| 489 // a word or line. | 489 // a word or line. |
| 490 prefixLen = evt.start; | 490 prefixLen = evt.start; |
| 491 suffixLen = newLen - evtEnd; | 491 suffixLen = newLen - evtEnd; |
| 492 if (this.start == this.end && | 492 if (this.start == this.end && |
| 493 evt.start == evtEnd && | 493 evt.start == evtEnd && |
| 494 evtValue.substr(0, prefixLen) == value.substr(0, prefixLen) && | 494 evtValue.substr(0, prefixLen) == value.substr(0, prefixLen) && |
| 495 evtValue.substr(newLen - suffixLen) == | 495 evtValue.substr(newLen - suffixLen) == |
| 496 value.substr(len - suffixLen)) { | 496 value.substr(len - suffixLen)) { |
| 497 this.describeTextChangedHelper( | 497 // Forward deletions causes reading of the character immediately to the |
|
dmazzoni
2016/06/27 22:08:28
Do this only if cvox.ChromeVoxEditableTextBase.use
| |
| 498 evt, prefixLen, suffixLen, autocompleteSuffix, personality); | 498 // right of the caret. |
| 499 if (this.start == evt.start && this.end == evt.end) { | |
| 500 this.speak(evt.value[evt.start], evt.triggeredByUser); | |
| 501 } else { | |
| 502 this.describeTextChangedHelper( | |
| 503 evt, prefixLen, suffixLen, autocompleteSuffix, personality); | |
| 504 } | |
| 499 return; | 505 return; |
| 500 } | 506 } |
| 501 | 507 |
| 502 // If all else fails, we assume the change was not the result of a normal | 508 // If all else fails, we assume the change was not the result of a normal |
| 503 // user editing operation, so we'll have to speak feedback based only | 509 // user editing operation, so we'll have to speak feedback based only |
| 504 // on the changes to the text, not the cursor position / selection. | 510 // on the changes to the text, not the cursor position / selection. |
| 505 // First, restore the autocomplete text if any. | 511 // First, restore the autocomplete text if any. |
| 506 evtValue += autocompleteSuffix; | 512 evtValue += autocompleteSuffix; |
| 507 | 513 |
| 508 // Try to do a diff between the new and the old text. If it is a one character | 514 // Try to do a diff between the new and the old text. If it is a one character |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 707 | 713 |
| 708 /** | 714 /** |
| 709 * Moves the cursor backward by one paragraph. | 715 * Moves the cursor backward by one paragraph. |
| 710 * @return {boolean} True if the action was handled. | 716 * @return {boolean} True if the action was handled. |
| 711 */ | 717 */ |
| 712 cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousParagraph = | 718 cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousParagraph = |
| 713 function() { return false; }; | 719 function() { return false; }; |
| 714 | 720 |
| 715 | 721 |
| 716 /******************************************/ | 722 /******************************************/ |
| OLD | NEW |