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

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

Issue 2703663002: Display images in multiline Braille (Closed)
Patch Set: Final feedback Created 3 years, 9 months 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 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 var rowCount = this.brailleTableElement_.rows.length; 498 var rowCount = this.brailleTableElement_.rows.length;
499 for (var i = 0; i < rowCount; i++) { 499 for (var i = 0; i < rowCount; i++) {
500 this.brailleTableElement_.deleteRow(0); 500 this.brailleTableElement_.deleteRow(0);
501 } 501 }
502 rowCount = this.brailleTableElement2_.rows.length; 502 rowCount = this.brailleTableElement2_.rows.length;
503 for (var i = 0; i < rowCount; i++) { 503 for (var i = 0; i < rowCount; i++) {
504 this.brailleTableElement2_.deleteRow(0); 504 this.brailleTableElement2_.deleteRow(0);
505 } 505 }
506 506
507 var row1, row2; 507 var row1, row2;
508 // Number of rows already written.
508 rowCount = 0; 509 rowCount = 0;
510 // Number of cells already written in this row.
509 var cellCount = cols; 511 var cellCount = cols;
510 for (var i = 0; i < groups.length; i++) { 512 for (var i = 0; i < groups.length; i++) {
511 if (cellCount == cols) { 513 if (cellCount == cols) {
512 cellCount = 0; 514 cellCount = 0;
513 // Check if we reached the limit on the number of rows we can have. 515 // Check if we reached the limit on the number of rows we can have.
514 if (rowCount == rows) 516 if (rowCount == rows)
515 break; 517 break;
516 rowCount++; 518 rowCount++;
517 row1 = this.brailleTableElement_.insertRow(-1); 519 row1 = this.brailleTableElement_.insertRow(-1);
518 if (sideBySide) { 520 if (sideBySide) {
519 // Side by side. 521 // Side by side.
520 row2 = this.brailleTableElement2_.insertRow(-1); 522 row2 = this.brailleTableElement2_.insertRow(-1);
521 } else { 523 } else {
522 // Interleaved. 524 // Interleaved.
523 row2 = this.brailleTableElement_.insertRow(-1); 525 row2 = this.brailleTableElement_.insertRow(-1);
524 } 526 }
525 } 527 }
526 528
527 var topCell = row1.insertCell(-1); 529 var topCell = row1.insertCell(-1);
528 topCell.innerHTML = groups[i][0]; 530 topCell.innerHTML = groups[i][0];
529 topCell.id = i + '-textCell'; 531 topCell.id = i + '-textCell';
530 topCell.setAttribute('data-companionIDs', i + '-brailleCell'); 532 topCell.setAttribute('data-companionIDs', i + '-brailleCell');
531 topCell.className = 'unhighlighted-cell'; 533 topCell.className = 'unhighlighted-cell';
532 534
533 var bottomCell = row2.insertCell(-1); 535 var bottomCell = row2.insertCell(-1);
534 bottomCell.id = i + '-brailleCell'; 536 bottomCell.id = i + '-brailleCell';
535 bottomCell.setAttribute('data-companionIDs', i + '-textCell'); 537 bottomCell.setAttribute('data-companionIDs', i + '-textCell');
536 bottomCell.className = 'unhighlighted-cell'; 538 bottomCell.className = 'unhighlighted-cell';
537 if (cellCount + groups[i][1].length > cols) { 539 if (cellCount + groups[i][1].length > cols) {
538 bottomCell.innerHTML = groups[i][1].substring(0, cols - cellCount); 540 var brailleText = groups[i][1];
539 if (rowCount == rows) 541 while (cellCount + brailleText.length > cols) {
540 break; 542 // At this point we already have a bottomCell to fill, so fill it.
541 rowCount++; 543 bottomCell.innerHTML = brailleText.substring(0, cols - cellCount);
542 row1 = this.brailleTableElement_.insertRow(-1); 544 // Update to see what we still have to fill.
543 if (sideBySide) { 545 brailleText = brailleText.substring(cols - cellCount);
544 // Side by side. 546 // Make new row.
545 row2 = this.brailleTableElement2_.insertRow(-1); 547 if (rowCount == rows)
546 } else { 548 break;
547 // Interleaved. 549 rowCount++;
548 row2 = this.brailleTableElement_.insertRow(-1); 550 row1 = this.brailleTableElement_.insertRow(-1);
551 if (sideBySide) {
552 // Side by side.
553 row2 = this.brailleTableElement2_.insertRow(-1);
554 } else {
555 // Interleaved.
556 row2 = this.brailleTableElement_.insertRow(-1);
557 }
558 var bottomCell2 = row2.insertCell(-1);
559 bottomCell2.id = i + '-brailleCell2';
560 bottomCell2.setAttribute('data-companionIDs',
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
569 bottomCell2.className = 'unhighlighted-cell';
570 bottomCell = bottomCell2;
571 cellCount = 0;
549 } 572 }
550 var bottomCell2 = row2.insertCell(-1); 573 // Fill the rest.
551 bottomCell2.id = i + '-brailleCell2'; 574 bottomCell.innerHTML = brailleText;
552 bottomCell2.setAttribute('data-companionIDs', 575 cellCount = brailleText.length;
553 i + '-textCell ' + i + '-brailleCell');
554 bottomCell.setAttribute('data-companionIDs',
555 bottomCell.getAttribute('data-companionIDs') +
556 ' ' + i + '-brailleCell2');
557 topCell.setAttribute('data-companionID2',
558 bottomCell.getAttribute('data-companionIDs') +
559 ' ' + i + '-brailleCell2');
560
561 bottomCell2.className = 'unhighlighted-cell';
562 bottomCell2.innerHTML = groups[i][1].substring(cols - cellCount);
563 cellCount = bottomCell2.innerHTML.length;
564 } else { 576 } else {
565 bottomCell.innerHTML = groups[i][1]; 577 bottomCell.innerHTML = groups[i][1];
566 cellCount += groups[i][1].length; 578 cellCount += groups[i][1].length;
567 } 579 }
568 } 580 }
569 }; 581 };
570 582
571 583
572 584
573 /** 585 /**
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 }, false); 873 }, false);
862 874
863 window.addEventListener('hashchange', function() { 875 window.addEventListener('hashchange', function() {
864 if (location.hash == '#fullscreen' || location.hash == '#focus') { 876 if (location.hash == '#fullscreen' || location.hash == '#focus') {
865 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; 877 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn;
866 cvox.ChromeVox.isStickyPrefOn = false; 878 cvox.ChromeVox.isStickyPrefOn = false;
867 } else { 879 } else {
868 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; 880 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_;
869 } 881 }
870 }, false); 882 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698