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

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

Issue 2412433004: Recovery: Implement focus recovery across root AutomationNodes (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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Objects related to incremental search. 6 * @fileoverview Objects related to incremental search.
7 */ 7 */
8 8
9 goog.provide('ISearch'); 9 goog.provide('ISearch');
10 goog.provide('ISearchHandler'); 10 goog.provide('ISearchHandler');
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 this.background_ = 116 this.background_ =
117 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; 117 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance'];
118 this.iSearch_ = new ISearch(this.background_.currentRange.start.node); 118 this.iSearch_ = new ISearch(this.background_.currentRange.start.node);
119 this.input_ = input; 119 this.input_ = input;
120 this.dir_ = Dir.FORWARD; 120 this.dir_ = Dir.FORWARD;
121 this.iSearch_.handler = this; 121 this.iSearch_.handler = this;
122 122
123 this.onKeyDown = this.onKeyDown.bind(this); 123 this.onKeyDown = this.onKeyDown.bind(this);
124 this.onTextInput = this.onTextInput.bind(this); 124 this.onTextInput = this.onTextInput.bind(this);
125 125
126 this.background_['startExcursion']();
127 input.addEventListener('keydown', this.onKeyDown, true); 126 input.addEventListener('keydown', this.onKeyDown, true);
128 input.addEventListener('textInput', this.onTextInput, true); 127 input.addEventListener('textInput', this.onTextInput, true);
129 }; 128 };
130 129
131 /** 130 /**
132 * @param {Element} input 131 * @param {Element} input
133 * @return {ISearchUI} 132 * @return {ISearchUI}
134 */ 133 */
135 ISearchUI.get = function(input) { 134 ISearchUI.get = function(input) {
136 if (ISearchUI.instance_) 135 if (ISearchUI.instance_)
(...skipping 12 matching lines...) Expand all
149 onKeyDown: function(evt) { 148 onKeyDown: function(evt) {
150 switch (evt.key) { 149 switch (evt.key) {
151 case 'ArrowUp': 150 case 'ArrowUp':
152 this.dir_ = Dir.BACKWARD; 151 this.dir_ = Dir.BACKWARD;
153 break; 152 break;
154 case 'ArrowDown': 153 case 'ArrowDown':
155 this.dir_ = Dir.FORWARD; 154 this.dir_ = Dir.FORWARD;
156 break; 155 break;
157 case 'Escape': 156 case 'Escape':
158 this.pendingSearchId_ = 0; 157 this.pendingSearchId_ = 0;
159 this.background_['endExcursion']();
160 Panel.closeMenusAndRestoreFocus(); 158 Panel.closeMenusAndRestoreFocus();
161 return false; 159 return false;
162 case 'Enter': 160 case 'Enter':
163 this.pendingSearchId_ = 0; 161 this.pendingSearchId_ = 0;
164 this.background_['saveExcursion']();
165 Panel.closeMenusAndRestoreFocus(); 162 Panel.closeMenusAndRestoreFocus();
166 return false; 163 return false;
167 default: 164 default:
168 this.pendingSearchId_ = 0; 165 this.pendingSearchId_ = 0;
169 return false; 166 return false;
170 } 167 }
171 this.iSearch_.search(this.input_.value, this.dir_); 168 this.iSearch_.search(this.input_.value, this.dir_);
172 evt.preventDefault(); 169 evt.preventDefault();
173 evt.stopPropagation(); 170 evt.stopPropagation();
174 return false; 171 return false;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 this.iSearch_.handler_ = null; 213 this.iSearch_.handler_ = null;
217 this.iSearch_ = null; 214 this.iSearch_ = null;
218 var input = this.input_; 215 var input = this.input_;
219 this.input_ = null; 216 this.input_ = null;
220 input.removeEventListener('keydown', this.onKeyDown, true); 217 input.removeEventListener('keydown', this.onKeyDown, true);
221 input.removeEventListener('textInput', this.onTextInput, true); 218 input.removeEventListener('textInput', this.onTextInput, true);
222 } 219 }
223 }; 220 };
224 221
225 }); // goog.scope 222 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698