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

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

Issue 1622803002: Cleanup AutomationUtil.findNodeUntil, fix wrapping when moving by line, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2cac7aa204ebb29e16a4e68a61a0f9bf6c6a0409..90c9167f42a1fea3e1e7f3fb679d8c47330c9bca 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
@@ -236,7 +236,7 @@ cursors.Cursor.prototype = {
switch (movement) {
case Movement.BOUND:
newNode = AutomationUtil.findNodeUntil(newNode, dir,
- AutomationPredicate.linebreak, {before: true});
+ AutomationPredicate.linebreak, true);
newNode = newNode || this.node_;
newIndex =
dir == Dir.FORWARD ? this.getText(newNode).length : 0;
@@ -288,10 +288,17 @@ cursors.WrappingCursor.prototype = {
if (movement == Movement.DIRECTIONAL && result.equals(this)) {
var pred = unit == Unit.DOM_NODE ?
AutomationPredicate.leafDomNode : AutomationPredicate.leaf;
- var root = this.node;
- while (!AutomationUtil.isTraversalRoot(root) && root.parent)
- root = root.parent;
- var wrappedNode = AutomationUtil.findNodePre(root, dir, pred);
+ var endpoint = this.node;
+ while (!AutomationUtil.isTraversalRoot(endpoint) && endpoint.parent)
+ endpoint = endpoint.parent;
+ if (dir == Dir.BACKWARD) {
+ while (endpoint.lastChild)
+ endpoint = endpoint.lastChild;
+ }
+ var wrappedNode = endpoint;
+ if (!pred(wrappedNode))
+ wrappedNode = AutomationUtil.findNextNode(endpoint, dir, pred);
+
if (wrappedNode) {
cvox.ChromeVox.earcons.playEarcon(cvox.Earcon.WRAP);
return new cursors.WrappingCursor(wrappedNode, cursors.NODE_INDEX);

Powered by Google App Engine
This is Rietveld 408576698