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

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

Issue 2956663002: Turn on rich editable text by default (Closed)
Patch Set: Rebase again. 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs » ('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 /** 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 27 matching lines...) Expand all
38 */ 38 */
39 editing.TextEditHandler = function(node) { 39 editing.TextEditHandler = function(node) {
40 /** @const {!AutomationNode} @private */ 40 /** @const {!AutomationNode} @private */
41 this.node_ = node; 41 this.node_ = node;
42 }; 42 };
43 43
44 /** 44 /**
45 * Flag set to indicate whether ChromeVox uses experimental rich text support. 45 * Flag set to indicate whether ChromeVox uses experimental rich text support.
46 * @type {boolean} 46 * @type {boolean}
47 */ 47 */
48 editing.useRichText = false; 48 editing.useRichText = true;
49 49
50 editing.TextEditHandler.prototype = { 50 editing.TextEditHandler.prototype = {
51 /** @return {!AutomationNode} */ 51 /** @return {!AutomationNode} */
52 get node() { 52 get node() {
53 return this.node_; 53 return this.node_;
54 }, 54 },
55 55
56 /** 56 /**
57 * Receives the following kinds of events when the node provided to the 57 * Receives the following kinds of events when the node provided to the
58 * constructor is focuse: |focus|, |textChanged|, |textSelectionChanged| and 58 * constructor is focuse: |focus|, |textChanged|, |textSelectionChanged| and
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 378 }
379 }, 379 },
380 380
381 /** @private */ 381 /** @private */
382 brailleCurrentRichLine_: function() { 382 brailleCurrentRichLine_: function() {
383 var cur = this.line_; 383 var cur = this.line_;
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
389 // We might have to append labels for this text field if |cur| is the first
390 // line.
391 if (cur.localLineStartContainerOffset_ == 0 &&
392 cur.lineStartContainer_ ==
393 this.node_.find({role: RoleType.STATIC_TEXT})) {
dmazzoni 2017/06/23 18:36:01 I think this assumes that the first static text is
David Tseng 2017/06/23 18:44:28 To be internally consistent with EditableLine, we
394 value = new Spannable(value);
395 var labelComponents = [' '];
396 if (this.node_.name)
397 labelComponents.push(this.node_.name);
398 labelComponents.push(Msgs.getMsg('tag_textarea_brl'));
399 var label = labelComponents.join(' ');
400 value.append(label);
401 }
402
388 cvox.ChromeVox.braille.write(new cvox.NavBraille( 403 cvox.ChromeVox.braille.write(new cvox.NavBraille(
389 {text: value, startIndex: cur.startOffset, endIndex: cur.endOffset})); 404 {text: value, startIndex: cur.startOffset, endIndex: cur.endOffset}));
390 }, 405 },
391 406
392 /** @override */ 407 /** @override */
393 describeSelectionChanged: function(evt) { 408 describeSelectionChanged: function(evt) {
394 // Note that since Chrome allows for selection to be placed immediately at 409 // Note that since Chrome allows for selection to be placed immediately at
395 // the end of a line (i.e. end == value.length) and since we try to describe 410 // 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 411 // the character to the right, this state has very little meaning in most
397 // cases. Describe it as a new line. In braille, we simply show the cursor 412 // cases. Describe it as a new line. In braille, we simply show the cursor
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 * @return {boolean} 766 * @return {boolean}
752 */ 767 */
753 isSameLineAndSelection: function(otherLine) { 768 isSameLineAndSelection: function(otherLine) {
754 return this.isSameLine(otherLine) && 769 return this.isSameLine(otherLine) &&
755 this.startOffset == otherLine.startOffset && 770 this.startOffset == otherLine.startOffset &&
756 this.endOffset == otherLine.endOffset; 771 this.endOffset == otherLine.endOffset;
757 } 772 }
758 }; 773 };
759 774
760 }); 775 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698