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

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

Issue 1318683002: Make cvox2 feedback more robust when focusing a text field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_feedback
Patch Set: Address feedback from plundblad Created 5 years, 4 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/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 ebf1edca6e2e73fd595ca8137fce54584440b7d6..8bdf42b41fa5b5a2eca2584157bf897dc1e2320b 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -90,6 +90,12 @@ Background = function() {
valueChanged: this.onValueChanged
};
+ /**
+ * The object that speaks changes to an editable text field.
+ * @type {?cvox.ChromeVoxEditableTextBase}
+ */
+ this.editableTextHandler_ = null;
+
chrome.automation.getDesktop(this.onGotDesktop);
// Handle messages directed to the Next background page.
@@ -469,6 +475,10 @@ Background.prototype = {
AutomationPredicate.leaf);
}
}
+
+ if (evt.target.role == RoleType.textField)
Peter Lundblad 2015/08/26 18:42:37 Should we have an else here where we clear the edi
+ this.createEditableTextHandlerIfNeeded_(evt.target);
+
this.onEventDefault({target: node, type: 'focus'});
},
@@ -531,23 +541,13 @@ Background.prototype = {
this.currentRange_ = cursors.Range.fromNode(evt.target);
}
+ this.createEditableTextHandlerIfNeeded_(evt.target);
var textChangeEvent = new cvox.TextChangeEvent(
evt.target.value,
evt.target.textSelStart,
evt.target.textSelEnd,
true); // triggered by user
- if (!this.editableTextHandler ||
- evt.target != this.currentRange_.start.node) {
- this.editableTextHandler =
- new cvox.ChromeVoxEditableTextBase(
- textChangeEvent.value,
- textChangeEvent.start,
- textChangeEvent.end,
- evt.target.state['protected'],
- cvox.ChromeVox.tts);
- }
-
- this.editableTextHandler.changed(textChangeEvent);
+ this.editableTextHandler_.changed(textChangeEvent);
new Output().withBraille(
this.currentRange_, null, evt.type)
.go();
@@ -739,6 +739,22 @@ Background.prototype = {
var start = text.getSpanStart(selectionSpan);
actionNode.setSelection(position - start, position - start);
}
+ },
+
+ /**
+ * Create an editable text handler for the given node if needed.
+ * @param {Object} node
Peter Lundblad 2015/08/26 18:42:37 chrome.automation.AutomationNode instead of Object
+ */
Peter Lundblad 2015/08/26 18:42:37 @private
+ createEditableTextHandlerIfNeeded_: function(node) {
+ if (!this.editableTextHandler_ || node != this.currentRange_.start.node) {
+ this.editableTextHandler_ =
+ new cvox.ChromeVoxEditableTextBase(
+ node.value,
+ node.textSelStart,
+ node.textSelEnd,
+ node.state.protected,
+ cvox.ChromeVox.tts);
+ }
}
};

Powered by Google App Engine
This is Rietveld 408576698