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

Side by Side Diff: chrome/browser/resources/options/autocomplete_list.js

Issue 6898001: WebUI Prefs: Resize autocomplete list on window resize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/options/browser_options.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 cr.define('options', function() { 5 cr.define('options', function() {
6 const ArrayDataModel = cr.ui.ArrayDataModel; 6 const ArrayDataModel = cr.ui.ArrayDataModel;
7 const List = cr.ui.List; 7 const List = cr.ui.List;
8 const ListItem = cr.ui.ListItem; 8 const ListItem = cr.ui.ListItem;
9 9
10 /** 10 /**
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (!input) 162 if (!input)
163 return; 163 return;
164 164
165 input.removeEventListener('keydown', this.textFieldKeyHandler_); 165 input.removeEventListener('keydown', this.textFieldKeyHandler_);
166 input.removeEventListener('input', this.textFieldInputHandler_); 166 input.removeEventListener('input', this.textFieldInputHandler_);
167 this.targetInput_ = null; 167 this.targetInput_ = null;
168 this.suggestions = []; 168 this.suggestions = [];
169 }, 169 },
170 170
171 /** 171 /**
172 * Makes sure that the suggestion list matches the width of the input it is.
173 * attached to. Should be called any time the input is resized.
174 */
175 syncWidthToInput: function() {
176 var input = this.targetInput_
177 if (!input)
csilv 2011/04/22 00:10:55 I'd prefer to make this more concise by saying: i
178 return;
179
180 this.style.width = input.getBoundingClientRect().width + 'px';
181 },
182
183 /**
172 * The text field the autocomplete popup is currently attached to, if any. 184 * The text field the autocomplete popup is currently attached to, if any.
173 * @return {HTMLElement} 185 * @return {HTMLElement}
174 */ 186 */
175 get targetInput() { 187 get targetInput() {
176 return this.targetInput_; 188 return this.targetInput_;
177 }, 189 },
178 190
179 /** 191 /**
180 * Handles input field key events that should be interpreted as autocomplete 192 * Handles input field key events that should be interpreted as autocomplete
181 * commands. 193 * commands.
(...skipping 22 matching lines...) Expand all
204 event.preventDefault(); 216 event.preventDefault();
205 event.stopPropagation(); 217 event.stopPropagation();
206 } 218 }
207 }, 219 },
208 }; 220 };
209 221
210 return { 222 return {
211 AutocompleteList: AutocompleteList 223 AutocompleteList: AutocompleteList
212 }; 224 };
213 }); 225 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/browser_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698