| 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 14 matching lines...) Expand all Loading... |
| 25 * @param {!AutomationNode} node | 25 * @param {!AutomationNode} node |
| 26 * @constructor | 26 * @constructor |
| 27 * @extends {BaseAutomationHandler} | 27 * @extends {BaseAutomationHandler} |
| 28 */ | 28 */ |
| 29 DesktopAutomationHandler = function(node) { | 29 DesktopAutomationHandler = function(node) { |
| 30 BaseAutomationHandler.call(this, node); | 30 BaseAutomationHandler.call(this, node); |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * The object that speaks changes to an editable text field. | 33 * The object that speaks changes to an editable text field. |
| 34 * @type {editing.TextEditHandler} | 34 * @type {editing.TextEditHandler} |
| 35 * @private |
| 35 */ | 36 */ |
| 36 this.textEditHandler_ = null; | 37 this.textEditHandler_ = null; |
| 37 | 38 |
| 38 /** | 39 /** |
| 39 * The last time we handled a value changed event. | 40 * The last time we handled a value changed event. |
| 40 * @type {!Date} | 41 * @type {!Date} |
| 41 * @private | 42 * @private |
| 42 */ | 43 */ |
| 43 this.lastValueChanged_ = new Date(0); | 44 this.lastValueChanged_ = new Date(0); |
| 44 | 45 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 * Provides all feedback once a change event in a text field fires. | 316 * Provides all feedback once a change event in a text field fires. |
| 316 * @param {!AutomationEvent} evt | 317 * @param {!AutomationEvent} evt |
| 317 * @private | 318 * @private |
| 318 */ | 319 */ |
| 319 onEditableChanged_: function(evt) { | 320 onEditableChanged_: function(evt) { |
| 320 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 321 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
| 321 if (evt.target.root.role != RoleType.desktop && | 322 if (evt.target.root.role != RoleType.desktop && |
| 322 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) | 323 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) |
| 323 return; | 324 return; |
| 324 | 325 |
| 325 if (!evt.target.state.focused) | 326 if (!evt.target.state.focused || |
| 327 (evt.target.root.role != RoleType.desktop && |
| 328 evt.target.root.parent && |
| 329 !evt.target.root.parent.state.focused)) |
| 326 return; | 330 return; |
| 327 | 331 |
| 328 if (!ChromeVoxState.instance.currentRange) { | 332 if (!ChromeVoxState.instance.currentRange) { |
| 329 this.onEventDefault(evt); | 333 this.onEventDefault(evt); |
| 330 ChromeVoxState.instance.setCurrentRange( | 334 ChromeVoxState.instance.setCurrentRange( |
| 331 cursors.Range.fromNode(evt.target)); | 335 cursors.Range.fromNode(evt.target)); |
| 332 } | 336 } |
| 333 | 337 |
| 334 this.createTextEditHandlerIfNeeded_(evt.target); | 338 this.createTextEditHandlerIfNeeded_(evt.target); |
| 335 | 339 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 DesktopAutomationHandler.init_ = function() { | 459 DesktopAutomationHandler.init_ = function() { |
| 456 chrome.automation.getDesktop(function(desktop) { | 460 chrome.automation.getDesktop(function(desktop) { |
| 457 ChromeVoxState.desktopAutomationHandler = | 461 ChromeVoxState.desktopAutomationHandler = |
| 458 new DesktopAutomationHandler(desktop); | 462 new DesktopAutomationHandler(desktop); |
| 459 }); | 463 }); |
| 460 }; | 464 }; |
| 461 | 465 |
| 462 DesktopAutomationHandler.init_(); | 466 DesktopAutomationHandler.init_(); |
| 463 | 467 |
| 464 }); // goog.scope | 468 }); // goog.scope |
| OLD | NEW |