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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js

Issue 2916743002: [DevTools] Introduce Common.List used as a backend for list controls (Closed)
Patch Set: Created 3 years, 6 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 */ 309 */
310 updateSuggestions(anchorBox, completions, selectHighestPriority, canShowForSin gleItem, userEnteredText) { 310 updateSuggestions(anchorBox, completions, selectHighestPriority, canShowForSin gleItem, userEnteredText) {
311 this._onlyCompletion = null; 311 this._onlyCompletion = null;
312 if (this._canShowBox(completions, canShowForSingleItem, userEnteredText)) { 312 if (this._canShowBox(completions, canShowForSingleItem, userEnteredText)) {
313 this._userEnteredText = userEnteredText; 313 this._userEnteredText = userEnteredText;
314 314
315 this._show(); 315 this._show();
316 this._updateMaxSize(completions); 316 this._updateMaxSize(completions);
317 this._glassPane.setContentAnchorBox(anchorBox); 317 this._glassPane.setContentAnchorBox(anchorBox);
318 this._list.invalidateItemHeight(); 318 this._list.invalidateItemHeight();
319 this._list.replaceAllItems(completions); 319 this._list.source().replaceAllItems(completions);
320 320
321 if (selectHighestPriority) { 321 if (selectHighestPriority) {
322 var highestPriorityItem = completions[0]; 322 var highestPriorityItem = completions[0];
323 var highestPriority = completions[0].priority || 0; 323 var highestPriority = completions[0].priority || 0;
324 for (var i = 0; i < completions.length; i++) { 324 for (var i = 0; i < completions.length; i++) {
325 var priority = completions[i].priority || 0; 325 var priority = completions[i].priority || 0;
326 if (highestPriority < priority) { 326 if (highestPriority < priority) {
327 highestPriority = priority; 327 highestPriority = priority;
328 highestPriorityItem = completions[i]; 328 highestPriorityItem = completions[i];
329 } 329 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 /** 389 /**
390 * @typedef {!{text: string, subtitle: (string|undefined), iconType: (string|und efined), priority: (number|undefined), isSecondary: (boolean|undefined), title: (string|undefined)}} 390 * @typedef {!{text: string, subtitle: (string|undefined), iconType: (string|und efined), priority: (number|undefined), isSecondary: (boolean|undefined), title: (string|undefined)}}
391 */ 391 */
392 UI.SuggestBox.Suggestion; 392 UI.SuggestBox.Suggestion;
393 393
394 /** 394 /**
395 * @typedef {!Array<!UI.SuggestBox.Suggestion>} 395 * @typedef {!Array<!UI.SuggestBox.Suggestion>}
396 */ 396 */
397 UI.SuggestBox.Suggestions; 397 UI.SuggestBox.Suggestions;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698