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

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

Issue 743273002: Various changes required to support ChromeVox Next to read Views and Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 6 years, 1 month 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/background.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
index 27b173d0fe216eaed357c6d1c6b25a307dd96f7f..65d50b534af82e8506453239fb51244b62b86c7a 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -89,7 +89,9 @@ Background = function() {
menuStart: this.onEventDefault,
menuEnd: this.onEventDefault,
loadComplete: this.onLoadComplete,
- textSelectionChanged: this.onTextSelectionChanged
+ textChanged: this.onTextOrTextSelectionChanged,
+ textSelectionChanged: this.onTextOrTextSelectionChanged,
+ valueChanged: this.onEventDefault
};
// Register listeners for ...
@@ -98,9 +100,6 @@ Background = function() {
// Tabs.
chrome.tabs.onUpdated.addListener(this.onTabUpdated);
-
- // Commands.
- chrome.commands.onCommand.addListener(this.onGotCommand);
};
Background.prototype = {
@@ -244,6 +243,12 @@ Background.prototype = {
var prevRange = this.currentRange_;
this.currentRange_ = cursors.Range.fromNode(node);
+
+ // Don't process nodes inside of web content if ChromeVox Next is inactive.
+ if (node.root.role == chrome.automation.RoleType.rootWebArea &&
+ !this.active_)
+ return;
+
new Output(this.currentRange_, prevRange, evt.type);
},
@@ -266,7 +271,7 @@ Background.prototype = {
* Provides all feedback once a text selection change event fires.
* @param {Object} evt
*/
- onTextSelectionChanged: function(evt) {
+ onTextOrTextSelectionChanged: function(evt) {
if (!this.currentRange_)
this.currentRange_ = cursors.Range.fromNode(evt.target);
@@ -287,6 +292,7 @@ Background.prototype = {
}
this.editableTextHandler.changed(textChangeEvent);
+ new Output(this.currentRange_, null, evt.type, {braille: true});
},
/**
@@ -323,9 +329,15 @@ Background.prototype = {
}
if (opt_options.next) {
+ if (!chrome.commands.onCommand.hasListener(this.onGotCommand))
+ chrome.commands.onCommand.addListener(this.onGotCommand);
+
chrome.automation.getTree(this.onGotTree);
this.active_ = true;
} else {
+ if (chrome.commands.onCommand.hasListener(this.onGotCommand))
+ chrome.commands.onCommand.removeListener(this.onGotCommand);
+
if (this.active_) {
for (var eventType in this.listeners_) {
this.currentRange_.getStart().getNode().root.removeEventListener(

Powered by Google App Engine
This is Rietveld 408576698