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

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: 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..ee27e7b42815a4107e62567f6af7d489b42b40f4 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -38,6 +38,21 @@ var Unit = cursors.Unit;
editing.TextEditHandler = function(node) {
/** @const {!AutomationNode} @private */
this.node_ = node;
+
+ // Braille translation changes depending on the input type of |node|.
+ var originalBrailleTable = localStorage['brailleTable'];
+ var originalBrailleTableType = localStorage['brailleTableType'];
+
+ if (node.inputType == 'email' || node.inputType == 'url') {
+ localStorage['brailleTable'] = localStorage['brailleTable8'];
dmazzoni 2017/04/10 22:47:33 Maybe I'm not understanding what's happening here,
David Tseng 2017/04/11 17:38:39 I extracted all code in refresh that relies upon l
+ localStorage['brailleTableType'] = 'brailleTable8';
+ window['braille_translator_manager'].refresh();
dmazzoni 2017/04/10 22:47:33 Why is this hack needed here, is this for Closure?
David Tseng 2017/04/11 17:38:39 Not really a hack since it's exported on window. U
+
+ // Restore previous values for when this handler becomes invalidated or the
+ // next time ChromeVox refreshes (e.g. on startup).
+ localStorage['brailleTable'] = originalBrailleTable;
+ localStorage['brailleTableType'] = originalBrailleTableType;
+ }
};
editing.TextEditHandler.prototype = {
@@ -47,6 +62,14 @@ editing.TextEditHandler.prototype = {
},
/**
+ * Invalidates this handler. A caller must invalidate this handler for it to
+ * properly reset any intermediate actions it took on behalf of a user.
+ */
+ invalidate: function() {
+ window['braille_translator_manager'].refresh();
+ },
+
+ /**
* Receives the following kinds of events when the node provided to the
* constructor is focuse: |focus|, |textChanged|, |textSelectionChanged| and
* |valueChanged|.

Powered by Google App Engine
This is Rietveld 408576698