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

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

Issue 2903973002: Rich editable text implementation using spannables (Closed)
Patch Set: Make boolean expressions explicit. Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b3e95556bf0f20b6d1b6711937e99fc645581992 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
@@ -75,6 +75,27 @@ 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.
+ // TODO(dtseng): Pass through affinity; if upstream, skip below.
+ if (node.role == RoleType.STATIC_TEXT && node.name.length == index) {
+ // Re-interpret this case as the beginning of the next node.
+ 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 (node && node.nextOnLine && nextNode) {
+ 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 */
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698