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

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

Issue 1326363002: Reinstantiate EditableTextHandler instance on focus change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 new Output().withSpeechAndBraille( 446 new Output().withSpeechAndBraille(
447 this.currentRange_, prevRange, evt.type) 447 this.currentRange_, prevRange, evt.type)
448 .go(); 448 .go();
449 }, 449 },
450 450
451 /** 451 /**
452 * Provides all feedback once a focus event fires. 452 * Provides all feedback once a focus event fires.
453 * @param {Object} evt 453 * @param {Object} evt
454 */ 454 */
455 onFocus: function(evt) { 455 onFocus: function(evt) {
456 // Invalidate any previous editable text handler state.
457 this.editableTextHandler = null;
458
456 var node = evt.target; 459 var node = evt.target;
457 460
458 // It almost never makes sense to place focus directly on a rootWebArea. 461 // It almost never makes sense to place focus directly on a rootWebArea.
459 if (node.role == RoleType.rootWebArea) { 462 if (node.role == RoleType.rootWebArea) {
460 // Try to find a focusable descendant. 463 // Try to find a focusable descendant.
461 node = AutomationUtil.findNodePost(node, 464 node = AutomationUtil.findNodePost(node,
462 Dir.FORWARD, 465 Dir.FORWARD,
463 AutomationPredicate.focused) || node; 466 AutomationPredicate.focused) || node;
464 467
465 // Fall back to the first leaf node in the document. 468 // Fall back to the first leaf node in the document.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 true); // triggered by user 541 true); // triggered by user
539 if (!this.editableTextHandler || 542 if (!this.editableTextHandler ||
540 evt.target != this.currentRange_.start.node) { 543 evt.target != this.currentRange_.start.node) {
541 this.editableTextHandler = 544 this.editableTextHandler =
542 new cvox.ChromeVoxEditableTextBase( 545 new cvox.ChromeVoxEditableTextBase(
543 textChangeEvent.value, 546 textChangeEvent.value,
544 textChangeEvent.start, 547 textChangeEvent.start,
545 textChangeEvent.end, 548 textChangeEvent.end,
546 evt.target.state['protected'], 549 evt.target.state['protected'],
547 cvox.ChromeVox.tts); 550 cvox.ChromeVox.tts);
551
552 // Ignore the first text selection changed event which gets fired after
dmazzoni 2015/09/10 18:46:41 This shouldn't be necessary once https://coderevie
553 // the focus event.
554 return;
548 } 555 }
549 556
550 this.editableTextHandler.changed(textChangeEvent); 557 this.editableTextHandler.changed(textChangeEvent);
551 new Output().withBraille( 558 new Output().withBraille(
552 this.currentRange_, null, evt.type) 559 this.currentRange_, null, evt.type)
553 .go(); 560 .go();
554 }, 561 },
555 562
556 /** 563 /**
557 * Provides all feedback once a value changed event fires. 564 * Provides all feedback once a value changed event fires.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 var start = text.getSpanStart(selectionSpan); 746 var start = text.getSpanStart(selectionSpan);
740 actionNode.setSelection(position - start, position - start); 747 actionNode.setSelection(position - start, position - start);
741 } 748 }
742 } 749 }
743 }; 750 };
744 751
745 /** @type {Background} */ 752 /** @type {Background} */
746 global.backgroundObj = new Background(); 753 global.backgroundObj = new Background();
747 754
748 }); // goog.scope 755 }); // 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