Address the issue of invalidated nodes in Select to Speak
When a user resize or change a webpage, the selected inline nodes may be invalidated. To address this issue, we reuse the prior STS logic, which converts all selected content into node groups. Then, we send the node groups to TTS one by one. The only entry point for reading new content will be startSpeechQueue_, which uses updateNodeGroups_ to convert nodes into node groups, and start TTS using startCurrentNodeGroup_. This CL also refactored the names of variables and removed unnecessary variables. The prior CLs (http://crrev.com/c/2582524, http://crrev.com/c/2587799, and http://crrev.com/c/2587820) have modified navigation features so that they do not rely on navigationState_ anymore.Thus I implement the following rename and refactor: 1. Rename this.currentNode_ to this.currentNodeGroupItem_ since the variable is actually for a node group item. 2. Rename this.currentNodeGroupIndex_ to this.currentNodeGroupItemIndex_ since the variable is meant to be the index for node group item. 3. Add this.currentNodeGroups_ and this.currentNodeGroupIndex_, which are used for tracking the selected node groups and the current speaking node group. 4. Refactor this.navigationState_.currentCharIndex and this.navigationState_.isUserSelectContent. to this.currentCharIndex_ and this.isUserSelectContent_ to keep code concise. Also, we added a test for the case of invalidated nodes. Test credits to joelriley@google.com. Bug: 1160004 Change-Id: I92e0a1acc25265df476ea248be39d05ec06726d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587565 Commit-Queue: Lei Shi <leileilei@google.com> Reviewed-by:David Tseng <dtseng@chromium.org> Cr-Commit-Position: refs/heads/master@{#839018}
Showing
This diff is collapsed.
Please register or sign in to comment