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

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

Issue 2544203004: Display images in multiline Braille
Patch Set: Rebased back onto Master 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 2469aebac6fbd661f7ee73068b92949c83fa5296..e94c581c18d570459cd5aaccb28fdd68a3d3681c 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
@@ -509,7 +509,10 @@ 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 (i % cols == 0) {
// Check if we reached the limit on the number of rows we can have.
@@ -537,6 +540,48 @@ Panel.onUpdateBraille = function(data) {
bottomCell.id = i + '-brailleCell';
bottomCell.setAttribute('companionID', i + '-textCell');
bottomCell.className = 'unhighlighted-cell';
+ if (cellCount + groups[i][1].length > cols) {
+ var brailleText = groups[i][1];
+ 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;
+ }
+ // 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