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

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

Issue 1970153003: Completely detach removed nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 7 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 | chrome/browser/resources/chromeos/chromevox/cvox2/background/output.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 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 newNode, dir, AutomationPredicate.linebreak); 277 newNode, dir, AutomationPredicate.linebreak);
278 break; 278 break;
279 } 279 }
280 break; 280 break;
281 default: 281 default:
282 throw Error('Unrecognized unit: ' + unit); 282 throw Error('Unrecognized unit: ' + unit);
283 } 283 }
284 newNode = newNode || this.node_; 284 newNode = newNode || this.node_;
285 newIndex = goog.isDef(newIndex) ? newIndex : this.index_; 285 newIndex = goog.isDef(newIndex) ? newIndex : this.index_;
286 return new cursors.Cursor(newNode, newIndex); 286 return new cursors.Cursor(newNode, newIndex);
287 },
288
289 /**
290 * Returns whether this cursor points to a valid position.
291 * @return {boolean}
292 */
293 isValid: function() {
294 return this.node.role !== undefined;
287 } 295 }
288 }; 296 };
289 297
290 /** 298 /**
291 * A cursors.Cursor that wraps from beginning to end and vice versa when moved. 299 * A cursors.Cursor that wraps from beginning to end and vice versa when moved.
292 * @constructor 300 * @constructor
293 * @param {!AutomationNode} node 301 * @param {!AutomationNode} node
294 * @param {number} index A 0-based index into this cursor node's primary 302 * @param {number} index A 0-based index into this cursor node's primary
295 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole 303 * accessible name. An index of |cursors.NODE_INDEX| means the node as a whole
296 * is pointed to and covers the case where the accessible text is empty. 304 * is pointed to and covers the case where the accessible text is empty.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 529 }
522 }, 530 },
523 531
524 /** 532 /**
525 * Returns true if this range has either cursor end on web content. 533 * Returns true if this range has either cursor end on web content.
526 * @return {boolean} 534 * @return {boolean}
527 */ 535 */
528 isWebRange: function() { 536 isWebRange: function() {
529 return this.start.node.root.role != RoleType.desktop || 537 return this.start.node.root.role != RoleType.desktop ||
530 this.end.node.root.role != RoleType.desktop; 538 this.end.node.root.role != RoleType.desktop;
539 },
540
541 /**
542 * Returns whether this range has valid start and end cursors.
543 * @return {boolean}
544 */
545 isValid: function() {
546 return this.start.isValid() && this.end.isValid();
531 } 547 }
532 }; 548 };
533 549
534 }); // goog.scope 550 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698