| OLD | NEW |
| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 * Provides all feedback once a change event in a text field fires. | 324 * Provides all feedback once a change event in a text field fires. |
| 325 * @param {!AutomationEvent} evt | 325 * @param {!AutomationEvent} evt |
| 326 * @private | 326 * @private |
| 327 */ | 327 */ |
| 328 onEditableChanged_: function(evt) { | 328 onEditableChanged_: function(evt) { |
| 329 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 329 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
| 330 if (evt.target.root.role != RoleType.desktop && | 330 if (evt.target.root.role != RoleType.desktop && |
| 331 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) | 331 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) |
| 332 return; | 332 return; |
| 333 | 333 |
| 334 var topRoot = AutomationUtil.getTopLevelRoot(evt.target); |
| 334 if (!evt.target.state.focused || | 335 if (!evt.target.state.focused || |
| 335 (evt.target.root.role != RoleType.desktop && | 336 (topRoot && |
| 336 evt.target.root.parent && | 337 topRoot.parent && |
| 337 !evt.target.root.parent.state.focused)) | 338 !topRoot.parent.state.focused)) |
| 338 return; | 339 return; |
| 339 | 340 |
| 340 if (!ChromeVoxState.instance.currentRange) { | 341 if (!ChromeVoxState.instance.currentRange) { |
| 341 this.onEventDefault(evt); | 342 this.onEventDefault(evt); |
| 342 ChromeVoxState.instance.setCurrentRange( | 343 ChromeVoxState.instance.setCurrentRange( |
| 343 cursors.Range.fromNode(evt.target)); | 344 cursors.Range.fromNode(evt.target)); |
| 344 } | 345 } |
| 345 | 346 |
| 346 this.createTextEditHandlerIfNeeded_(evt.target); | 347 this.createTextEditHandlerIfNeeded_(evt.target); |
| 347 | 348 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 DesktopAutomationHandler.init_ = function() { | 468 DesktopAutomationHandler.init_ = function() { |
| 468 chrome.automation.getDesktop(function(desktop) { | 469 chrome.automation.getDesktop(function(desktop) { |
| 469 ChromeVoxState.desktopAutomationHandler = | 470 ChromeVoxState.desktopAutomationHandler = |
| 470 new DesktopAutomationHandler(desktop); | 471 new DesktopAutomationHandler(desktop); |
| 471 }); | 472 }); |
| 472 }; | 473 }; |
| 473 | 474 |
| 474 DesktopAutomationHandler.init_(); | 475 DesktopAutomationHandler.init_(); |
| 475 | 476 |
| 476 }); // goog.scope | 477 }); // goog.scope |
| OLD | NEW |