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

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

Issue 2621773003: Fix ISearch regressions (Closed)
Patch Set: Select search query when re-focused Created 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.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/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:
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698