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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Provides output services for ChromeVox. 6 * @fileoverview Provides output services for ChromeVox.
7 */ 7 */
8 8
9 goog.provide('Output'); 9 goog.provide('Output');
10 goog.provide('Output.EventType'); 10 goog.provide('Output.EventType');
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 actions.forEach(function(a) { 324 actions.forEach(function(a) {
325 a.run(); 325 a.run();
326 }); 326 });
327 } 327 }
328 328
329 // Braille. 329 // Braille.
330 var selSpan = 330 var selSpan =
331 this.brailleBuffer_.getSpanInstanceOf(Output.SelectionSpan); 331 this.brailleBuffer_.getSpanInstanceOf(Output.SelectionSpan);
332 var startIndex = -1, endIndex = -1; 332 var startIndex = -1, endIndex = -1;
333 if (selSpan) { 333 if (selSpan) {
334 var valueStart = this.brailleBuffer_.getSpanStart(selSpan); 334 // Casts ok, since the span is known to be in the spannable.
335 var valueEnd = this.brailleBuffer_.getSpanEnd(selSpan); 335 var valueStart =
336 if (valueStart === undefined || valueEnd === undefined) { 336 /** @type {number} */ (this.brailleBuffer_.getSpanStart(selSpan));
337 valueStart = -1; 337 var valueEnd =
338 valueEnd = -1; 338 /** @type {number} */ (this.brailleBuffer_.getSpanEnd(selSpan));
339 } else { 339 startIndex = valueStart + selSpan.startIndex;
340 startIndex = valueStart + selSpan.startIndex; 340 endIndex = valueStart + selSpan.endIndex;
341 endIndex = valueStart + selSpan.endIndex; 341 this.brailleBuffer_.setSpan(new cvox.ValueSpan(0),
342 this.brailleBuffer_.setSpan(new cvox.ValueSpan(valueStart), 342 valueStart, valueEnd);
343 valueStart, valueEnd); 343 this.brailleBuffer_.setSpan(new cvox.ValueSelectionSpan(),
344 this.brailleBuffer_.setSpan(new cvox.ValueSelectionSpan(), 344 startIndex, endIndex);
345 startIndex, endIndex);
346 }
347 } 345 }
348 346
349 var output = new cvox.NavBraille({ 347 var output = new cvox.NavBraille({
350 text: this.brailleBuffer_, 348 text: this.brailleBuffer_,
351 startIndex: startIndex, 349 startIndex: startIndex,
352 endIndex: endIndex 350 endIndex: endIndex
353 }); 351 });
354 352
355 if (this.brailleBuffer_) 353 if (this.brailleBuffer_)
356 cvox.ChromeVox.braille.write(output); 354 cvox.ChromeVox.braille.write(output);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 return; 423 return;
426 424
427 // All possible tokens based on prefix. 425 // All possible tokens based on prefix.
428 if (prefix == '$') { 426 if (prefix == '$') {
429 options.annotation = token; 427 options.annotation = token;
430 if (token == 'role') { 428 if (token == 'role') {
431 // Non-localized role and state obtained by default. 429 // Non-localized role and state obtained by default.
432 this.addToSpannable_(buff, node.role, options); 430 this.addToSpannable_(buff, node.role, options);
433 } else if (token == 'value') { 431 } else if (token == 'value') {
434 var text = node.attributes.value; 432 var text = node.attributes.value;
435 if (text) { 433 if (text !== undefined) {
436 var offset = buff.getLength(); 434 var offset = buff.getLength();
437 if (node.attributes.textSelStart !== undefined) { 435 if (node.attributes.textSelStart !== undefined) {
438 options.annotation = new Output.SelectionSpan( 436 options.annotation = new Output.SelectionSpan(
439 node.attributes.textSelStart, 437 node.attributes.textSelStart,
440 node.attributes.textSelEnd); 438 node.attributes.textSelEnd);
441 } 439 }
442 } else if (node.role == chrome.automation.RoleType.staticText) { 440 } else if (node.role == chrome.automation.RoleType.staticText) {
443 // TODO(dtseng): Remove once Blink treats staticText values as 441 // TODO(dtseng): Remove once Blink treats staticText values as
444 // names. 442 // names.
445 text = node.attributes.name; 443 text = node.attributes.name;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 } 729 }
732 730
733 if (currentNode != root) 731 if (currentNode != root)
734 throw 'Unbalanced parenthesis.'; 732 throw 'Unbalanced parenthesis.';
735 733
736 return root; 734 return root;
737 } 735 }
738 }; 736 };
739 737
740 }); // goog.scope 738 }); // goog.scope
OLDNEW
« 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