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

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

Issue 2092743002: Revert of Make ChromeVox Next a setting in options page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 Classes related to cursors that point to and select parts of 6 * @fileoverview Classes related to cursors that point to and select parts of
7 * the automation tree. 7 * the automation tree.
8 */ 8 */
9 9
10 goog.provide('cursors.Cursor'); 10 goog.provide('cursors.Cursor');
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 newNode = newNode || originalNode; 307 newNode = newNode || originalNode;
308 newIndex = goog.isDef(newIndex) ? newIndex : this.index_; 308 newIndex = goog.isDef(newIndex) ? newIndex : this.index_;
309 return new cursors.Cursor(newNode, newIndex); 309 return new cursors.Cursor(newNode, newIndex);
310 }, 310 },
311 311
312 /** 312 /**
313 * Returns whether this cursor points to a valid position. 313 * Returns whether this cursor points to a valid position.
314 * @return {boolean} 314 * @return {boolean}
315 */ 315 */
316 isValid: function() { 316 isValid: function() {
317 return this.node != null; 317 return !!this.node && !!this.node.root;
318 } 318 }
319 }; 319 };
320 320
321 /** 321 /**
322 * A cursors.Cursor that wraps from beginning to end and vice versa when moved. 322 * A cursors.Cursor that wraps from beginning to end and vice versa when moved.
323 * @constructor 323 * @constructor
324 * @param {!AutomationNode} node 324 * @param {!AutomationNode} node
325 * @param {number} index A 0-based index into this cursor node's primary 325 * @param {number} index A 0-based index into this cursor node's primary
326 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole 326 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole
327 * is pointed to and covers the case where the accessible text is empty. 327 * is pointed to and covers the case where the accessible text is empty.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 select: function() { 548 select: function() {
549 var start = this.start.node; 549 var start = this.start.node;
550 var end = this.end.node; 550 var end = this.end.node;
551 551
552 if (!start || !end) 552 if (!start || !end)
553 return; 553 return;
554 554
555 // Find the most common root. 555 // Find the most common root.
556 var uniqueAncestors = AutomationUtil.getUniqueAncestors(start, end); 556 var uniqueAncestors = AutomationUtil.getUniqueAncestors(start, end);
557 var mcr = start.root; 557 var mcr = start.root;
558 if (uniqueAncestors) { 558 if (uniqueAncestors)
559 var common = uniqueAncestors.pop().parent; 559 mcr = uniqueAncestors.pop().parent.root;
560 if (common)
561 mcr = common.root;
562 }
563 560
564 if (!mcr || mcr.role == RoleType.desktop) 561 if (mcr.role == RoleType.desktop)
565 return; 562 return;
566 563
567 if (mcr === start.root && mcr === end.root) { 564 if (mcr === start.root && mcr === end.root) {
568 start = start.role == RoleType.inlineTextBox ? start.parent : start; 565 start = start.role == RoleType.inlineTextBox ? start.parent : start;
569 end = end.role == RoleType.inlineTextBox ? end.parent : end; 566 end = end.role == RoleType.inlineTextBox ? end.parent : end;
570 567
571 if (!start || !end) 568 if (!start || !end)
572 return; 569 return;
573 570
574 chrome.automation.setDocumentSelection( 571 chrome.automation.setDocumentSelection(
(...skipping 18 matching lines...) Expand all
593 /** 590 /**
594 * Returns whether this range has valid start and end cursors. 591 * Returns whether this range has valid start and end cursors.
595 * @return {boolean} 592 * @return {boolean}
596 */ 593 */
597 isValid: function() { 594 isValid: function() {
598 return this.start.isValid() && this.end.isValid(); 595 return this.start.isValid() && this.end.isValid();
599 } 596 }
600 }; 597 };
601 598
602 }); // goog.scope 599 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698