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

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

Issue 2442503008: Fix editable text selection (Closed)
Patch Set: Created 4 years, 2 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 | no next file » | 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 a2ca0be8bf2991756cd32a01749b5fd3585986a0..fdce2f65ac81c33f693364f60794aca038e288b6 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
@@ -166,6 +166,10 @@ cursors.Cursor.prototype = {
if (!adjustedNode)
return null;
+ // Make no adjustments if we're within editable content.
+ if (adjustedNode.state.editable)
+ return adjustedNode;
+
// Selections over line break nodes are broken.
var parent = adjustedNode.parent;
var grandparent = parent && parent.parent;
@@ -197,8 +201,13 @@ cursors.Cursor.prototype = {
get selectionIndex_() {
var adjustedIndex = this.index_;
- // Selecting things under a line break is currently broken.
- if (this.node.role == RoleType.inlineTextBox &&
+ if (!this.node)
+ return -1;
+
+ if (this.node.state.editable) {
+ return this.index_ == cursors.NODE_INDEX ? 0 : this.index_;
+ } else if (this.node.role == RoleType.inlineTextBox &&
+ // Selections under a line break are broken.
this.node.parent && this.node.parent.role != RoleType.lineBreak) {
if (adjustedIndex == cursors.NODE_INDEX)
adjustedIndex = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698