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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js

Issue 2362673004: Aligns text to braille in chromevox. (Closed)
Patch Set: Addressed code reviews. Extracted grouping algorithm into a helper method. Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 The ChromeVox panel and menus. 6 * @fileoverview The ChromeVox panel and menus.
7 */ 7 */
8 8
9 goog.provide('Panel'); 9 goog.provide('Panel');
10 10
(...skipping 26 matching lines...) Expand all
37 /** @type {Element} @private */ 37 /** @type {Element} @private */
38 this.brailleContainer_ = $('braille-container'); 38 this.brailleContainer_ = $('braille-container');
39 39
40 /** @type {Element} @private */ 40 /** @type {Element} @private */
41 this.searchContainer_ = $('search-container'); 41 this.searchContainer_ = $('search-container');
42 42
43 /** @type {Element} @private */ 43 /** @type {Element} @private */
44 this.searchInput_ = $('search'); 44 this.searchInput_ = $('search');
45 45
46 /** @type {Element} @private */ 46 /** @type {Element} @private */
47 this.brailleTextElement_ = $('braille-text'); 47 this.brailleTableElement_ = $('braille-table');
48
49 /** @type {Element} @private */
50 this.brailleCellsElement_ = $('braille-cells');
51 48
52 /** 49 /**
53 * The array of top-level menus. 50 * The array of top-level menus.
54 * @type {!Array<PanelMenu>} 51 * @type {!Array<PanelMenu>}
55 * @private 52 * @private
56 */ 53 */
57 this.menus_ = []; 54 this.menus_ = [];
58 55
59 /** 56 /**
60 * The currently active menu, if any. 57 * The currently active menu, if any.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 escapeForHtml(command.data) + 177 escapeForHtml(command.data) +
181 '</span>'; 178 '</span>';
182 break; 179 break;
183 case PanelCommandType.ADD_ANNOTATION_SPEECH: 180 case PanelCommandType.ADD_ANNOTATION_SPEECH:
184 if (this.speechElement_.innerHTML != '') { 181 if (this.speechElement_.innerHTML != '') {
185 this.speechElement_.innerHTML += '&nbsp;&nbsp;'; 182 this.speechElement_.innerHTML += '&nbsp;&nbsp;';
186 } 183 }
187 this.speechElement_.innerHTML += escapeForHtml(command.data); 184 this.speechElement_.innerHTML += escapeForHtml(command.data);
188 break; 185 break;
189 case PanelCommandType.UPDATE_BRAILLE: 186 case PanelCommandType.UPDATE_BRAILLE:
190 this.brailleTextElement_.textContent = command.data.text; 187 var groups = command.data.groups;
191 this.brailleCellsElement_.textContent = command.data.braille; 188 this.brailleTableElement_.deleteRow(0);
189 this.brailleTableElement_.deleteRow(0);
190 var row1 = this.brailleTableElement_.insertRow(-1);
191 var row2 = this.brailleTableElement_.insertRow(-1);
192
193 for (var i = 0; i < groups.length; i++) {
194 var topCell = row1.insertCell(-1);
195 var bottomCell = row2.insertCell(-1);
196 topCell.innerHTML = groups[i][0];
197 bottomCell.innerHTML = groups[i][1];
198 }
199
192 break; 200 break;
193 case PanelCommandType.ENABLE_MENUS: 201 case PanelCommandType.ENABLE_MENUS:
194 Panel.onEnableMenus(); 202 Panel.onEnableMenus();
195 break; 203 break;
196 case PanelCommandType.DISABLE_MENUS: 204 case PanelCommandType.DISABLE_MENUS:
197 Panel.onDisableMenus(); 205 Panel.onDisableMenus();
198 break; 206 break;
199 case PanelCommandType.OPEN_MENUS: 207 case PanelCommandType.OPEN_MENUS:
200 Panel.onOpenMenus(undefined, command.data); 208 Panel.onOpenMenus(undefined, command.data);
201 break; 209 break;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 }, false); 656 }, false);
649 657
650 window.addEventListener('hashchange', function() { 658 window.addEventListener('hashchange', function() {
651 if (location.hash == '#fullscreen' || location.hash == '#focus') { 659 if (location.hash == '#fullscreen' || location.hash == '#focus') {
652 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; 660 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn;
653 cvox.ChromeVox.isStickyPrefOn = false; 661 cvox.ChromeVox.isStickyPrefOn = false;
654 } else { 662 } else {
655 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; 663 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_;
656 } 664 }
657 }, false); 665 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698