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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 this.activeMenu_ = menu; | 437 this.activeMenu_ = menu; |
438 this.pendingCallback_ = null; | 438 this.pendingCallback_ = null; |
439 | 439 |
440 if (this.activeMenu_) { | 440 if (this.activeMenu_) { |
441 this.activeMenu_.activate(); | 441 this.activeMenu_.activate(); |
442 } | 442 } |
443 }; | 443 }; |
444 | 444 |
445 /** | 445 /** |
| 446 * Sets the index of the current active menu to be 0. |
| 447 */ |
| 448 Panel.scrollToTop = function() { |
| 449 this.activeMenu_.scrollToTop(); |
| 450 }; |
| 451 |
| 452 /** |
| 453 * Sets the index of the current active menu to be the last index. |
| 454 */ |
| 455 Panel.scrollToBottom = function() { |
| 456 this.activeMenu_.scrollToBottom(); |
| 457 }; |
| 458 |
| 459 /** |
446 * Advance the index of the current active menu by |delta|. | 460 * Advance the index of the current active menu by |delta|. |
447 * @param {number} delta The number to add to the active menu index. | 461 * @param {number} delta The number to add to the active menu index. |
448 */ | 462 */ |
449 Panel.advanceActiveMenuBy = function(delta) { | 463 Panel.advanceActiveMenuBy = function(delta) { |
450 var activeIndex = -1; | 464 var activeIndex = -1; |
451 for (var i = 0; i < this.menus_.length; i++) { | 465 for (var i = 0; i < this.menus_.length; i++) { |
452 if (this.activeMenu_ == this.menus_[i]) { | 466 if (this.activeMenu_ == this.menus_[i]) { |
453 activeIndex = i; | 467 activeIndex = i; |
454 break; | 468 break; |
455 } | 469 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 break; | 537 break; |
524 case 'ArrowUp': | 538 case 'ArrowUp': |
525 Panel.advanceItemBy(-1); | 539 Panel.advanceItemBy(-1); |
526 break; | 540 break; |
527 case 'ArrowDown': | 541 case 'ArrowDown': |
528 Panel.advanceItemBy(1); | 542 Panel.advanceItemBy(1); |
529 break; | 543 break; |
530 case 'Escape': | 544 case 'Escape': |
531 Panel.closeMenusAndRestoreFocus(); | 545 Panel.closeMenusAndRestoreFocus(); |
532 break; | 546 break; |
| 547 case 'PageUp': |
| 548 Panel.advanceItemBy(10); |
| 549 break; |
| 550 case 'PageDown': |
| 551 Panel.advanceItemBy(-10); |
| 552 break; |
| 553 case 'Home': |
| 554 Panel.scrollToTop(); |
| 555 break; |
| 556 case 'End': |
| 557 Panel.scrollToBottom(); |
| 558 break; |
533 case 'Enter': | 559 case 'Enter': |
534 case ' ': // Space | 560 case ' ': // Space |
535 Panel.pendingCallback_ = Panel.getCallbackForCurrentItem(); | 561 Panel.pendingCallback_ = Panel.getCallbackForCurrentItem(); |
536 Panel.closeMenusAndRestoreFocus(); | 562 Panel.closeMenusAndRestoreFocus(); |
537 break; | 563 break; |
538 default: | 564 default: |
539 // Don't mark this event as handled. | 565 // Don't mark this event as handled. |
540 return; | 566 return; |
541 } | 567 } |
542 | 568 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 }, false); | 674 }, false); |
649 | 675 |
650 window.addEventListener('hashchange', function() { | 676 window.addEventListener('hashchange', function() { |
651 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 677 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
652 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 678 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
653 cvox.ChromeVox.isStickyPrefOn = false; | 679 cvox.ChromeVox.isStickyPrefOn = false; |
654 } else { | 680 } else { |
655 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 681 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
656 } | 682 } |
657 }, false); | 683 }, false); |
OLD | NEW |