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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/editable_text_base.js

Issue 2312353002: Revert of Add support for rich output inside of content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@editable_nav
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 .format({'COUNT': 1})), evt.triggeredByUser); 345 .format({'COUNT': 1})), evt.triggeredByUser);
346 return; 346 return;
347 } 347 }
348 if (evt.start == evt.end) { 348 if (evt.start == evt.end) {
349 // It's currently a cursor. 349 // It's currently a cursor.
350 if (this.start != this.end) { 350 if (this.start != this.end) {
351 // It was previously a selection, so just announce 'unselected'. 351 // It was previously a selection, so just announce 'unselected'.
352 this.speak(Msgs.getMsg('Unselected'), evt.triggeredByUser); 352 this.speak(Msgs.getMsg('Unselected'), evt.triggeredByUser);
353 } else if (this.getLineIndex(this.start) != 353 } else if (this.getLineIndex(this.start) !=
354 this.getLineIndex(evt.start)) { 354 this.getLineIndex(evt.start)) {
355 this.describeLine(this.getLineIndex(evt.start), evt.triggeredByUser); 355 // Moved to a different line; read it.
356 var lineValue = this.getLine(this.getLineIndex(evt.start));
357 if (lineValue == '') {
358 lineValue = Msgs.getMsg('text_box_blank');
359 } else if (/^\s+$/.test(lineValue)) {
360 lineValue = Msgs.getMsg('text_box_whitespace');
361 }
362 this.speak(lineValue, evt.triggeredByUser);
356 } else if (this.start == evt.start + 1 || 363 } else if (this.start == evt.start + 1 ||
357 this.start == evt.start - 1) { 364 this.start == evt.start - 1) {
358 // Moved by one character; read it. 365 // Moved by one character; read it.
359 if (!cvox.ChromeVoxEditableTextBase.useIBeamCursor) { 366 if (!cvox.ChromeVoxEditableTextBase.useIBeamCursor) {
360 if (evt.start == this.value.length) { 367 if (evt.start == this.value.length) {
361 if (cvox.ChromeVox.verbosity == cvox.VERBOSITY_VERBOSE) { 368 if (cvox.ChromeVox.verbosity == cvox.VERBOSITY_VERBOSE) {
362 this.speak(Msgs.getMsg('end_of_text_verbose'), 369 this.speak(Msgs.getMsg('end_of_text_verbose'),
363 evt.triggeredByUser); 370 evt.triggeredByUser);
364 } else { 371 } else {
365 this.speak(Msgs.getMsg('end_of_text_brief'), 372 this.speak(Msgs.getMsg('end_of_text_brief'),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } else { 419 } else {
413 // The selection changed but it wasn't an obvious extension of 420 // The selection changed but it wasn't an obvious extension of
414 // a previous selection. Just read the new selection. 421 // a previous selection. Just read the new selection.
415 this.speak(this.value.substr(evt.start, evt.end - evt.start), 422 this.speak(this.value.substr(evt.start, evt.end - evt.start),
416 evt.triggeredByUser); 423 evt.triggeredByUser);
417 this.speak(Msgs.getMsg('selected')); 424 this.speak(Msgs.getMsg('selected'));
418 } 425 }
419 } 426 }
420 }; 427 };
421 428
422 /**
423 * Describes a line given a line index and whether it was user triggered.
424 * @param {number} lineIndex
425 * @param {boolean} triggeredByUser
426 */
427 cvox.ChromeVoxEditableTextBase.prototype.describeLine =
428 function(lineIndex, triggeredByUser) {
429 var lineValue = this.getLine(lineIndex);
430 if (lineValue == '') {
431 lineValue = Msgs.getMsg('text_box_blank');
432 } else if (/^\s+$/.test(lineValue)) {
433 lineValue = Msgs.getMsg('text_box_whitespace');
434 }
435 this.speak(lineValue, triggeredByUser);
436 };
437
438 429
439 /** 430 /**
440 * Describe a change where the text changes. 431 * Describe a change where the text changes.
441 * @param {cvox.TextChangeEvent} evt The text change event. 432 * @param {cvox.TextChangeEvent} evt The text change event.
442 */ 433 */
443 cvox.ChromeVoxEditableTextBase.prototype.describeTextChanged = function(evt) { 434 cvox.ChromeVoxEditableTextBase.prototype.describeTextChanged = function(evt) {
444 var personality = {}; 435 var personality = {};
445 if (evt.value.length < this.value.length) { 436 if (evt.value.length < this.value.length) {
446 personality = cvox.AbstractTts.PERSONALITY_DELETED; 437 personality = cvox.AbstractTts.PERSONALITY_DELETED;
447 } 438 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 716
726 /** 717 /**
727 * Moves the cursor backward by one paragraph. 718 * Moves the cursor backward by one paragraph.
728 * @return {boolean} True if the action was handled. 719 * @return {boolean} True if the action was handled.
729 */ 720 */
730 cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousParagraph = 721 cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousParagraph =
731 function() { return false; }; 722 function() { return false; };
732 723
733 724
734 /******************************************/ 725 /******************************************/
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698