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

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

Issue 2968943003: Revert of Expand EditableLine to include non-inline text box leafs (Closed)
Patch Set: Created 3 years, 5 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_test.extjs » ('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/editing.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
index bdd0a1bb8fa58104bc91c19861ddb01dcd2485cd..3b501d41f4da694a721af70f61887582eba29eea 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -556,9 +556,9 @@
// Computed members.
/** @private {Spannable} */
this.value_;
- /** @private {AutomationNode|undefined} */
+ /** @private {AutomationNode} */
this.lineStart_;
- /** @private {AutomationNode|undefined} */
+ /** @private {AutomationNode} */
this.lineEnd_;
/** @private {AutomationNode|undefined} */
this.startContainer_;
@@ -602,27 +602,24 @@
// Annotate each chunk with its associated inline text box node.
this.value_.setSpan(this.lineStart_, 0, nameLen);
- // Also, track the nodes necessary for selection (either their parents, in
- // the case of inline text boxes, or the node itself).
+ // If the current selection is not on an inline text box (e.g. an image),
+ // return early here so that the line contents are just the node. This is
+ // pending the ability to show non-text leaf inline objects.
+ if (this.lineStart_.role != RoleType.INLINE_TEXT_BOX)
+ return;
+
+ // Also, track their static text parents.
var parents = [this.startContainer_];
// Compute the start of line.
var lineStart = this.lineStart_;
-
- // Hack: note underlying bugs require these hacks.
- while ((lineStart.previousOnLine && lineStart.previousOnLine.role) ||
- (lineStart.previousSibling && lineStart.previousSibling.lastChild &&
- lineStart.previousSibling.lastChild.nextOnLine == lineStart)) {
- if (lineStart.previousOnLine)
- lineStart = lineStart.previousOnLine;
- else
- lineStart = lineStart.previousSibling.lastChild;
+ while (lineStart.previousOnLine && lineStart.previousOnLine.role) {
+ lineStart = lineStart.previousOnLine;
+ if (lineStart.role != RoleType.INLINE_TEXT_BOX)
+ continue;
this.lineStart_ = lineStart;
-
- if (lineStart.role != RoleType.INLINE_TEXT_BOX)
- parents.unshift(lineStart);
- else if (parents[0] != lineStart.parent)
+ if (parents[0] != lineStart.parent)
parents.unshift(lineStart.parent);
var prepend = new Spannable(lineStart.name, lineStart);
@@ -632,21 +629,13 @@
this.lineStartContainer_ = this.lineStart_.parent;
var lineEnd = this.lineEnd_;
-
- // Hack: note underlying bugs require these hacks.
- while ((lineEnd.nextOnLine && lineEnd.nextOnLine.role) ||
- (lineEnd.nextSibling &&
- lineEnd.nextSibling.previousOnLine == lineEnd)) {
- if (lineEnd.nextOnLine)
- lineEnd = lineEnd.nextOnLine;
- else
- lineEnd = lineEnd.nextSibling.firstChild;
+ while (lineEnd.nextOnLine && lineEnd.nextOnLine.role) {
+ lineEnd = lineEnd.nextOnLine;
+ if (lineEnd.role != RoleType.INLINE_TEXT_BOX)
+ continue;
this.lineEnd_ = lineEnd;
-
- if (lineEnd.role != RoleType.INLINE_TEXT_BOX)
- parents.push(this.lineEnd_);
- else if (parents[parents.length - 1] != lineEnd.parent)
+ if (parents[parents.length - 1] != lineEnd.parent)
parents.push(this.lineEnd_.parent);
var annotation = lineEnd;
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698