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

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

Issue 2544203004: Display images in multiline Braille
Patch Set: set upstream to correct branch 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
index 4d6a4d7c3caa50e85d10293f86d0c48a679198b3..c238739a92159c4471f2e4798414278c3458b3ff 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
@@ -513,7 +513,9 @@ Panel.onUpdateBraille = function(data) {
}
var row1, row2;
+ // Number of rows already written.
rowCount = 0;
+ // Number of cells already written in this row.
var cellCount = cols;
for (var i = 0; i < groups.length; i++) {
if (cellCount == cols) {
@@ -543,32 +545,43 @@ Panel.onUpdateBraille = function(data) {
bottomCell.setAttribute('data-companionIDs', i + '-textCell');
bottomCell.className = 'unhighlighted-cell';
if (cellCount + groups[i][1].length > cols) {
- bottomCell.innerHTML = groups[i][1].substring(0, cols - cellCount);
- if (rowCount == rows)
- break;
- rowCount++;
- row1 = this.brailleTableElement_.insertRow(-1);
- if (sideBySide) {
- // Side by side.
- row2 = this.brailleTableElement2_.insertRow(-1);
- } else {
- // Interleaved.
- row2 = this.brailleTableElement_.insertRow(-1);
+ var brailleText = groups[i][1];
dmazzoni 2016/12/05 17:29:41 Are these changes for images or something else?
ultimatedbz 2016/12/05 19:32:01 These are for images. Before, if a group of braill
+ while (cellCount + brailleText.length > cols) {
+ // At this point we already have a bottomCell to fill, so fill it.
+ bottomCell.innerHTML = brailleText.substring(0, cols - cellCount);
+ // Update to see what we still have to fill.
+ brailleText = brailleText.substring(cols - cellCount);
+ // Make new row.
+ if (rowCount == rows)
+ break;
+ rowCount++;
+ row1 = this.brailleTableElement_.insertRow(-1);
+ if (sideBySide) {
+ // Side by side.
+ row2 = this.brailleTableElement2_.insertRow(-1);
+ } else {
+ // Interleaved.
+ row2 = this.brailleTableElement_.insertRow(-1);
+ }
+ var bottomCell2 = row2.insertCell(-1);
+ bottomCell2.id = i + '-brailleCell2';
+ bottomCell2.setAttribute('data-companionIDs',
+ i + '-textCell ' + i + '-brailleCell');
+ bottomCell.setAttribute('data-companionIDs',
+ bottomCell.getAttribute('data-companionIDs') +
+ ' ' + i + '-brailleCell2');
+ topCell.setAttribute('data-companionID2',
+ bottomCell.getAttribute('data-companionIDs') +
+ ' ' + i + '-brailleCell2');
+
+ bottomCell2.className = 'unhighlighted-cell';
+ bottomCell = bottomCell2;
+ cellCount = 0;
}
- var bottomCell2 = row2.insertCell(-1);
- bottomCell2.id = i + '-brailleCell2';
- bottomCell2.setAttribute('data-companionIDs',
- i + '-textCell ' + i + '-brailleCell');
- bottomCell.setAttribute('data-companionIDs',
- bottomCell.getAttribute('data-companionIDs') +
- ' ' + i + '-brailleCell2');
- topCell.setAttribute('data-companionID2',
- bottomCell.getAttribute('data-companionIDs') +
- ' ' + i + '-brailleCell2');
-
- bottomCell2.className = 'unhighlighted-cell';
- bottomCell2.innerHTML = groups[i][1].substring(cols - cellCount);
- cellCount = bottomCell2.innerHTML.length;
+ // Fill the rest.
+ bottomCell.innerHTML = brailleText;
+ cellCount = brailleText.length;
+
} else {
bottomCell.innerHTML = groups[i][1];
cellCount += groups[i][1].length;

Powered by Google App Engine
This is Rietveld 408576698