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

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

Issue 2296013002: setCurrentRange should ensure it moves ChromeVox to a valid range. (Closed)
Patch Set: Make sure newRange is defined. 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 | no next file » | 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return null; 328 return null;
329 }, 329 },
330 330
331 /** 331 /**
332 * @override 332 * @override
333 */ 333 */
334 setCurrentRange: function(newRange) { 334 setCurrentRange: function(newRange) {
335 if (!this.inExcursion_ && newRange) 335 if (!this.inExcursion_ && newRange)
336 this.savedRange_ = new cursors.Range(newRange.start, newRange.end); 336 this.savedRange_ = new cursors.Range(newRange.start, newRange.end);
337 337
338 if (newRange && !newRange.isValid())
339 return;
340
338 this.currentRange_ = newRange; 341 this.currentRange_ = newRange;
339 var oldMode = this.mode_; 342 var oldMode = this.mode_;
340 var newMode = this.getMode(); 343 var newMode = this.getMode();
341 if (oldMode != newMode) { 344 if (oldMode != newMode) {
342 this.onModeChanged_(newMode, oldMode); 345 this.onModeChanged_(newMode, oldMode);
343 this.mode_ = newMode; 346 this.mode_ = newMode;
344 } 347 }
345 348
346 if (this.currentRange_) { 349 if (this.currentRange_) {
347 var start = this.currentRange_.start.node; 350 var start = this.currentRange_.start.node;
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 return new RegExp('^(' + globs.map(function(glob) { 751 return new RegExp('^(' + globs.map(function(glob) {
749 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') 752 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&')
750 .replace(/\*/g, '.*') 753 .replace(/\*/g, '.*')
751 .replace(/\?/g, '.'); 754 .replace(/\?/g, '.');
752 }).join('|') + ')$'); 755 }).join('|') + ')$');
753 }; 756 };
754 757
755 new Background(); 758 new Background();
756 759
757 }); // goog.scope 760 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698