| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Provides output services for ChromeVox. | 6 * @fileoverview Provides output services for ChromeVox. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('Output'); | 9 goog.provide('Output'); |
| 10 goog.provide('Output.EventType'); | 10 goog.provide('Output.EventType'); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 grid: { | 442 grid: { |
| 443 enter: '$nameFromNode $role $description' | 443 enter: '$nameFromNode $role $description' |
| 444 }, | 444 }, |
| 445 group: { | 445 group: { |
| 446 enter: '$nameFromNode $state $description', | 446 enter: '$nameFromNode $state $description', |
| 447 speak: '$nameOrDescendants $value $state $description', | 447 speak: '$nameOrDescendants $value $state $description', |
| 448 leave: '' | 448 leave: '' |
| 449 }, | 449 }, |
| 450 heading: { | 450 heading: { |
| 451 enter: '!relativePitch(hierarchicalLevel) ' + | 451 enter: '!relativePitch(hierarchicalLevel) ' + |
| 452 '$nameFromNode= @tag_h+$hierarchicalLevel', | 452 '$nameFromNode= ' + |
| 453 speak: '!relativePitch(hierarchicalLevel)' + | 453 '$if($hierarchicalLevel, @tag_h+$hierarchicalLevel, $role) $state', |
| 454 ' $nameOrDescendants= @tag_h+$hierarchicalLevel $state' | 454 speak: '!relativePitch(hierarchicalLevel) ' + |
| 455 '$nameOrDescendants= ' + |
| 456 '$if($hierarchicalLevel, @tag_h+$hierarchicalLevel, $role) $state' |
| 455 }, | 457 }, |
| 456 inlineTextBox: { | 458 inlineTextBox: { |
| 457 speak: '$name=' | 459 speak: '$name=' |
| 458 }, | 460 }, |
| 459 inputTime: { | 461 inputTime: { |
| 460 enter: '$nameFromNode $role $description' | 462 enter: '$nameFromNode $role $description' |
| 461 }, | 463 }, |
| 462 link: { | 464 link: { |
| 463 enter: '$nameFromNode= $role $state' | 465 enter: '$nameFromNode= $role $state' |
| 464 }, | 466 }, |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 * normally queue or do a category flush. This differs from the |withQueueMode| | 689 * normally queue or do a category flush. This differs from the |withQueueMode| |
| 688 * instance method as it can apply to future output. | 690 * instance method as it can apply to future output. |
| 689 * @param {cvox.QueueMode} mode | 691 * @param {cvox.QueueMode} mode |
| 690 */ | 692 */ |
| 691 Output.forceModeForNextSpeechUtterance = function(mode) { | 693 Output.forceModeForNextSpeechUtterance = function(mode) { |
| 692 Output.forceModeForNextSpeechUtterance_ = mode; | 694 Output.forceModeForNextSpeechUtterance_ = mode; |
| 693 }; | 695 }; |
| 694 | 696 |
| 695 Output.prototype = { | 697 Output.prototype = { |
| 696 /** | 698 /** |
| 697 * Gets the spoken output with separator '|'. | |
| 698 * @return {!Spannable} | |
| 699 */ | |
| 700 get speechOutputForTest() { | |
| 701 return this.speechBuffer_.reduce(function(prev, cur) { | |
| 702 if (prev === null) | |
| 703 return cur; | |
| 704 prev.append('|'); | |
| 705 prev.append(cur); | |
| 706 return prev; | |
| 707 }, null); | |
| 708 }, | |
| 709 | |
| 710 /** | |
| 711 * Gets the output buffer for braille. | |
| 712 * @return {!Spannable} | |
| 713 */ | |
| 714 get brailleOutputForTest() { | |
| 715 return this.createBrailleOutput_(); | |
| 716 }, | |
| 717 | |
| 718 /** | |
| 719 * @return {boolean} True if there's any speech that will be output. | 699 * @return {boolean} True if there's any speech that will be output. |
| 720 */ | 700 */ |
| 721 get hasSpeech() { | 701 get hasSpeech() { |
| 722 for (var i = 0; i < this.speechBuffer_.length; i++) { | 702 for (var i = 0; i < this.speechBuffer_.length; i++) { |
| 723 if (this.speechBuffer_[i].trim().length) | 703 if (this.speechBuffer_[i].trim().length) |
| 724 return true; | 704 return true; |
| 725 } | 705 } |
| 726 return false; | 706 return false; |
| 727 }, | 707 }, |
| 728 | 708 |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 while (earconFinder = ancestors.pop()) { | 1669 while (earconFinder = ancestors.pop()) { |
| 1690 var info = Output.ROLE_INFO_[earconFinder.role]; | 1670 var info = Output.ROLE_INFO_[earconFinder.role]; |
| 1691 if (info && info.earconId) { | 1671 if (info && info.earconId) { |
| 1692 return new Output.EarconAction(info.earconId); | 1672 return new Output.EarconAction(info.earconId); |
| 1693 break; | 1673 break; |
| 1694 } | 1674 } |
| 1695 earconFinder = earconFinder.parent; | 1675 earconFinder = earconFinder.parent; |
| 1696 } | 1676 } |
| 1697 } | 1677 } |
| 1698 return null; | 1678 return null; |
| 1679 }, |
| 1680 |
| 1681 /** |
| 1682 * Gets a human friendly string with the contents of output. |
| 1683 * @return {string} |
| 1684 */ |
| 1685 toString: function() { |
| 1686 return this.speechBuffer_.reduce(function(prev, cur) { |
| 1687 if (prev === null) |
| 1688 return cur.toString(); |
| 1689 prev += ' ' + cur.toString(); |
| 1690 return prev; |
| 1691 }, null); |
| 1692 }, |
| 1693 |
| 1694 /** |
| 1695 * Gets the spoken output with separator '|'. |
| 1696 * @return {!Spannable} |
| 1697 */ |
| 1698 get speechOutputForTest() { |
| 1699 return this.speechBuffer_.reduce(function(prev, cur) { |
| 1700 if (prev === null) |
| 1701 return cur; |
| 1702 prev.append('|'); |
| 1703 prev.append(cur); |
| 1704 return prev; |
| 1705 }, null); |
| 1706 }, |
| 1707 |
| 1708 /** |
| 1709 * Gets the output buffer for braille. |
| 1710 * @return {!Spannable} |
| 1711 */ |
| 1712 get brailleOutputForTest() { |
| 1713 return this.createBrailleOutput_(); |
| 1699 } | 1714 } |
| 1700 }; | 1715 }; |
| 1701 | 1716 |
| 1702 }); // goog.scope | 1717 }); // goog.scope |
| OLD | NEW |