Chromium Code Reviews| 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..047109f3f9ca7f493b0d953d4ea68958f1516c5d 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js |
| @@ -482,6 +482,13 @@ Panel.onUpdateBraille = function(data) { |
| var companionID = cell.getAttribute('companionID'); |
| var companion = $(companionID); |
| companion.className = 'highlighted-cell'; |
| + |
| + // If the cell has companionID2, then highlight it |
| + var companionID2 = cell.getAttribute('companionID2'); |
|
dmazzoni
2016/11/14 21:37:37
Rather than two attributes, how about a single att
ultimatedbz
2016/11/15 18:04:02
That's a great idea! I also heard that attributes
|
| + if (companionID2 != undefined) { |
| + var companion2 = $(companionID2); |
| + companion2.className = 'highlighted-cell'; |
| + } |
| } |
| }; |
| @@ -492,6 +499,13 @@ Panel.onUpdateBraille = function(data) { |
| var companionID = cell.getAttribute('companionID'); |
| var companion = $(companionID); |
| companion.className = 'unhighlighted-cell'; |
| + |
| + // If the cell has companionID2, then highlight it |
| + var companionID2 = cell.getAttribute('companionID2'); |
| + if (companionID2 != undefined) { |
| + var companion2 = $(companionID2); |
| + companion2.className = 'unhighlighted-cell'; |
| + } |
| } |
| }; |
| @@ -510,8 +524,10 @@ Panel.onUpdateBraille = function(data) { |
| var row1, row2; |
| rowCount = 0; |
| + var cellCount = cols; |
| for (var i = 0; i < groups.length; i++) { |
| - if (i % cols == 0) { |
| + if (cellCount == cols) { |
| + cellCount = 0; |
| // Check if we reached the limit on the number of rows we can have. |
| if (rowCount == rows) |
| break; |
| @@ -533,10 +549,36 @@ Panel.onUpdateBraille = function(data) { |
| topCell.className = 'unhighlighted-cell'; |
| var bottomCell = row2.insertCell(-1); |
| - bottomCell.innerHTML = groups[i][1]; |
| bottomCell.id = i + '-brailleCell'; |
| bottomCell.setAttribute('companionID', 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 bottomCell2 = row2.insertCell(-1); |
| + bottomCell2.id = i + '-brailleCell2'; |
| + bottomCell2.setAttribute('companionID', i + '-textCell'); |
| + bottomCell2.setAttribute('companionID2', i + '-brailleCell'); |
| + bottomCell.setAttribute('companionID2', i + '-brailleCell2'); |
| + topCell.setAttribute('companionID2', i + '-brailleCell2'); |
| + |
| + bottomCell2.className = 'unhighlighted-cell'; |
| + bottomCell2.innerHTML = groups[i][1].substring(cols - cellCount); |
| + cellCount = bottomCell2.innerHTML.length; |
| + } else { |
| + bottomCell.innerHTML = groups[i][1]; |
| + cellCount += groups[i][1].length; |
| + } |
| } |
| }; |