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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/braille/braille_input_handler.js

Issue 889593002: Refactorings to reduce dependencies in ChromeVox 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Readd missing dep and add a new one that should've been there already. Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 Handles braille input keys when the user is typing or editing 6 * @fileoverview Handles braille input keys when the user is typing or editing
7 * text in an input field. This class cooperates with the Braille IME 7 * text in an input field. This class cooperates with the Braille IME
8 * that is built into Chrome OS to do the actual text editing. 8 * that is built into Chrome OS to do the actual text editing.
9 */ 9 */
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 }; 126 };
127 127
128 128
129 /** 129 /**
130 * Called when the content on the braille display is updated. Modifies the 130 * Called when the content on the braille display is updated. Modifies the
131 * input state according to the new content. 131 * input state according to the new content.
132 * @param {cvox.Spannable} text Text, optionally with value and selection 132 * @param {cvox.Spannable} text Text, optionally with value and selection
133 * spans. 133 * spans.
134 */ 134 */
135 cvox.BrailleInputHandler.prototype.onDisplayContentChanged = function(text) { 135 cvox.BrailleInputHandler.prototype.onDisplayContentChanged = function(text) {
136 var valueSpan = text.getSpanInstanceOf(cvox.BrailleUtil.ValueSpan); 136 var valueSpan = text.getSpanInstanceOf(cvox.ValueSpan);
137 var selectionSpan = text.getSpanInstanceOf( 137 var selectionSpan = text.getSpanInstanceOf(cvox.ValueSelectionSpan);
138 cvox.BrailleUtil.ValueSelectionSpan);
139 if (!(valueSpan && selectionSpan)) { 138 if (!(valueSpan && selectionSpan)) {
140 return; 139 return;
141 } 140 }
142 // The type casts are ok because the spans are known to exist. 141 // The type casts are ok because the spans are known to exist.
143 var valueStart = /** @type {number} */ (text.getSpanStart(valueSpan)); 142 var valueStart = /** @type {number} */ (text.getSpanStart(valueSpan));
144 var valueEnd = /** @type {number} */ (text.getSpanEnd(valueSpan)); 143 var valueEnd = /** @type {number} */ (text.getSpanEnd(valueSpan));
145 var selectionStart = 144 var selectionStart =
146 /** @type {number} */ (text.getSpanStart(selectionSpan)); 145 /** @type {number} */ (text.getSpanStart(selectionSpan));
147 var selectionEnd = /** @type {number} */ (text.getSpanEnd(selectionSpan)); 146 var selectionEnd = /** @type {number} */ (text.getSpanEnd(selectionSpan));
148 if (selectionStart < valueStart || selectionEnd > valueEnd) { 147 if (selectionStart < valueStart || selectionEnd > valueEnd) {
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 first, second) { 499 first, second) {
501 var limit = Math.min(first.length, second.length); 500 var limit = Math.min(first.length, second.length);
502 var i; 501 var i;
503 for (i = 0; i < limit; ++i) { 502 for (i = 0; i < limit; ++i) {
504 if (first.charAt(i) != second.charAt(i)) { 503 if (first.charAt(i) != second.charAt(i)) {
505 break; 504 break;
506 } 505 }
507 } 506 }
508 return i; 507 return i;
509 }; 508 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698