Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 var rowCount = this.brailleTableElement_.rows.length; | 506 var rowCount = this.brailleTableElement_.rows.length; |
| 507 for (var i = 0; i < rowCount; i++) { | 507 for (var i = 0; i < rowCount; i++) { |
| 508 this.brailleTableElement_.deleteRow(0); | 508 this.brailleTableElement_.deleteRow(0); |
| 509 } | 509 } |
| 510 rowCount = this.brailleTableElement2_.rows.length; | 510 rowCount = this.brailleTableElement2_.rows.length; |
| 511 for (var i = 0; i < rowCount; i++) { | 511 for (var i = 0; i < rowCount; i++) { |
| 512 this.brailleTableElement2_.deleteRow(0); | 512 this.brailleTableElement2_.deleteRow(0); |
| 513 } | 513 } |
| 514 | 514 |
| 515 var row1, row2; | 515 var row1, row2; |
| 516 // Number of rows already written. | |
| 516 rowCount = 0; | 517 rowCount = 0; |
| 518 // Number of cells already written in this row. | |
| 517 var cellCount = cols; | 519 var cellCount = cols; |
| 518 for (var i = 0; i < groups.length; i++) { | 520 for (var i = 0; i < groups.length; i++) { |
| 519 if (cellCount == cols) { | 521 if (cellCount == cols) { |
| 520 cellCount = 0; | 522 cellCount = 0; |
| 521 // Check if we reached the limit on the number of rows we can have. | 523 // Check if we reached the limit on the number of rows we can have. |
| 522 if (rowCount == rows) | 524 if (rowCount == rows) |
| 523 break; | 525 break; |
| 524 rowCount++; | 526 rowCount++; |
| 525 row1 = this.brailleTableElement_.insertRow(-1); | 527 row1 = this.brailleTableElement_.insertRow(-1); |
| 526 if (sideBySide) { | 528 if (sideBySide) { |
| 527 // Side by side. | 529 // Side by side. |
| 528 row2 = this.brailleTableElement2_.insertRow(-1); | 530 row2 = this.brailleTableElement2_.insertRow(-1); |
| 529 } else { | 531 } else { |
| 530 // Interleaved. | 532 // Interleaved. |
| 531 row2 = this.brailleTableElement_.insertRow(-1); | 533 row2 = this.brailleTableElement_.insertRow(-1); |
| 532 } | 534 } |
| 533 } | 535 } |
| 534 | 536 |
| 535 var topCell = row1.insertCell(-1); | 537 var topCell = row1.insertCell(-1); |
| 536 topCell.innerHTML = groups[i][0]; | 538 topCell.innerHTML = groups[i][0]; |
| 537 topCell.id = i + '-textCell'; | 539 topCell.id = i + '-textCell'; |
| 538 topCell.setAttribute('data-companionIDs', i + '-brailleCell'); | 540 topCell.setAttribute('data-companionIDs', i + '-brailleCell'); |
| 539 topCell.className = 'unhighlighted-cell'; | 541 topCell.className = 'unhighlighted-cell'; |
| 540 | 542 |
| 541 var bottomCell = row2.insertCell(-1); | 543 var bottomCell = row2.insertCell(-1); |
| 542 bottomCell.id = i + '-brailleCell'; | 544 bottomCell.id = i + '-brailleCell'; |
| 543 bottomCell.setAttribute('data-companionIDs', i + '-textCell'); | 545 bottomCell.setAttribute('data-companionIDs', i + '-textCell'); |
| 544 bottomCell.className = 'unhighlighted-cell'; | 546 bottomCell.className = 'unhighlighted-cell'; |
| 545 if (cellCount + groups[i][1].length > cols) { | 547 if (cellCount + groups[i][1].length > cols) { |
| 546 bottomCell.innerHTML = groups[i][1].substring(0, cols - cellCount); | 548 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
| |
| 547 if (rowCount == rows) | 549 while (cellCount + brailleText.length > cols) { |
| 548 break; | 550 // At this point we already have a bottomCell to fill, so fill it. |
| 549 rowCount++; | 551 bottomCell.innerHTML = brailleText.substring(0, cols - cellCount); |
| 550 row1 = this.brailleTableElement_.insertRow(-1); | 552 // Update to see what we still have to fill. |
| 551 if (sideBySide) { | 553 brailleText = brailleText.substring(cols - cellCount); |
| 552 // Side by side. | 554 // Make new row. |
| 553 row2 = this.brailleTableElement2_.insertRow(-1); | 555 if (rowCount == rows) |
| 554 } else { | 556 break; |
| 555 // Interleaved. | 557 rowCount++; |
| 556 row2 = this.brailleTableElement_.insertRow(-1); | 558 row1 = this.brailleTableElement_.insertRow(-1); |
| 559 if (sideBySide) { | |
| 560 // Side by side. | |
| 561 row2 = this.brailleTableElement2_.insertRow(-1); | |
| 562 } else { | |
| 563 // Interleaved. | |
| 564 row2 = this.brailleTableElement_.insertRow(-1); | |
| 565 } | |
| 566 var bottomCell2 = row2.insertCell(-1); | |
| 567 bottomCell2.id = i + '-brailleCell2'; | |
| 568 bottomCell2.setAttribute('data-companionIDs', | |
| 569 i + '-textCell ' + i + '-brailleCell'); | |
| 570 bottomCell.setAttribute('data-companionIDs', | |
| 571 bottomCell.getAttribute('data-companionIDs') + | |
| 572 ' ' + i + '-brailleCell2'); | |
| 573 topCell.setAttribute('data-companionID2', | |
| 574 bottomCell.getAttribute('data-companionIDs') + | |
| 575 ' ' + i + '-brailleCell2'); | |
| 576 | |
| 577 bottomCell2.className = 'unhighlighted-cell'; | |
| 578 bottomCell = bottomCell2; | |
| 579 cellCount = 0; | |
| 557 } | 580 } |
| 558 var bottomCell2 = row2.insertCell(-1); | 581 // Fill the rest. |
| 559 bottomCell2.id = i + '-brailleCell2'; | 582 bottomCell.innerHTML = brailleText; |
| 560 bottomCell2.setAttribute('data-companionIDs', | 583 cellCount = brailleText.length; |
| 561 i + '-textCell ' + i + '-brailleCell'); | |
| 562 bottomCell.setAttribute('data-companionIDs', | |
| 563 bottomCell.getAttribute('data-companionIDs') + | |
| 564 ' ' + i + '-brailleCell2'); | |
| 565 topCell.setAttribute('data-companionID2', | |
| 566 bottomCell.getAttribute('data-companionIDs') + | |
| 567 ' ' + i + '-brailleCell2'); | |
| 568 | 584 |
| 569 bottomCell2.className = 'unhighlighted-cell'; | |
| 570 bottomCell2.innerHTML = groups[i][1].substring(cols - cellCount); | |
| 571 cellCount = bottomCell2.innerHTML.length; | |
| 572 } else { | 585 } else { |
| 573 bottomCell.innerHTML = groups[i][1]; | 586 bottomCell.innerHTML = groups[i][1]; |
| 574 cellCount += groups[i][1].length; | 587 cellCount += groups[i][1].length; |
| 575 } | 588 } |
| 576 } | 589 } |
| 577 }; | 590 }; |
| 578 | 591 |
| 579 | 592 |
| 580 | 593 |
| 581 /** | 594 /** |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 }, false); | 891 }, false); |
| 879 | 892 |
| 880 window.addEventListener('hashchange', function() { | 893 window.addEventListener('hashchange', function() { |
| 881 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 894 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
| 882 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 895 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
| 883 cvox.ChromeVox.isStickyPrefOn = false; | 896 cvox.ChromeVox.isStickyPrefOn = false; |
| 884 } else { | 897 } else { |
| 885 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 898 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
| 886 } | 899 } |
| 887 }, false); | 900 }, false); |
| OLD | NEW |