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

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

Issue 674263003: Add remaining text/caret navigation commands to ChromeVox Next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@integrate_cursor
Patch Set: Created 6 years, 1 month 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/cursors.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 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 The entry point for all ChromeVox2 related code for the 6 * @fileoverview The entry point for all ChromeVox2 related code for the
7 * background page. 7 * background page.
8 */ 8 */
9 9
10 goog.provide('Background'); 10 goog.provide('Background');
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 var pred = null; 137 var pred = null;
138 switch (command) { 138 switch (command) {
139 case 'nextHeading': 139 case 'nextHeading':
140 dir = Dir.FORWARD; 140 dir = Dir.FORWARD;
141 pred = AutomationPredicate.heading; 141 pred = AutomationPredicate.heading;
142 break; 142 break;
143 case 'previousHeading': 143 case 'previousHeading':
144 dir = Dir.BACKWARD; 144 dir = Dir.BACKWARD;
145 pred = AutomationPredicate.heading; 145 pred = AutomationPredicate.heading;
146 break; 146 break;
147 case 'nextCharacter':
148 current = current.move(cursors.Unit.CHARACTER, Dir.FORWARD);
149 break;
150 case 'previousCharacter':
151 current = current.move(cursors.Unit.CHARACTER, Dir.BACKWARD);
152 break;
153 case 'nextWord':
154 current = current.move(cursors.Unit.WORD, Dir.FORWARD);
155 break;
156 case 'previousWord':
157 current = current.move(cursors.Unit.WORD, Dir.BACKWARD);
158 break;
147 case 'nextLine': 159 case 'nextLine':
148 current = current.move(cursors.Unit.LINE, Dir.FORWARD); 160 current = current.move(cursors.Unit.LINE, Dir.FORWARD);
149 break; 161 break;
150 case 'previousLine': 162 case 'previousLine':
151 current = current.move(cursors.Unit.LINE, Dir.BACKWARD); 163 current = current.move(cursors.Unit.LINE, Dir.BACKWARD);
152 break; 164 break;
153 case 'nextLink': 165 case 'nextLink':
154 dir = Dir.FORWARD; 166 dir = Dir.FORWARD;
155 pred = AutomationPredicate.link; 167 pred = AutomationPredicate.link;
156 break; 168 break;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 var nodeLocations = []; 323 var nodeLocations = [];
312 while (cursor.getNode() != range.getEnd().getNode()) { 324 while (cursor.getNode() != range.getEnd().getNode()) {
313 output += getCursorDesc(cursor); 325 output += getCursorDesc(cursor);
314 nodeLocations.push(cursor.getNode().location); 326 nodeLocations.push(cursor.getNode().location);
315 cursor = cursor.move( 327 cursor = cursor.move(
316 cursors.Unit.NODE, cursors.Movement.DIRECTIONAL, Dir.FORWARD); 328 cursors.Unit.NODE, cursors.Movement.DIRECTIONAL, Dir.FORWARD);
317 } 329 }
318 output += getCursorDesc(range.getEnd()); 330 output += getCursorDesc(range.getEnd());
319 nodeLocations.push(range.getEnd().getNode().location); 331 nodeLocations.push(range.getEnd().getNode().location);
320 332
333 // Read subnode ranges.
334 if (range.getStart().getNode() === range.getEnd().getNode()) {
dmazzoni 2014/10/27 07:06:20 Suppose I'm moving by words and I move from the la
335 var startIndex = range.getStart().getIndex();
336 var endIndex = range.getEnd().getIndex();
337 if (startIndex > -1 && endIndex > -1)
338 output = range.getStart().getText().substring(startIndex, endIndex);
339 }
340
321 cvox.ChromeVox.tts.speak(output, cvox.QueueMode.FLUSH); 341 cvox.ChromeVox.tts.speak(output, cvox.QueueMode.FLUSH);
322 cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(output)); 342 cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(output));
323 chrome.accessibilityPrivate.setFocusRing(nodeLocations); 343 chrome.accessibilityPrivate.setFocusRing(nodeLocations);
324 } 344 }
325 }; 345 };
326 346
327 /** @type {Background} */ 347 /** @type {Background} */
328 global.backgroundObj = new Background(); 348 global.backgroundObj = new Background();
329 349
330 }); // goog.scope 350 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698