Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(964)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js

Issue 2008773002: Begin using ChromeVox Next to read tab and window titles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a bunch of tests. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
index 10a137fa37173347b357f008b890a62f4bc090f6..ba484eac0227a89c992c25a26567c1df8a9a7970 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js
@@ -53,7 +53,7 @@ DesktopAutomationHandler = function(node) {
this.addListener_(e.menuListItemSelected, this.onEventIfSelected);
this.addListener_(e.menuStart, this.onMenuStart);
this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged);
- this.addListener_(e.selection, this.onEventWithFlushedOutput);
+ this.addListener_(e.selection, this.onSelection);
this.addListener_(e.textChanged, this.onTextChanged);
this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged);
this.addListener_(e.valueChanged, this.onValueChanged);
@@ -228,8 +228,8 @@ DesktopAutomationHandler.prototype = {
ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC)
return;
- chrome.automation.getFocus((function(focus) {
- if (!focus)
+ chrome.automation.getFocus(function(focus) {
+ if (!focus || !AutomationUtil.isDescendantOf(focus, evt.target))
return;
// If initial focus was already placed on this page (e.g. if a user starts
@@ -242,11 +242,10 @@ DesktopAutomationHandler.prototype = {
ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(focus));
new Output().withRichSpeechAndBraille(
ChromeVoxState.instance.currentRange, null, evt.type).go();
- }).bind(this));
+ }.bind(this));
},
-
- /**
+ /**
* Provides all feedback once a text changed event fires.
* @param {!AutomationEvent} evt
*/
@@ -337,6 +336,20 @@ DesktopAutomationHandler.prototype = {
},
/**
+ * @param {!AutomationEvent} evt
+ */
+ onSelection: function(evt) {
+ chrome.automation.getFocus(function(focus) {
+ // Some cases (e.g. in overview mode), require overriding the assumption
+ // that focus is an ancestor of a selection target.
+ var override =
+ evt.target.root == focus.root && focus.root.role == RoleType.desktop;
+ if (override || AutomationUtil.isDescendantOf(evt.target, focus))
+ this.onEventDefault(evt);
+ }.bind(this));
+ },
+
+ /**
* Provides all feedback once a menu start event fires.
* @param {!AutomationEvent} evt
*/

Powered by Google App Engine
This is Rietveld 408576698