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

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

Issue 2544203004: Display images in multiline Braille
Patch Set: Addressed Comments Created 4 years 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 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 /** @fileoverview If the braille captions feature is enabled, sends 5 /** @fileoverview If the braille captions feature is enabled, sends
6 * braille content to the Panel on Chrome OS, or a content script on 6 * braille content to the Panel on Chrome OS, or a content script on
7 * other platforms. 7 * other platforms.
8 */ 8 */
9 9
10 goog.provide('cvox.BrailleCaptionsBackground'); 10 goog.provide('cvox.BrailleCaptionsBackground');
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } else { 83 } else {
84 cvox.ExtensionBridge.send({ 84 cvox.ExtensionBridge.send({
85 message: 'BRAILLE_CAPTION', 85 message: 'BRAILLE_CAPTION',
86 text: text, 86 text: text,
87 brailleChars: brailleChars 87 brailleChars: brailleChars
88 }); 88 });
89 } 89 }
90 }; 90 };
91 91
92 /** 92 /**
93 * @param {ArrayBuffer} cells Braille cells shown on the display.
94 * @param {number} rows Number of rows to display.
95 * @param {number} columns Number of columns to display.
96 */
97 cvox.BrailleCaptionsBackground.setImageContent = function(cells, rows,
98 columns) {
99 var self = cvox.BrailleCaptionsBackground;
100 // Convert the cells to Unicode braille pattern characters.
101 var byteBuf = new Uint8Array(cells);
102 var brailleChars = '';
103
104 for (var i = 0; i < byteBuf.length; ++i) {
105 brailleChars += String.fromCharCode(
106 self.BRAILLE_UNICODE_BLOCK_START | byteBuf[i]);
107 }
108
109 var groups = [['Image', brailleChars]];
110 var data = {groups: groups, rows: rows, cols: columns};
111 (new PanelCommand(PanelCommandType.UPDATE_BRAILLE, data)).send();
112 };
113
114
115
116
117 /**
93 * @param {string} brailleChars Braille characters shown on the display. 118 * @param {string} brailleChars Braille characters shown on the display.
94 * @param {string} text Text of the shown braille. 119 * @param {string} text Text of the shown braille.
95 * @param {Array<number>} brailleToText Map of Braille cells to the first 120 * @param {Array<number>} brailleToText Map of Braille cells to the first
96 * index of corresponding text letter. 121 * index of corresponding text letter.
97 * @param {{brailleOffset: number, textOffset: number}} offsets 122 * @param {{brailleOffset: number, textOffset: number}} offsets
98 * Offsets to use for caculating indices. The element is the braille offset, 123 * Offsets to use for caculating indices. The element is the braille offset,
99 * the second is the text offset. 124 * the second is the text offset.
100 * @return {Array} The groups of braille and texts to be displayed. 125 * @return {Array} The groups of braille and texts to be displayed.
101 */ 126 */
102 cvox.BrailleCaptionsBackground.groupBrailleAndText = function(brailleChars, 127 cvox.BrailleCaptionsBackground.groupBrailleAndText = function(brailleChars,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 cvox.BrailleCaptionsBackground.getVirtualDisplayState = function() { 182 cvox.BrailleCaptionsBackground.getVirtualDisplayState = function() {
158 var self = cvox.BrailleCaptionsBackground; 183 var self = cvox.BrailleCaptionsBackground;
159 if (self.isEnabled()) { 184 if (self.isEnabled()) {
160 var rows = parseInt(localStorage['virtualBrailleRows'], 10) || 1; 185 var rows = parseInt(localStorage['virtualBrailleRows'], 10) || 1;
161 var columns = parseInt(localStorage['virtualBrailleColumns'], 10) || 40; 186 var columns = parseInt(localStorage['virtualBrailleColumns'], 10) || 40;
162 return {available: true, textRowCount: rows, textColumnCount: columns}; 187 return {available: true, textRowCount: rows, textColumnCount: columns};
163 } else { 188 } else {
164 return {available: false}; 189 return {available: false};
165 } 190 }
166 }; 191 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698