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

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

Issue 2462483002: Support multi-line braille in the virtual braille display. (Closed)
Patch Set: Created 4 years, 1 month 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 27 matching lines...) Expand all
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.brailleTableElement_ = $('braille-table'); 47 this.brailleTableElement_ = $('braille-table');
48 this.brailleTableElement2_ = $('braille-table2');
48 49
49 /** 50 /**
50 * The array of top-level menus. 51 * The array of top-level menus.
51 * @type {!Array<PanelMenu>} 52 * @type {!Array<PanelMenu>}
52 * @private 53 * @private
53 */ 54 */
54 this.menus_ = []; 55 this.menus_ = [];
55 56
56 /** 57 /**
57 * The currently active menu, if any. 58 * The currently active menu, if any.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 '</span>'; 179 '</span>';
179 break; 180 break;
180 case PanelCommandType.ADD_ANNOTATION_SPEECH: 181 case PanelCommandType.ADD_ANNOTATION_SPEECH:
181 if (this.speechElement_.innerHTML != '') { 182 if (this.speechElement_.innerHTML != '') {
182 this.speechElement_.innerHTML += '&nbsp;&nbsp;'; 183 this.speechElement_.innerHTML += '&nbsp;&nbsp;';
183 } 184 }
184 this.speechElement_.innerHTML += escapeForHtml(command.data); 185 this.speechElement_.innerHTML += escapeForHtml(command.data);
185 break; 186 break;
186 case PanelCommandType.UPDATE_BRAILLE: 187 case PanelCommandType.UPDATE_BRAILLE:
187 var groups = command.data.groups; 188 var groups = command.data.groups;
188 this.brailleTableElement_.deleteRow(0); 189 var cols = parseInt(localStorage['virtualBrailleColumns'], 10);
dmazzoni 2016/10/28 06:19:29 Since this is more than a few lines of code I thin
ultimatedbz 2016/10/28 18:45:35 Done.
189 this.brailleTableElement_.deleteRow(0); 190 var rows = parseInt(localStorage['virtualBrailleRows'], 10);
190 var row1 = this.brailleTableElement_.insertRow(-1); 191 var sideBySide = localStorage['brailleSideBySide'] === 'true';
191 var row2 = this.brailleTableElement_.insertRow(-1);
192 192
193 var addBorders = function(event) {
194 var cell = event.target;
195 if (cell.tagName == 'TD') {
196 cell.style.border = '1px solid white';
dmazzoni 2016/10/28 06:19:29 Use cell.addClass or cell.removeClass, and then ha
ultimatedbz 2016/10/28 18:45:35 I had to use cell.className = '[className]'; Thank
197 var companionID = cell.getAttribute('companionID');
198 var companion = $(companionID);
199 companion.style.border = '1px solid white';
200
201 }
202 };
203
204 var removeBorders = function(event) {
205 var cell = event.target;
206 if (cell.tagName == 'TD') {
207 cell.style.border = '1px solid black';
208 var companionID = cell.getAttribute('companionID');
209 var companion = $(companionID);
210 companion.style.border = '1px solid black';
211 }
212 };
213
214 this.brailleTableElement_.addEventListener('mouseover', addBorders);
dmazzoni 2016/10/28 06:19:30 Not a big deal, but is there an element that's a p
ultimatedbz 2016/10/28 18:45:35 Yes, I added the eventListener to brailleContainer
215 this.brailleTableElement_.addEventListener('mouseout', removeBorders);
216
dmazzoni 2016/10/28 06:19:29 Remove extra blank line
ultimatedbz 2016/10/28 18:45:35 Done.
217
218 this.brailleTableElement2_.addEventListener('mouseover', addBorders);
219 this.brailleTableElement2_.addEventListener('mouseout', removeBorders);
220
221 // Clear the tables.
222 var rowCount = this.brailleTableElement_.rows.length;
223 for (var i = 0; i < rowCount; i++) {
224 this.brailleTableElement_.deleteRow(0);
225 }
226 rowCount = this.brailleTableElement2_.rows.length;
227 for (var i = 0; i < rowCount; i++) {
228 this.brailleTableElement2_.deleteRow(0);
229 }
230
231 var row1, row2;
232 rowCount = 0;
193 for (var i = 0; i < groups.length; i++) { 233 for (var i = 0; i < groups.length; i++) {
234 if (i % cols == 0) {
235 // Check if we reached the limit on the number of rows we can have.
236 if (rowCount == rows)
237 break;
238 rowCount++;
239 row1 = this.brailleTableElement_.insertRow(-1);
240 if (sideBySide) {
241 // Side by side.
242 row2 = this.brailleTableElement2_.insertRow(-1);
243 } else {
244 // Interleaved.
245 row2 = this.brailleTableElement_.insertRow(-1);
246 }
247 }
248
194 var topCell = row1.insertCell(-1); 249 var topCell = row1.insertCell(-1);
250 topCell.innerHTML = groups[i][0];
251 topCell.id = i + '-textCell';
252 topCell.setAttribute('companionID', i + '-brailleCell');
253 topCell.style.fontSize = '85%';
dmazzoni 2016/10/28 06:19:30 Use panel.css for this
ultimatedbz 2016/10/28 18:45:35 Do we still want to show regular letters at size '
254
195 var bottomCell = row2.insertCell(-1); 255 var bottomCell = row2.insertCell(-1);
196 topCell.innerHTML = groups[i][0];
197 bottomCell.innerHTML = groups[i][1]; 256 bottomCell.innerHTML = groups[i][1];
257 bottomCell.id = i + '-brailleCell';
258 bottomCell.setAttribute('companionID', i + '-textCell');
198 } 259 }
199 260
200 break; 261 break;
201 case PanelCommandType.ENABLE_MENUS: 262 case PanelCommandType.ENABLE_MENUS:
202 Panel.onEnableMenus(); 263 Panel.onEnableMenus();
203 break; 264 break;
204 case PanelCommandType.DISABLE_MENUS: 265 case PanelCommandType.DISABLE_MENUS:
205 Panel.onDisableMenus(); 266 Panel.onDisableMenus();
206 break; 267 break;
207 case PanelCommandType.OPEN_MENUS: 268 case PanelCommandType.OPEN_MENUS:
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 }, false); 762 }, false);
702 763
703 window.addEventListener('hashchange', function() { 764 window.addEventListener('hashchange', function() {
704 if (location.hash == '#fullscreen' || location.hash == '#focus') { 765 if (location.hash == '#fullscreen' || location.hash == '#focus') {
705 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; 766 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn;
706 cvox.ChromeVox.isStickyPrefOn = false; 767 cvox.ChromeVox.isStickyPrefOn = false;
707 } else { 768 } else {
708 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; 769 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_;
709 } 770 }
710 }, false); 771 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698