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

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

Issue 2945103002: Don't process text changes when ChromeVox range is elsewhere (Closed)
Patch Set: Re-target node for text handler creation. Created 3 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
« 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Handles automation from a desktop automation node. 6 * @fileoverview Handles automation from a desktop automation node.
7 */ 7 */
8 8
9 goog.provide('DesktopAutomationHandler'); 9 goog.provide('DesktopAutomationHandler');
10 10
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (!evt.target.state.focused || 408 if (!evt.target.state.focused ||
409 (topRoot && topRoot.parent && !topRoot.parent.state.focused)) 409 (topRoot && topRoot.parent && !topRoot.parent.state.focused))
410 return; 410 return;
411 411
412 if (!ChromeVoxState.instance.currentRange) { 412 if (!ChromeVoxState.instance.currentRange) {
413 this.onEventDefault(evt); 413 this.onEventDefault(evt);
414 ChromeVoxState.instance.setCurrentRange( 414 ChromeVoxState.instance.setCurrentRange(
415 cursors.Range.fromNode(evt.target)); 415 cursors.Range.fromNode(evt.target));
416 } 416 }
417 417
418 this.createTextEditHandlerIfNeeded_(evt.target); 418 // Re-target the node to the root of the editable.
419 var target = evt.target;
420 while (target.parent && target.parent.state.editable)
421 target = target.parent;
422 var voxTarget = ChromeVoxState.instance.currentRange.start.node;
423 while (voxTarget && voxTarget.parent && voxTarget.parent.state.editable)
424 voxTarget = voxTarget.parent;
425
426 // It is possible that ChromeVox has range over some other node
427 // when a text field is focused.
428 if (!target.state.focused || target != voxTarget)
429 return;
430
431 this.createTextEditHandlerIfNeeded_(target);
419 432
420 // Sync the ChromeVox range to the editable, if a selection exists. 433 // Sync the ChromeVox range to the editable, if a selection exists.
421 var anchorObject = evt.target.root.anchorObject; 434 var anchorObject = evt.target.root.anchorObject;
422 var anchorOffset = evt.target.root.anchorOffset || 0; 435 var anchorOffset = evt.target.root.anchorOffset || 0;
423 var focusObject = evt.target.root.focusObject; 436 var focusObject = evt.target.root.focusObject;
424 var focusOffset = evt.target.root.focusOffset || 0; 437 var focusOffset = evt.target.root.focusOffset || 0;
425 if (anchorObject && focusObject) { 438 if (anchorObject && focusObject) {
426 var selectedRange = new cursors.Range( 439 var selectedRange = new cursors.Range(
427 new cursors.WrappingCursor(anchorObject, anchorOffset), 440 new cursors.WrappingCursor(anchorObject, anchorOffset),
428 new cursors.WrappingCursor(focusObject, focusOffset)); 441 new cursors.WrappingCursor(focusObject, focusOffset));
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 DesktopAutomationHandler.init_ = function() { 579 DesktopAutomationHandler.init_ = function() {
567 chrome.automation.getDesktop(function(desktop) { 580 chrome.automation.getDesktop(function(desktop) {
568 ChromeVoxState.desktopAutomationHandler = 581 ChromeVoxState.desktopAutomationHandler =
569 new DesktopAutomationHandler(desktop); 582 new DesktopAutomationHandler(desktop);
570 }); 583 });
571 }; 584 };
572 585
573 DesktopAutomationHandler.init_(); 586 DesktopAutomationHandler.init_();
574 587
575 }); // goog.scope 588 }); // 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