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

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

Issue 1019283003: Chromevox2: make sure the braille cursor is shown for empty text fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
index fd65f4b02db4563eadb8ac6bce258614c390a01f..ebe8659023fbab59088e6646d52aa82a58eff09c 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -331,19 +331,17 @@ Output.prototype = {
this.brailleBuffer_.getSpanInstanceOf(Output.SelectionSpan);
var startIndex = -1, endIndex = -1;
if (selSpan) {
- var valueStart = this.brailleBuffer_.getSpanStart(selSpan);
- var valueEnd = this.brailleBuffer_.getSpanEnd(selSpan);
- if (valueStart === undefined || valueEnd === undefined) {
- valueStart = -1;
- valueEnd = -1;
- } else {
- startIndex = valueStart + selSpan.startIndex;
- endIndex = valueStart + selSpan.endIndex;
- this.brailleBuffer_.setSpan(new cvox.ValueSpan(valueStart),
- valueStart, valueEnd);
- this.brailleBuffer_.setSpan(new cvox.ValueSelectionSpan(),
- startIndex, endIndex);
- }
+ // Casts ok, since the span is known to be in the spannable.
+ var valueStart =
+ /** @type {number} */ (this.brailleBuffer_.getSpanStart(selSpan));
+ var valueEnd =
+ /** @type {number} */ (this.brailleBuffer_.getSpanEnd(selSpan));
+ startIndex = valueStart + selSpan.startIndex;
+ endIndex = valueStart + selSpan.endIndex;
+ this.brailleBuffer_.setSpan(new cvox.ValueSpan(0),
+ valueStart, valueEnd);
+ this.brailleBuffer_.setSpan(new cvox.ValueSelectionSpan(),
+ startIndex, endIndex);
}
var output = new cvox.NavBraille({
@@ -432,7 +430,7 @@ Output.prototype = {
this.addToSpannable_(buff, node.role, options);
} else if (token == 'value') {
var text = node.attributes.value;
- if (text) {
+ if (text !== undefined) {
var offset = buff.getLength();
if (node.attributes.textSelStart !== undefined) {
options.annotation = new Output.SelectionSpan(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698