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

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

Issue 2813743002: Switch to selected 8-dot braille table in email and url text fields (Closed)
Patch Set: Fixes corner cases (liblouis callbacks sometimes drop when called quickly). Created 3 years, 8 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/editing.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
index e4bd58312b4268dcd0d7a081a0e1350efb10e6d0..43b60fa2e33a895665bba72defb95631aac1f16f 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -15,6 +15,7 @@ goog.require('Output');
goog.require('Output.EventType');
goog.require('cursors.Cursor');
goog.require('cursors.Range');
+goog.require('cvox.BrailleBackground');
goog.require('cvox.ChromeVoxEditableTextBase');
goog.scope(function() {
@@ -219,4 +220,35 @@ editing.TextEditHandler.createForNode = function(node) {
return null;
};
+/**
+ * An observer that reacts to ChromeVox range changes that modifies braille
+ * table output when over email or url text fields.
+ * @constructor
+ * @implements {ChromeVoxStateObserver}
+ */
+editing.EditingChromeVoxStateObserver = function() {
+ ChromeVoxState.addObserver(this);
+};
+
+editing.EditingChromeVoxStateObserver.prototype = {
+ __proto__: ChromeVoxStateObserver,
+
+ /** @override */
+ onCurrentRangeChanged: function(range) {
+ var inputType = range && range.start.node.inputType;
+ if (inputType == 'email' || inputType == 'url') {
+ cvox.BrailleBackground.getInstance().getTranslatorManager().refresh(
+ localStorage['brailleTable8']);
+ return;
+ }
+ cvox.BrailleBackground.getInstance().getTranslatorManager().refresh(
+ localStorage['brailleTable']);
+ }
+};
+
+/**
+ * @private {ChromeVoxStateObserver}
+ */
+editing.observer_ = new editing.EditingChromeVoxStateObserver();
+
});

Powered by Google App Engine
This is Rietveld 408576698