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

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

Issue 2601333002: Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Rebase Created 3 years, 11 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 ee6e1d28c8b7adef7ed1b5fa4480a4880401bc6b..e4bd58312b4268dcd0d7a081a0e1350efb10e6d0 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -25,6 +25,7 @@ var Dir = AutomationUtil.Dir;
var EventType = chrome.automation.EventType;
var Range = cursors.Range;
var RoleType = chrome.automation.RoleType;
+var StateType = chrome.automation.StateType;
var Movement = cursors.Movement;
var Unit = cursors.Unit;
@@ -51,7 +52,7 @@ editing.TextEditHandler.prototype = {
* |valueChanged|.
* An implementation of this method should emit the appropritate braille and
* spoken feedback for the event.
- * @param {!AutomationEvent} evt
+ * @param {!(AutomationEvent|CustomAutomationEvent)} evt
*/
onEvent: goog.abstractMethod,
};
@@ -73,10 +74,10 @@ TextFieldTextEditHandler.prototype = {
/** @override */
onEvent: function(evt) {
- if (evt.type !== EventType.textChanged &&
- evt.type !== EventType.textSelectionChanged &&
- evt.type !== EventType.valueChanged &&
- evt.type !== EventType.focus)
+ if (evt.type !== EventType.TEXT_CHANGED &&
+ evt.type !== EventType.TEXT_SELECTION_CHANGED &&
+ evt.type !== EventType.VALUE_CHANGED &&
+ evt.type !== EventType.FOCUS)
return;
if (!evt.target.state.focused ||
!evt.target.state.editable ||
@@ -101,13 +102,13 @@ function AutomationEditableText(node) {
var end = node.textSelEnd;
cvox.ChromeVoxEditableTextBase.call(
this,
- node.value,
+ node.value || '',
Math.min(start, end),
Math.max(start, end),
- node.state.protected /**password*/,
+ node.state[StateType.PROTECTED] /**password*/,
cvox.ChromeVox.tts);
/** @override */
- this.multiline = node.state.multiline || false;
+ this.multiline = node.state[StateType.MULTILINE] || false;
/** @type {!AutomationNode} @private */
this.node_ = node;
/** @type {Array<number>} @private */
@@ -121,15 +122,15 @@ AutomationEditableText.prototype = {
* Called when the text field has been updated.
*/
onUpdate: function() {
- var newValue = this.node_.value;
+ var newValue = this.node_.value || '';
if (this.value != newValue)
this.lineBreaks_ = [];
var textChangeEvent = new cvox.TextChangeEvent(
newValue,
- this.node_.textSelStart,
- this.node_.textSelEnd,
+ this.node_.textSelStart || 0,
+ this.node_.textSelEnd || 0,
true /* triggered by user */);
this.changed(textChangeEvent);
this.outputBraille_();
@@ -207,7 +208,7 @@ editing.TextEditHandler.createForNode = function(node) {
var testNode = node;
do {
- if (testNode.state.focused && testNode.state.editable)
+ if (testNode.state[StateType.FOCUSED] && testNode.state[StateType.EDITABLE])
rootFocusedEditable = testNode;
testNode = testNode.parent;
} while (testNode);

Powered by Google App Engine
This is Rietveld 408576698