| 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 |
| 498 evt, prefixLen, suffixLen, autocompleteSuffix, personality); | 498 // right of the caret or the deleted text depending on the iBeam cursor |
| 499 // setting. |
| 500 if (this.start == evt.start && |
| 501 this.end == evt.end && |
| 502 !cvox.ChromeVoxEditableTextBase.useIBeamCursor) { |
| 503 this.speak(evt.value[evt.start], evt.triggeredByUser); |
| 504 } else { |
| 505 this.describeTextChangedHelper( |
| 506 evt, prefixLen, suffixLen, autocompleteSuffix, personality); |
| 507 } |
| 499 return; | 508 return; |
| 500 } | 509 } |
| 501 | 510 |
| 502 // If all else fails, we assume the change was not the result of a normal | 511 // 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 | 512 // user editing operation, so we'll have to speak feedback based only |
| 504 // on the changes to the text, not the cursor position / selection. | 513 // on the changes to the text, not the cursor position / selection. |
| 505 // First, restore the autocomplete text if any. | 514 // First, restore the autocomplete text if any. |
| 506 evtValue += autocompleteSuffix; | 515 evtValue += autocompleteSuffix; |
| 507 | 516 |
| 508 // Try to do a diff between the new and the old text. If it is a one character | 517 // 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 | 716 |
| 708 /** | 717 /** |
| 709 * Moves the cursor backward by one paragraph. | 718 * Moves the cursor backward by one paragraph. |
| 710 * @return {boolean} True if the action was handled. | 719 * @return {boolean} True if the action was handled. |
| 711 */ | 720 */ |
| 712 cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousParagraph = | 721 cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousParagraph = |
| 713 function() { return false; }; | 722 function() { return false; }; |
| 714 | 723 |
| 715 | 724 |
| 716 /******************************************/ | 725 /******************************************/ |
| OLD | NEW |