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

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

Issue 1458723002: Finish implementing ChromeVox Next active indicator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@load_key_map
Patch Set: Created 5 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
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 }, 139 },
140 140
141 get currentRange() { 141 get currentRange() {
142 return this.currentRange_; 142 return this.currentRange_;
143 }, 143 },
144 144
145 set currentRange(value) { 145 set currentRange(value) {
146 if (!value) 146 if (!value)
147 return; 147 return;
148 148
149 value.start.node.makeVisible();
Peter Lundblad 2015/11/20 11:15:03 I recommend setting the value first or ignoring ex
dmazzoni 2015/11/20 23:35:14 Done.
150
149 this.currentRange_ = value; 151 this.currentRange_ = value;
150 }, 152 },
151 153
152 /** 154 /**
153 * Handles ChromeVox Next commands. 155 * Handles ChromeVox Next commands.
154 * @param {string} command 156 * @param {string} command
155 * @param {boolean=} opt_bypassModeCheck Always tries to execute the command 157 * @param {boolean=} opt_bypassModeCheck Always tries to execute the command
156 * regardless of mode. 158 * regardless of mode.
157 * @return {boolean} True if the command should propagate. 159 * @return {boolean} True if the command should propagate.
158 */ 160 */
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 global.isReadingContinuously = true; 319 global.isReadingContinuously = true;
318 var continueReading = function(prevRange) { 320 var continueReading = function(prevRange) {
319 if (!global.isReadingContinuously || !this.currentRange_) 321 if (!global.isReadingContinuously || !this.currentRange_)
320 return; 322 return;
321 323
322 new Output().withSpeechAndBraille( 324 new Output().withSpeechAndBraille(
323 this.currentRange_, prevRange, Output.EventType.NAVIGATE) 325 this.currentRange_, prevRange, Output.EventType.NAVIGATE)
324 .onSpeechEnd(function() { continueReading(prevRange); }) 326 .onSpeechEnd(function() { continueReading(prevRange); })
325 .go(); 327 .go();
326 prevRange = this.currentRange_; 328 prevRange = this.currentRange_;
327 this.currentRange_ = 329 this.currentRange =
328 this.currentRange_.move(cursors.Unit.NODE, Dir.FORWARD); 330 this.currentRange.move(cursors.Unit.NODE, Dir.FORWARD);
329 331
330 if (!this.currentRange_ || this.currentRange_.equals(prevRange)) 332 if (!this.currentRange_ || this.currentRange_.equals(prevRange))
331 global.isReadingContinuously = false; 333 global.isReadingContinuously = false;
332 }.bind(this); 334 }.bind(this);
333 335
334 continueReading(null); 336 continueReading(null);
335 return false; 337 return false;
336 case 'showContextMenu': 338 case 'showContextMenu':
337 if (this.currentRange_) { 339 if (this.currentRange_) {
338 var actionNode = this.currentRange_.start.node; 340 var actionNode = this.currentRange_.start.node;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 396 }
395 397
396 if (current) { 398 if (current) {
397 // TODO(dtseng): Figure out what it means to focus a range. 399 // TODO(dtseng): Figure out what it means to focus a range.
398 var actionNode = current.start.node; 400 var actionNode = current.start.node;
399 if (actionNode.role == RoleType.inlineTextBox) 401 if (actionNode.role == RoleType.inlineTextBox)
400 actionNode = actionNode.parent; 402 actionNode = actionNode.parent;
401 actionNode.focus(); 403 actionNode.focus();
402 404
403 var prevRange = this.currentRange_; 405 var prevRange = this.currentRange_;
404 this.currentRange_ = current; 406 this.currentRange = current;
405 407
406 new Output().withSpeechAndBraille( 408 new Output().withSpeechAndBraille(
407 this.currentRange_, prevRange, Output.EventType.NAVIGATE) 409 this.currentRange_, prevRange, Output.EventType.NAVIGATE)
408 .go(); 410 .go();
409 } 411 }
410 412
411 return false; 413 return false;
412 }, 414 },
413 415
414 /** 416 /**
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') 685 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&')
684 .replace(/\*/g, '.*') 686 .replace(/\*/g, '.*')
685 .replace(/\?/g, '.'); 687 .replace(/\?/g, '.');
686 }).join('|') + ')$'); 688 }).join('|') + ')$');
687 }; 689 };
688 690
689 /** @type {Background} */ 691 /** @type {Background} */
690 global.backgroundObj = new Background(); 692 global.backgroundObj = new Background();
691 693
692 }); // goog.scope 694 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698