Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3569)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js

Issue 2903973002: Rich editable text implementation using spannables (Closed)
Patch Set: Text style. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
index e3c8e7f454e4cd8ec81ebc51eb829339ac6f8ea5..d7fb98bd3d933107e56a2177783f2d3442a5c863 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
@@ -75,6 +75,26 @@ var Unit = cursors.Unit;
* is pointed to and covers the case where the accessible text is empty.
*/
cursors.Cursor = function(node, index) {
+ // Compensate for specific issues in Blink.
+ if (node.role == RoleType.STATIC_TEXT && node.name.length == index) {
+ // Re-interpret this case as the beginning of the next node.
dmazzoni 2017/06/07 17:30:13 Add a TODO to take affinity as an argument to Curs
+ var nextNode = AutomationUtil.findNextNode(
+ node, Dir.FORWARD, AutomationPredicate.leafOrStaticText);
+
+ // The exception is when a user types at the end of a line. In that case,
+ // staying on the current node is appropriate.
+ if (nextNode && nextNode.nextOnLine) {
+ node = nextNode;
+ index = 0;
+ }
+ } else if (node.role == RoleType.GENERIC_CONTAINER &&
+ node.state.richlyEditable &&
+ (node.firstChild && (node.firstChild.role == RoleType.LINE_BREAK ||
+ node.firstChild.role == RoleType.STATIC_TEXT))) {
+ // Re-interpret this case as pointing to the text under the div.
+ node = node.find({ role: RoleType.INLINE_TEXT_BOX }) || node;
+ }
+
/** @type {number} @private */
this.index_ = index;
/** @type {Array<AutomationNode>} @private */

Powered by Google App Engine
This is Rietveld 408576698