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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return; | 134 return; |
135 | 135 |
136 // Discard focused root nodes without focused state set. | 136 // Discard focused root nodes without focused state set. |
137 if (!node.state.focused) | 137 if (!node.state.focused) |
138 return; | 138 return; |
139 | 139 |
140 // Try to find a focusable descendant. | 140 // Try to find a focusable descendant. |
141 node = node.find({state: {focused: true}}) || node; | 141 node = node.find({state: {focused: true}}) || node; |
142 } | 142 } |
143 | 143 |
144 if (this.isEditable_(evt.target)) | 144 if (this.isEditable_(node)) |
145 this.createEditableTextHandlerIfNeeded_(evt.target); | 145 this.createEditableTextHandlerIfNeeded_(node); |
146 | 146 |
147 this.onEventDefault({target: node, type: 'focus'}); | 147 // Since we queue output mostly for live regions support and there isn't a |
| 148 // reliable way to know if this focus event resulted from a user's explicit |
| 149 // action, only flush when the focused node is not web content. |
| 150 if (node.root.role == RoleType.desktop) |
| 151 Output.flushNextSpeechUtterance(); |
| 152 |
| 153 this.onEventDefault( |
| 154 {target: node, type: chrome.automation.EventType.focus}); |
148 }, | 155 }, |
149 | 156 |
150 /** | 157 /** |
151 * Provides all feedback once a load complete event fires. | 158 * Provides all feedback once a load complete event fires. |
152 * @param {Object} evt | 159 * @param {Object} evt |
153 */ | 160 */ |
154 onLoadComplete: function(evt) { | 161 onLoadComplete: function(evt) { |
155 ChromeVoxState.instance.refreshMode(evt.target.docUrl); | 162 ChromeVoxState.instance.refreshMode(evt.target.docUrl); |
156 | 163 |
157 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 164 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 if (cvox.ChromeVox.isMac) | 312 if (cvox.ChromeVox.isMac) |
306 return; | 313 return; |
307 chrome.automation.getDesktop(function(desktop) { | 314 chrome.automation.getDesktop(function(desktop) { |
308 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 315 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
309 }); | 316 }); |
310 }; | 317 }; |
311 | 318 |
312 DesktopAutomationHandler.init_(); | 319 DesktopAutomationHandler.init_(); |
313 | 320 |
314 }); // goog.scope | 321 }); // goog.scope |
OLD | NEW |