Commit 3e515212 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Fix ChromeVox compile after ES6 class refactoring

The Clsoure compiler (which gets run on upload PRESUBMIT) is now flagging many errors in ChromeVox. This is due to the recent work to move us to ES6 styled classes.

The errors themselves were mostly there previously and uncaught because Closure is fairly loose in flagging errors given a slightly different js structure.

Test: git cl presubmit -u --force
Change-Id: I4c09adf0a5fd6e3894f7316dc4d5a9c4bf9a825d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026760Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736503}
parent ee0ba6ab
...@@ -35,74 +35,7 @@ goog.require('TtsBackground'); ...@@ -35,74 +35,7 @@ goog.require('TtsBackground');
* interprets them. * interprets them.
*/ */
ChromeVoxBackground = class { ChromeVoxBackground = class {
constructor() {} constructor() {
/**
* @param {string} pref
* @param {*} value
* @param {boolean} announce
*/
static setPref(pref, value, announce) {
if (pref == 'earcons') {
AbstractEarcons.enabled = !!value;
} else if (pref == 'sticky' && announce) {
if (value) {
ChromeVox.tts.speak(
Msgs.getMsg('sticky_mode_enabled'), QueueMode.FLUSH);
} else {
ChromeVox.tts.speak(
Msgs.getMsg('sticky_mode_disabled'), QueueMode.FLUSH);
}
} else if (pref == 'typingEcho' && announce) {
var announceStr = '';
switch (value) {
case TypingEcho.CHARACTER:
announceStr = Msgs.getMsg('character_echo');
break;
case TypingEcho.WORD:
announceStr = Msgs.getMsg('word_echo');
break;
case TypingEcho.CHARACTER_AND_WORD:
announceStr = Msgs.getMsg('character_and_word_echo');
break;
case TypingEcho.NONE:
announceStr = Msgs.getMsg('none_echo');
break;
default:
break;
}
if (announceStr) {
ChromeVox.tts.speak(announceStr, QueueMode.QUEUE);
}
} else if (pref == 'brailleCaptions') {
BrailleCaptionsBackground.setActive(!!value);
} else if (pref == 'position') {
ChromeVox.position =
/** @type {Object<string, constants.Point>} */ (JSON.parse(
/** @type {string} */ (value)));
}
window['prefs'].setPref(pref, value);
ChromeVoxBackground.readPrefs();
}
/**
* Read and apply preferences that affect the background context.
*/
static readPrefs() {
if (!window['prefs']) {
return;
}
var prefs = window['prefs'].getPrefs();
ChromeVoxEditableTextBase.useIBeamCursor =
(prefs['useIBeamCursor'] == 'true');
ChromeVox.isStickyPrefOn = (prefs['sticky'] == 'true');
}
/**
* Initialize the background page: set up TTS and bridge listeners.
*/
init() {
this.prefs = new ChromeVoxPrefs(); this.prefs = new ChromeVoxPrefs();
ChromeVoxBackground.readPrefs(); ChromeVoxBackground.readPrefs();
...@@ -177,6 +110,68 @@ ChromeVoxBackground = class { ...@@ -177,6 +110,68 @@ ChromeVoxBackground = class {
}); });
} }
/**
* @param {string} pref
* @param {*} value
* @param {boolean} announce
*/
static setPref(pref, value, announce) {
if (pref == 'earcons') {
AbstractEarcons.enabled = !!value;
} else if (pref == 'sticky' && announce) {
if (value) {
ChromeVox.tts.speak(
Msgs.getMsg('sticky_mode_enabled'), QueueMode.FLUSH);
} else {
ChromeVox.tts.speak(
Msgs.getMsg('sticky_mode_disabled'), QueueMode.FLUSH);
}
} else if (pref == 'typingEcho' && announce) {
var announceStr = '';
switch (value) {
case TypingEcho.CHARACTER:
announceStr = Msgs.getMsg('character_echo');
break;
case TypingEcho.WORD:
announceStr = Msgs.getMsg('word_echo');
break;
case TypingEcho.CHARACTER_AND_WORD:
announceStr = Msgs.getMsg('character_and_word_echo');
break;
case TypingEcho.NONE:
announceStr = Msgs.getMsg('none_echo');
break;
default:
break;
}
if (announceStr) {
ChromeVox.tts.speak(announceStr, QueueMode.QUEUE);
}
} else if (pref == 'brailleCaptions') {
BrailleCaptionsBackground.setActive(!!value);
} else if (pref == 'position') {
ChromeVox.position =
/** @type {Object<string, constants.Point>} */ (JSON.parse(
/** @type {string} */ (value)));
}
window['prefs'].setPref(pref, value);
ChromeVoxBackground.readPrefs();
}
/**
* Read and apply preferences that affect the background context.
*/
static readPrefs() {
if (!window['prefs']) {
return;
}
var prefs = window['prefs'].getPrefs();
ChromeVoxEditableTextBase.useIBeamCursor =
(prefs['useIBeamCursor'] == 'true');
ChromeVox.isStickyPrefOn = (prefs['sticky'] == 'true');
}
/** /**
* Inject ChromeVox into a tab. * Inject ChromeVox into a tab.
* @param {Array<Tab>} tabs The tab where ChromeVox scripts should be * @param {Array<Tab>} tabs The tab where ChromeVox scripts should be
...@@ -363,7 +358,6 @@ ChromeVoxBackground = class { ...@@ -363,7 +358,6 @@ ChromeVoxBackground = class {
// so that other background pages can access it. Also export the prefs object // so that other background pages can access it. Also export the prefs object
// for access by the options page. // for access by the options page.
let background = new ChromeVoxBackground(); let background = new ChromeVoxBackground();
background.init();
// TODO: this needs to be cleaned up (move to init?). // TODO: this needs to be cleaned up (move to init?).
window['speak'] = goog.bind(background.tts.speak, background.tts); window['speak'] = goog.bind(background.tts.speak, background.tts);
......
...@@ -9,8 +9,14 @@ ...@@ -9,8 +9,14 @@
* construct, unlike the object from the extension system. * construct, unlike the object from the extension system.
*/ */
goog.provide('ChromeVoxEvent');
goog.provide('CustomAutomationEvent'); goog.provide('CustomAutomationEvent');
/**
* @typedef{chrome.automation.AutomationEvent|CustomAutomationEvent}
*/
var ChromeVoxEvent;
/** /**
* An object we can use instead of a chrome.automation.AutomationEvent. * An object we can use instead of a chrome.automation.AutomationEvent.
*/ */
...@@ -27,7 +33,7 @@ CustomAutomationEvent = class { ...@@ -27,7 +33,7 @@ CustomAutomationEvent = class {
} }
/** /**
* @override * Stops the propagation of this event.
*/ */
stopPropagation() { stopPropagation() {
throw Error('Can\'t call stopPropagation on a CustomAutomationEvent'); throw Error('Can\'t call stopPropagation on a CustomAutomationEvent');
......
...@@ -104,7 +104,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -104,7 +104,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once ChromeVox's focus changes. * Provides all feedback once ChromeVox's focus changes.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onEventDefault(evt) { onEventDefault(evt) {
var node = evt.target; var node = evt.target;
...@@ -140,7 +140,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -140,7 +140,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onEventFromViews(evt) { onEventFromViews(evt) {
if (evt.target.root.role == RoleType.DESKTOP) { if (evt.target.root.role == RoleType.DESKTOP) {
...@@ -149,7 +149,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -149,7 +149,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onEventIfSelected(evt) { onEventIfSelected(evt) {
if (evt.target.selected) { if (evt.target.selected) {
...@@ -199,7 +199,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -199,7 +199,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onHover(evt) { onHover(evt) {
if (!GestureCommandHandler.getEnabled()) { if (!GestureCommandHandler.getEnabled()) {
...@@ -242,7 +242,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -242,7 +242,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Makes an announcement without changing focus. * Makes an announcement without changing focus.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onAlert(evt) { onAlert(evt) {
var node = evt.target; var node = evt.target;
...@@ -264,7 +264,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -264,7 +264,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onDocumentSelectionChanged(evt) { onDocumentSelectionChanged(evt) {
var selectionStart = evt.target.selectionStartObject; var selectionStart = evt.target.selectionStartObject;
...@@ -293,7 +293,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -293,7 +293,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once a focus event fires. * Provides all feedback once a focus event fires.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onFocus(evt) { onFocus(evt) {
if (evt.target.role == RoleType.ROOT_WEB_AREA && if (evt.target.role == RoleType.ROOT_WEB_AREA &&
...@@ -341,7 +341,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -341,7 +341,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once a load complete event fires. * Provides all feedback once a load complete event fires.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onLoadComplete(evt) { onLoadComplete(evt) {
// A load complete gets fired on the desktop node when display metrics // A load complete gets fired on the desktop node when display metrics
...@@ -405,7 +405,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -405,7 +405,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once a change event in a text field fires. * Provides all feedback once a change event in a text field fires.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
* @private * @private
*/ */
onEditableChanged_(evt) { onEditableChanged_(evt) {
...@@ -448,7 +448,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -448,7 +448,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once a value changed event fires. * Provides all feedback once a value changed event fires.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onValueChanged(evt) { onValueChanged(evt) {
// Skip root web areas. // Skip root web areas.
...@@ -501,7 +501,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -501,7 +501,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Handle updating the active indicator when the document scrolls. * Handle updating the active indicator when the document scrolls.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onScrollPositionChanged(evt) { onScrollPositionChanged(evt) {
var currentRange = ChromeVoxState.instance.currentRange; var currentRange = ChromeVoxState.instance.currentRange;
...@@ -511,7 +511,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -511,7 +511,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onSelection(evt) { onSelection(evt) {
// Invalidate any previous editable text handler state since some nodes, // Invalidate any previous editable text handler state since some nodes,
...@@ -540,7 +540,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -540,7 +540,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once a menu start event fires. * Provides all feedback once a menu start event fires.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onMenuStart(evt) { onMenuStart(evt) {
ChromeVoxState.instance.markCurrentRange(); ChromeVoxState.instance.markCurrentRange();
...@@ -549,7 +549,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -549,7 +549,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once a menu end event fires. * Provides all feedback once a menu end event fires.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onMenuEnd(evt) { onMenuEnd(evt) {
this.onEventDefault(evt); this.onEventDefault(evt);
...@@ -615,7 +615,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler { ...@@ -615,7 +615,7 @@ DesktopAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {AutomationEvent} evt * @param {ChromeVoxEvent} evt
* @private * @private
*/ */
maybeRecoverFocusAndOutput_(evt, focus) { maybeRecoverFocusAndOutput_(evt, focus) {
......
...@@ -49,6 +49,9 @@ editing.TextEditHandler = class { ...@@ -49,6 +49,9 @@ editing.TextEditHandler = class {
throw '|node| must be editable.'; throw '|node| must be editable.';
} }
/** @private {AutomationEditableText} */
this.editableText_;
chrome.automation.getDesktop(function(desktop) { chrome.automation.getDesktop(function(desktop) {
// A rich text field is one where selection gets placed on a DOM // A rich text field is one where selection gets placed on a DOM
// descendant to a root text field. This is one of: // descendant to a root text field. This is one of:
...@@ -59,7 +62,6 @@ editing.TextEditHandler = class { ...@@ -59,7 +62,6 @@ editing.TextEditHandler = class {
// from ARC++). // from ARC++).
var useRichText = node.state[StateType.RICHLY_EDITABLE]; var useRichText = node.state[StateType.RICHLY_EDITABLE];
/** @private {!AutomationEditableText} */
this.editableText_ = useRichText ? new AutomationRichEditableText(node) : this.editableText_ = useRichText ? new AutomationRichEditableText(node) :
new AutomationEditableText(node); new AutomationEditableText(node);
}.bind(this)); }.bind(this));
...@@ -76,7 +78,7 @@ editing.TextEditHandler = class { ...@@ -76,7 +78,7 @@ editing.TextEditHandler = class {
* |valueChanged|. * |valueChanged|.
* An implementation of this method should emit the appropriate braille and * An implementation of this method should emit the appropriate braille and
* spoken feedback for the event. * spoken feedback for the event.
* @param {!(AutomationEvent|CustomAutomationEvent)} evt * @param {!ChromeVoxEvent} evt
*/ */
onEvent(evt) { onEvent(evt) {
if (evt.type !== EventType.TEXT_CHANGED && if (evt.type !== EventType.TEXT_CHANGED &&
...@@ -259,7 +261,7 @@ var AutomationEditableText = class extends ChromeVoxEditableTextBase { ...@@ -259,7 +261,7 @@ var AutomationEditableText = class extends ChromeVoxEditableTextBase {
/** /**
* @param {string} value * @param {string} value
* @return {!Array<string>} * @return {!Array<number>}
* @private * @private
*/ */
static getLineBreaks_(value) { static getLineBreaks_(value) {
...@@ -954,6 +956,9 @@ editing.EditableLine = class { ...@@ -954,6 +956,9 @@ editing.EditableLine = class {
this.end_ = new Cursor(endNode, endIndex); this.end_ = new Cursor(endNode, endIndex);
this.end_ = this.end_.deepEquivalent || this.end_; this.end_ = this.end_.deepEquivalent || this.end_;
/** @private {AutomationNode|undefined} */
this.endContainer_;
// Update |startIndex| and |endIndex| if the calls above to // Update |startIndex| and |endIndex| if the calls above to
// cursors.Cursor.deepEquivalent results in cursors to different container // cursors.Cursor.deepEquivalent results in cursors to different container
// nodes. The cursors can point directly to inline text boxes, in which case // nodes. The cursors can point directly to inline text boxes, in which case
......
...@@ -31,7 +31,7 @@ EventStreamLogger = class { ...@@ -31,7 +31,7 @@ EventStreamLogger = class {
/** /**
* Adds eventStreamLogging to this handler. * Adds eventStreamLogging to this handler.
* @param {chrome.automation.chrome.automation.EventType} eventType * @param {chrome.automation.EventType} eventType
* @protected * @protected
*/ */
addWatcher_(eventType) { addWatcher_(eventType) {
...@@ -40,7 +40,7 @@ EventStreamLogger = class { ...@@ -40,7 +40,7 @@ EventStreamLogger = class {
/** /**
* Removes eventStreamLogging from this handler. * Removes eventStreamLogging from this handler.
* @param {chrome.automation.chrome.automation.EventType} eventType * @param {chrome.automation.EventType} eventType
* @protected * @protected
*/ */
removeWatcher_(eventType) { removeWatcher_(eventType) {
...@@ -57,7 +57,7 @@ EventStreamLogger = class { ...@@ -57,7 +57,7 @@ EventStreamLogger = class {
} }
/** /**
* @param {chrome.automation.chrome.automation.EventType} eventType * @param {chrome.automation.EventType} eventType
* @param {boolean} checked * @param {boolean} checked
*/ */
notifyEventStreamFilterChanged(eventType, checked) { notifyEventStreamFilterChanged(eventType, checked) {
......
...@@ -18,14 +18,26 @@ const INTERVAL_MS_BETWEEN_HIT_TESTS = 50; ...@@ -18,14 +18,26 @@ const INTERVAL_MS_BETWEEN_HIT_TESTS = 50;
BackgroundMouseHandler = class extends BaseAutomationHandler { BackgroundMouseHandler = class extends BaseAutomationHandler {
constructor() { constructor() {
super(null); super(null);
/** @private {chrome.automation.AutomationNode} */
this.node_;
/**
*
* The desktop node.
*
* @private {!chrome.automation.AutomationNode}
*/
this.desktop_;
/** @private {boolean|undefined} */
this.isWaitingBeforeHitTest_;
/** @private {boolean|undefined} */
this.hasPendingEvents_;
/** @private {number|undefined} */
this.mouseX_;
/** @private {number|undefined} */
this.mouseY_;
chrome.automation.getDesktop((desktop) => { chrome.automation.getDesktop((desktop) => {
this.node_ = desktop; this.node_ = desktop;
/**
*
* The desktop node.
*
* @private {!chrome.automation.AutomationNode}
*/
this.desktop_ = desktop; this.desktop_ = desktop;
this.addListener_(EventType.MOUSE_MOVED, this.onMouseMove); this.addListener_(EventType.MOUSE_MOVED, this.onMouseMove);
...@@ -62,6 +74,9 @@ BackgroundMouseHandler = class extends BaseAutomationHandler { ...@@ -62,6 +74,9 @@ BackgroundMouseHandler = class extends BaseAutomationHandler {
* false and |hasPendingEvents| is true. * false and |hasPendingEvents| is true.
*/ */
runHitTest() { runHitTest() {
if (this.mouseX_ === undefined || this.mouseY_ === undefined) {
return;
}
this.desktop_.hitTest(this.mouseX_, this.mouseY_, EventType.HOVER); this.desktop_.hitTest(this.mouseX_, this.mouseY_, EventType.HOVER);
this.hasPendingEvents_ = false; this.hasPendingEvents_ = false;
this.startTimer(); this.startTimer();
......
...@@ -480,17 +480,19 @@ Output = class { ...@@ -480,17 +480,19 @@ Output = class {
continue; continue;
} }
var speechProps = /** @type {Object} */ ( var speechProps = {};
var speechPropsInstance = /** @type {Output.SpeechProperties} */ (
buff.getSpanInstanceOf(Output.SpeechProperties)); buff.getSpanInstanceOf(Output.SpeechProperties));
if (!speechProps) { if (!speechPropsInstance) {
speechProps = this.initialSpeechProps_; speechProps = this.initialSpeechProps_;
} else { } else {
for (var [key, value] of Object.entries(this.initialSpeechProps_)) { for (var [key, value] of Object.entries(this.initialSpeechProps_)) {
if (speechProps[key] === undefined) { if (speechPropsInstance.properties[key] === undefined) {
speechProps[key] = value; speechPropsInstance.properties[key] = value;
} }
} }
speechProps = speechPropsInstance.properties;
} }
speechProps.category = this.speechCategory_; speechProps.category = this.speechCategory_;
...@@ -753,7 +755,7 @@ Output = class { ...@@ -753,7 +755,7 @@ Output = class {
buff, options, newLanguage, outputString) { buff, options, newLanguage, outputString) {
var speechProps = new Output.SpeechProperties(); var speechProps = new Output.SpeechProperties();
// Set output language. // Set output language.
speechProps['lang'] = newLanguage; speechProps.properties['lang'] = newLanguage;
// Append outputString to buff. // Append outputString to buff.
this.append_(buff, outputString, options); this.append_(buff, outputString, options);
// Attach associated SpeechProperties if the buffer is // Attach associated SpeechProperties if the buffer is
...@@ -973,7 +975,7 @@ Output = class { ...@@ -973,7 +975,7 @@ Output = class {
if (this.formatOptions_.auralStyle) { if (this.formatOptions_.auralStyle) {
speechProps = new Output.SpeechProperties(); speechProps = new Output.SpeechProperties();
speechProps['relativePitch'] = -0.3; speechProps.properties['relativePitch'] = -0.3;
} }
options.annotation.push(token); options.annotation.push(token);
var msg = node.role; var msg = node.role;
...@@ -1223,7 +1225,7 @@ Output = class { ...@@ -1223,7 +1225,7 @@ Output = class {
if (!speechProps) { if (!speechProps) {
speechProps = new Output.SpeechProperties(); speechProps = new Output.SpeechProperties();
} }
speechProps['relativePitch'] = -0.2; speechProps.properties['relativePitch'] = -0.2;
} }
var isPluralized = (token[0] == '@'); var isPluralized = (token[0] == '@');
if (isPluralized) { if (isPluralized) {
...@@ -1311,7 +1313,7 @@ Output = class { ...@@ -1311,7 +1313,7 @@ Output = class {
} else if (prefix == '!') { } else if (prefix == '!') {
ruleStr.write(' ! ' + token + '\n'); ruleStr.write(' ! ' + token + '\n');
speechProps = new Output.SpeechProperties(); speechProps = new Output.SpeechProperties();
speechProps[token] = true; speechProps.properties[token] = true;
if (tree.firstChild) { if (tree.firstChild) {
if (!this.formatOptions_.auralStyle) { if (!this.formatOptions_.auralStyle) {
speechProps = undefined; speechProps = undefined;
...@@ -1327,7 +1329,7 @@ Output = class { ...@@ -1327,7 +1329,7 @@ Output = class {
} else { } else {
value = parseFloat(node[value]) / -10.0; value = parseFloat(node[value]) / -10.0;
} }
speechProps[token] = value; speechProps.properties[token] = value;
return; return;
} }
} }
...@@ -1759,7 +1761,7 @@ Output = class { ...@@ -1759,7 +1761,7 @@ Output = class {
// Hints should be delayed. // Hints should be delayed.
var hintProperties = new Output.SpeechProperties(); var hintProperties = new Output.SpeechProperties();
hintProperties['delay'] = true; hintProperties.properties['delay'] = true;
ruleStr.write('hint_: '); ruleStr.write('hint_: ');
if (EventSourceState.get() == EventSourceType.TOUCH_GESTURE) { if (EventSourceState.get() == EventSourceType.TOUCH_GESTURE) {
...@@ -2656,7 +2658,26 @@ Output.RULES = { ...@@ -2656,7 +2658,26 @@ Output.RULES = {
* Used to annotate utterances with speech properties. * Used to annotate utterances with speech properties.
*/ */
Output.SpeechProperties = class { Output.SpeechProperties = class {
constructor() {} constructor() {
/** @private {!Object} */
this.properties_ = {};
}
/** @return {!Object} */
get properties() {
return this.properties_;
}
/** @override */
toJSON() {
// Make a copy of our properties since the caller really shouldn't be
// modifying our local state.
var clone = {};
for (var key in this.properties_) {
clone[key] = this.properties_[key];
}
return clone;
}
}; };
/** /**
......
...@@ -60,6 +60,9 @@ ISearch = class { ...@@ -60,6 +60,9 @@ ISearch = class {
throw 'Incremental search started from invalid range.'; throw 'Incremental search started from invalid range.';
} }
/** @private {ISearchHandler} */
this.handler_;
var leaf = AutomationUtil.findNodePre( var leaf = AutomationUtil.findNodePre(
cursor.node, Dir.FORWARD, AutomationPredicate.leaf) || cursor.node, Dir.FORWARD, AutomationPredicate.leaf) ||
cursor.node; cursor.node;
......
...@@ -271,9 +271,18 @@ PanelNodeMenu = class extends PanelMenu { ...@@ -271,9 +271,18 @@ PanelNodeMenu = class extends PanelMenu {
*/ */
constructor(menuMsg, node, pred, async) { constructor(menuMsg, node, pred, async) {
super(menuMsg); super(menuMsg);
/** @private {AutomationNode} */
this.node_ = node; this.node_ = node;
/** @private {AutomationPredicate.Unary} */
this.pred_ = pred; this.pred_ = pred;
/** @private {boolean} */
this.async_ = async; this.async_ = async;
/** @private {AutomationTreeWalker|undefined} */
this.walker_;
/** @private {number} */
this.nodeCount_ = 0;
/** @private {boolean} */
this.selectNext_ = false;
this.populate_(); this.populate_();
} }
......
...@@ -31,6 +31,9 @@ RangeAutomationHandler = class extends BaseAutomationHandler { ...@@ -31,6 +31,9 @@ RangeAutomationHandler = class extends BaseAutomationHandler {
/** @private {Output} */ /** @private {Output} */
this.lastAttributeOutput_; this.lastAttributeOutput_;
/** @private {number} */
this.delayedAttributeOutputId_ = -1;
ChromeVoxState.addObserver(this); ChromeVoxState.addObserver(this);
} }
...@@ -64,7 +67,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler { ...@@ -64,7 +67,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onEventIfInRange(evt) { onEventIfInRange(evt) {
if (!DesktopAutomationHandler.announceActions && if (!DesktopAutomationHandler.announceActions &&
...@@ -113,7 +116,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler { ...@@ -113,7 +116,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler {
} }
/** /**
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onAriaAttributeChanged(evt) { onAriaAttributeChanged(evt) {
// Don't report changes on editable nodes since they interfere with text // Don't report changes on editable nodes since they interfere with text
...@@ -140,7 +143,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler { ...@@ -140,7 +143,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Provides all feedback once a checked state changed event fires. * Provides all feedback once a checked state changed event fires.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onCheckedStateChanged(evt) { onCheckedStateChanged(evt) {
if (!AutomationPredicate.checkable(evt.target)) { if (!AutomationPredicate.checkable(evt.target)) {
...@@ -155,7 +158,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler { ...@@ -155,7 +158,7 @@ RangeAutomationHandler = class extends BaseAutomationHandler {
/** /**
* Updates the focus ring if the location of the current range, or * Updates the focus ring if the location of the current range, or
* an descendant of the current range, changes. * an descendant of the current range, changes.
* @param {!AutomationEvent} evt * @param {!ChromeVoxEvent} evt
*/ */
onLocationChanged(evt) { onLocationChanged(evt) {
var cur = ChromeVoxState.instance.currentRange; var cur = ChromeVoxState.instance.currentRange;
......
...@@ -68,6 +68,8 @@ BrailleDisplayManager = class { ...@@ -68,6 +68,8 @@ BrailleDisplayManager = class {
* @private * @private
*/ */
this.realDisplayState_ = this.displayState_; this.realDisplayState_ = this.displayState_;
/** @private {number|undefined} */
this.blinkerId_;
translatorManager.addChangeListener(function() { translatorManager.addChangeListener(function() {
this.translateContent_(this.content_, this.expansionType_); this.translateContent_(this.content_, this.expansionType_);
......
...@@ -37,14 +37,8 @@ TextChangeEvent = class { ...@@ -37,14 +37,8 @@ TextChangeEvent = class {
* @param {boolean} triggeredByUser . * @param {boolean} triggeredByUser .
*/ */
constructor(newValue, newStart, newEnd, triggeredByUser) { constructor(newValue, newStart, newEnd, triggeredByUser) {
Object.defineProperty(this, 'value', { /** @private {string} */
get: function() { this.value_ = '';
return this.value_;
}.bind(this),
set: function(val) {
this.value_ = val.replace(/\u00a0/g, ' ');
}.bind(this)
});
this.value = newValue; this.value = newValue;
this.start = newStart; this.start = newStart;
...@@ -58,6 +52,13 @@ TextChangeEvent = class { ...@@ -58,6 +52,13 @@ TextChangeEvent = class {
this.start = tempOffset; this.start = tempOffset;
} }
} }
get value() {
return this.value_;
}
set value(val) {
this.value_ = val.replace(/\u00a0/g, ' ');
}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment