Commit 92fab4aa authored by Katie D's avatar Katie D Committed by Commit Bot

Add @private and @protected to SelectToSpeak JS functions

Change-Id: I730fa92718409b518c9d9ada04e7378f203c40bd
Reviewed-on: https://chromium-review.googlesource.com/c/1257145Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595928}
parent 58d995bb
......@@ -128,8 +128,8 @@ SelectToSpeak.prototype = {
* Called in response to our hit test after the mouse is released,
* when the user is in a mode where select-to-speak is capturing
* mouse events (for example holding down Search).
*
* @param {!AutomationEvent} evt The automation event.
* @private
*/
onAutomationHitTest_: function(evt) {
// Walk up to the nearest window, web area, toolbar, or dialog that the
......@@ -175,6 +175,7 @@ SelectToSpeak.prototype = {
/**
* Queues up selected text for reading by finding the Position objects
* representing the selection.
* @private
*/
requestSpeakSelectedText_: function(focusedNode) {
// If nothing is selected, return early.
......@@ -249,6 +250,7 @@ SelectToSpeak.prototype = {
* @param {NodeUtils.Position} lastPosition The last position at which to stop
* reading.
* @param {AutomationNode} focusedNode The node with user focus.
* @private
*/
readNodesInSelection_: function(firstPosition, lastPosition, focusedNode) {
let nodes = [];
......@@ -332,6 +334,7 @@ SelectToSpeak.prototype = {
* Gets ready to cancel future scrolling to offscreen nodes as soon as
* a user-initiated scroll is done.
* @param {AutomationNode=} root The root node to listen for events on.
* @private
*/
initializeScrollingToOffscreenNodes_: function(root) {
if (!root) {
......@@ -355,6 +358,7 @@ SelectToSpeak.prototype = {
/**
* Plays a tone to let the user know they did the correct
* keystroke but nothing was selected.
* @private
*/
onNullSelection_: function() {
this.null_selection_tone_.play();
......@@ -367,6 +371,7 @@ SelectToSpeak.prototype = {
* If speech was not in progress, i.e. if the user was drawing
* a focus ring on the screen, this still clears the visual
* focus ring.
* @private
*/
stopAll_: function() {
chrome.tts.stop();
......@@ -377,6 +382,7 @@ SelectToSpeak.prototype = {
/**
* Clears the current focus ring and node, but does
* not stop the speech.
* @private
*/
clearFocusRingAndNode_: function() {
this.clearFocusRing_();
......@@ -392,6 +398,7 @@ SelectToSpeak.prototype = {
/**
* Clears the focus ring, but does not clear the current
* node.
* @private
*/
clearFocusRing_: function() {
chrome.accessibilityPrivate.setFocusRing([]);
......@@ -426,6 +433,7 @@ SelectToSpeak.prototype = {
/**
* Set up event listeners user input.
* @private
*/
setUpEventListeners_: function() {
this.inputHandler_ = new InputHandler({
......@@ -513,6 +521,7 @@ SelectToSpeak.prototype = {
* with any particular nodes, so this does not do any work around drawing
* focus rings, unlike startSpeechQueue_ below.
* @param {string} text The text to speak.
* @private
*/
startSpeech_: function(text) {
this.prepareForSpeech_();
......@@ -537,6 +546,7 @@ SelectToSpeak.prototype = {
* at which to start speaking. If this is not passed, will start at 0.
* @param {number=} opt_endIndex The index into the last node's text
* at which to end speech. If this is not passed, will stop at the end.
* @private
*/
startSpeechQueue_: function(nodes, opt_startIndex, opt_endIndex) {
this.prepareForSpeech_();
......@@ -652,6 +662,7 @@ SelectToSpeak.prototype = {
/**
* Prepares for speech. Call once before chrome.tts.speak is called.
* @private
*/
prepareForSpeech_: function() {
this.cancelIfSpeaking_(true /* clear the focus ring */);
......@@ -666,6 +677,7 @@ SelectToSpeak.prototype = {
/**
* Updates the state.
* @param {!chrome.accessibilityPrivate.SelectToSpeakState} state
* @private
*/
onStateChanged_: function(state) {
if (this.state_ != state) {
......@@ -693,6 +705,7 @@ SelectToSpeak.prototype = {
* where cancel is called twice.
* @param {boolean} clearFocusRing Whether to clear the focus ring
* as well.
* @private
*/
cancelIfSpeaking_: function(clearFocusRing) {
chrome.tts.isSpeaking(MetricsUtils.recordCancelIfSpeaking);
......@@ -711,6 +724,7 @@ SelectToSpeak.prototype = {
* @param {ParagraphUtils.NodeGroupItem} nodeGroupItem The node to use for
* updates.
* @param {boolean} inForeground Whether the node is in the foreground window.
* @private
*/
updateFromNodeState_: function(nodeGroupItem, inForeground) {
switch (NodeUtils.getNodeState(nodeGroupItem.node)) {
......@@ -749,6 +763,7 @@ SelectToSpeak.prototype = {
*
* @param {ParagraphUtils.NodeGroupItem} nodeGroupItem The node to use for
* updates.
* @private
*/
updateHighlightAndFocus_: function(nodeGroupItem) {
if (!this.visible_) {
......@@ -798,6 +813,7 @@ SelectToSpeak.prototype = {
/**
* Tests the active node to make sure the bounds are drawn correctly.
* @private
*/
testCurrentNode_: function() {
if (this.currentNode_ == null) {
......@@ -822,6 +838,7 @@ SelectToSpeak.prototype = {
/**
* Checks that the current node is in the same window as the HitTest node.
* Uses this information to update Select-To-Speak from node state.
* @private
*/
onHitTestCheckCurrentNodeMatches_: function(evt) {
if (this.currentNode_ == null) {
......@@ -856,6 +873,7 @@ SelectToSpeak.prototype = {
* This takes precedence over the charIndex.
* @param {number=} opt_endIndex The index at which to end the highlight. This
* takes precedence over the next word end.
* @private
*/
updateNodeHighlight_: function(
text, charIndex, opt_startIndex, opt_endIndex) {
......@@ -895,6 +913,7 @@ SelectToSpeak.prototype = {
* Fires a mock key down event for testing.
* @param {!Event} event The fake key down event to fire. The object
* must contain at minimum a keyCode.
* @protected
*/
fireMockKeyDownEvent: function(event) {
this.inputHandler_.onKeyDown_(event);
......@@ -904,6 +923,7 @@ SelectToSpeak.prototype = {
* Fires a mock key up event for testing.
* @param {!Event} event The fake key up event to fire. The object
* must contain at minimum a keyCode.
* @protected
*/
fireMockKeyUpEvent: function(event) {
this.inputHandler_.onKeyUp_(event);
......@@ -913,6 +933,7 @@ SelectToSpeak.prototype = {
* Fires a mock mouse down event for testing.
* @param {!Event} event The fake mouse down event to fire. The object
* must contain at minimum a screenX and a screenY.
* @protected
*/
fireMockMouseDownEvent: function(event) {
this.inputHandler_.onMouseDown_(event);
......@@ -922,6 +943,7 @@ SelectToSpeak.prototype = {
* Fires a mock mouse up event for testing.
* @param {!Event} event The fake mouse up event to fire. The object
* must contain at minimum a screenX and a screenY.
* @protected
*/
fireMockMouseUpEvent: function(event) {
this.inputHandler_.onMouseUp_(event);
......@@ -931,6 +953,7 @@ SelectToSpeak.prototype = {
* Function to be called when a state change request is received from the
* accessibilityPrivate API.
* @type {?function()}
* @protected
*/
onStateChangeRequestedCallbackForTest_: null,
};
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