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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 /** | 230 /** |
231 * Provides all feedback once a value changed event fires. | 231 * Provides all feedback once a value changed event fires. |
232 * @param {Object} evt | 232 * @param {Object} evt |
233 */ | 233 */ |
234 onValueChanged: function(evt) { | 234 onValueChanged: function(evt) { |
235 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 235 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
236 if (evt.target.root.role != RoleType.desktop && | 236 if (evt.target.root.role != RoleType.desktop && |
237 global.backgroundObj.mode === ChromeVoxMode.CLASSIC) | 237 global.backgroundObj.mode === ChromeVoxMode.CLASSIC) |
238 return; | 238 return; |
239 | 239 |
240 if (!evt.target.state.focused) | |
241 return; | |
242 | |
243 // Value change events fire on web text fields and text areas when pressing | 240 // Value change events fire on web text fields and text areas when pressing |
244 // enter; suppress them. | 241 // enter; suppress them. |
245 if (!global.backgroundObj.currentRange || | 242 if (!global.backgroundObj.currentRange || |
246 evt.target.role != RoleType.textField) { | 243 evt.target.role != RoleType.textField) { |
247 this.onEventDefault(evt); | 244 var range = cursors.Range.fromNode(evt.target); |
248 global.backgroundObj.currentRange = cursors.Range.fromNode(evt.target); | 245 new Output().withSpeechAndBraille(range, range, evt.type) |
| 246 .go(); |
249 } | 247 } |
250 }, | 248 }, |
251 | 249 |
252 /** | 250 /** |
253 * Create an editable text handler for the given node if needed. | 251 * Create an editable text handler for the given node if needed. |
254 * @param {Object} node | 252 * @param {Object} node |
255 */ | 253 */ |
256 createEditableTextHandlerIfNeeded_: function(node) { | 254 createEditableTextHandlerIfNeeded_: function(node) { |
257 if (!this.editableTextHandler_ || | 255 if (!this.editableTextHandler_ || |
258 node != global.backgroundObj.currentRange.start.node) { | 256 node != global.backgroundObj.currentRange.start.node) { |
(...skipping 24 matching lines...) Expand all Loading... |
283 if (cvox.ChromeVox.isMac) | 281 if (cvox.ChromeVox.isMac) |
284 return; | 282 return; |
285 chrome.automation.getDesktop(function(desktop) { | 283 chrome.automation.getDesktop(function(desktop) { |
286 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 284 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
287 }); | 285 }); |
288 }; | 286 }; |
289 | 287 |
290 DesktopAutomationHandler.init_(); | 288 DesktopAutomationHandler.init_(); |
291 | 289 |
292 }); // goog.scope | 290 }); // goog.scope |
OLD | NEW |