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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 onScrollPositionChanged: function(evt) { | 421 onScrollPositionChanged: function(evt) { |
422 var currentRange = ChromeVoxState.instance.currentRange; | 422 var currentRange = ChromeVoxState.instance.currentRange; |
423 if (currentRange && currentRange.isValid() && this.shouldOutput_(evt)) | 423 if (currentRange && currentRange.isValid() && this.shouldOutput_(evt)) |
424 new Output().withLocation(currentRange, null, evt.type).go(); | 424 new Output().withLocation(currentRange, null, evt.type).go(); |
425 }, | 425 }, |
426 | 426 |
427 /** | 427 /** |
428 * @param {!AutomationEvent} evt | 428 * @param {!AutomationEvent} evt |
429 */ | 429 */ |
430 onSelection: function(evt) { | 430 onSelection: function(evt) { |
| 431 // Invalidate any previous editable text handler state since some nodes, |
| 432 // like menuitems, can receive selection while focus remains on an editable |
| 433 // leading to braille output routing to the editable. |
| 434 this.textEditHandler_ = null; |
| 435 |
431 chrome.automation.getFocus(function(focus) { | 436 chrome.automation.getFocus(function(focus) { |
432 // Desktop tabs get "selection" when there's a focused webview during tab | 437 // Desktop tabs get "selection" when there's a focused webview during tab |
433 // switching. | 438 // switching. |
434 if (focus.role == RoleType.webView && evt.target.role == RoleType.tab) { | 439 if (focus.role == RoleType.webView && evt.target.role == RoleType.tab) { |
435 ChromeVoxState.instance.setCurrentRange( | 440 ChromeVoxState.instance.setCurrentRange( |
436 cursors.Range.fromNode(focus.firstChild)); | 441 cursors.Range.fromNode(focus.firstChild)); |
437 return; | 442 return; |
438 } | 443 } |
439 | 444 |
440 // Some cases (e.g. in overview mode), require overriding the assumption | 445 // Some cases (e.g. in overview mode), require overriding the assumption |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 DesktopAutomationHandler.init_ = function() { | 513 DesktopAutomationHandler.init_ = function() { |
509 chrome.automation.getDesktop(function(desktop) { | 514 chrome.automation.getDesktop(function(desktop) { |
510 ChromeVoxState.desktopAutomationHandler = | 515 ChromeVoxState.desktopAutomationHandler = |
511 new DesktopAutomationHandler(desktop); | 516 new DesktopAutomationHandler(desktop); |
512 }); | 517 }); |
513 }; | 518 }; |
514 | 519 |
515 DesktopAutomationHandler.init_(); | 520 DesktopAutomationHandler.init_(); |
516 | 521 |
517 }); // goog.scope | 522 }); // goog.scope |
OLD | NEW |