| 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 Implements support for live regions in ChromeVox Next. | 6 * @fileoverview Implements support for live regions in ChromeVox Next. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('LiveRegions'); | 9 goog.provide('LiveRegions'); |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 outputLiveRegionChange_: function(node, opt_prependFormatStr) { | 127 outputLiveRegionChange_: function(node, opt_prependFormatStr) { |
| 128 if (node.containerLiveBusy) | 128 if (node.containerLiveBusy) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 if (node.containerLiveAtomic && !node.liveAtomic) { | 131 if (node.containerLiveAtomic && !node.liveAtomic) { |
| 132 if (node.parent) | 132 if (node.parent) |
| 133 this.outputLiveRegionChange_(node.parent, opt_prependFormatStr); | 133 this.outputLiveRegionChange_(node.parent, opt_prependFormatStr); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Alerts should be announced as a result of focus. |
| 138 if (node.role == RoleType.alert) |
| 139 return; |
| 140 |
| 137 var range = cursors.Range.fromNode(node); | 141 var range = cursors.Range.fromNode(node); |
| 138 var output = new Output(); | 142 var output = new Output(); |
| 139 if (opt_prependFormatStr) | 143 if (opt_prependFormatStr) |
| 140 output.format(opt_prependFormatStr); | 144 output.format(opt_prependFormatStr); |
| 141 output.withSpeech(range, range, Output.EventType.NAVIGATE); | 145 output.withSpeech(range, range, Output.EventType.NAVIGATE); |
| 142 | 146 |
| 143 if (!output.hasSpeech && node.liveAtomic) | 147 if (!output.hasSpeech && node.liveAtomic) |
| 144 output.format('$joinedDescendants', node); | 148 output.format('$joinedDescendants', node); |
| 145 | 149 |
| 146 output.withSpeechCategory(cvox.TtsCategory.LIVE); | 150 output.withSpeechCategory(cvox.TtsCategory.LIVE); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 176 parent = parent.parent; | 180 parent = parent.parent; |
| 177 } | 181 } |
| 178 | 182 |
| 179 this.liveRegionNodeSet_.add(node); | 183 this.liveRegionNodeSet_.add(node); |
| 180 output.go(); | 184 output.go(); |
| 181 this.lastLiveRegionTime_ = currentTime; | 185 this.lastLiveRegionTime_ = currentTime; |
| 182 }, | 186 }, |
| 183 }; | 187 }; |
| 184 | 188 |
| 185 }); // goog.scope | 189 }); // goog.scope |
| OLD | NEW |