Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js |
index 74e9871a8bca4cbabf95e44f0fa93a2c8643bbb4..100916d547216fe60131efaa3ecd987bc4257425 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js |
@@ -52,8 +52,8 @@ ISearch = function(initialNode) { |
var leaf = AutomationUtil.findNodePre( |
initialNode, Dir.FORWARD, AutomationPredicate.leaf) || initialNode; |
- /** @type {!AutomationNode} @private */ |
- this.node_ = leaf; |
+ /** @type {!cursors.Cursor} */ |
+ this.cursor = cursors.Cursor.fromNode(leaf); |
/** |
* This tracks the id of a search that is in progress. |
@@ -90,19 +90,19 @@ ISearch.prototype = { |
cur = |
cur.move(cursors.Unit.NODE, cursors.Movement.DIRECTIONAL, dir); |
if (prev.equals(cur)) { |
- this.handler_.onSearchReachedBoundary(this.node_); |
+ this.handler_.onSearchReachedBoundary(this.cursor.node); |
return; |
} |
if (cur.getText().toLocaleLowerCase().indexOf(searchStr) != -1) { |
- this.node_ = cur.node; |
- this.handler_.onSearchResultChanged(this.node_); |
+ this.cursor = cur; |
+ this.handler_.onSearchResultChanged(this.cursor.node); |
return; |
} |
if (this.pendingSearchId_ == currentSearchId) |
window.setTimeout(move.bind(this, cur.node), 0); |
}; |
- window.setTimeout(move.bind(this, this.node_), 0); |
+ window.setTimeout(move.bind(this, this.cursor.node), 0); |
} |
}; |
@@ -131,11 +131,16 @@ ISearchUI = function(input) { |
* @param {Element} input |
* @return {ISearchUI} |
*/ |
-ISearchUI.get = function(input) { |
+ISearchUI.init = function(input) { |
if (ISearchUI.instance_) |
ISearchUI.instance_.destroy(); |
+ |
+ if (!input) |
+ return null; |
+ |
ISearchUI.instance_ = new ISearchUI(input); |
input.focus(); |
+ input.select(); |
return ISearchUI.instance_; |
}; |
@@ -159,6 +164,14 @@ ISearchUI.prototype = { |
return false; |
case 'Enter': |
this.pendingSearchId_ = 0; |
+ Panel.setPendingCallback(function() { |
+ var node = this.iSearch_.cursor.node; |
+ if (!node) |
+ return; |
+ chrome.extension.getBackgroundPage().ChromeVoxState.instance[ |
+ 'navigateToRange']( |
+ cursors.Range.fromNode(node)); |
+ }.bind(this)); |
Panel.closeMenusAndRestoreFocus(); |
return false; |
default: |