| OLD | NEW | 
|    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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   59     this._maxItemsHeight = maxItemsHeight; |   59     this._maxItemsHeight = maxItemsHeight; | 
|   60     this._captureEnter = captureEnter; |   60     this._captureEnter = captureEnter; | 
|   61     this._rowHeight = 17; |   61     this._rowHeight = 17; | 
|   62     this._userInteracted = false; |   62     this._userInteracted = false; | 
|   63     this._userEnteredText = ''; |   63     this._userEnteredText = ''; | 
|   64     this._defaultSelectionIsDimmed = false; |   64     this._defaultSelectionIsDimmed = false; | 
|   65  |   65  | 
|   66     /** @type {?string} */ |   66     /** @type {?string} */ | 
|   67     this._onlyCompletion = null; |   67     this._onlyCompletion = null; | 
|   68  |   68  | 
 |   69     /** @type {!UI.ListModel<!UI.SuggestBox.Suggestion>} */ | 
 |   70     this._items = new UI.ListModel(); | 
|   69     /** @type {!UI.ListControl<!UI.SuggestBox.Suggestion>} */ |   71     /** @type {!UI.ListControl<!UI.SuggestBox.Suggestion>} */ | 
|   70     this._list = new UI.ListControl(this, UI.ListMode.EqualHeightItems); |   72     this._list = new UI.ListControl(this._items, this, UI.ListMode.EqualHeightIt
     ems); | 
|   71     this._element = this._list.element; |   73     this._element = this._list.element; | 
|   72     this._element.classList.add('suggest-box'); |   74     this._element.classList.add('suggest-box'); | 
|   73     this._element.addEventListener('mousedown', event => event.preventDefault(),
      true); |   75     this._element.addEventListener('mousedown', event => event.preventDefault(),
      true); | 
|   74     this._element.addEventListener('click', this._onClick.bind(this), false); |   76     this._element.addEventListener('click', this._onClick.bind(this), false); | 
|   75  |   77  | 
|   76     this._glassPane = new UI.GlassPane(); |   78     this._glassPane = new UI.GlassPane(); | 
|   77     this._glassPane.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom); |   79     this._glassPane.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom); | 
|   78     this._glassPane.setOutsideClickCallback(this.hide.bind(this)); |   80     this._glassPane.setOutsideClickCallback(this.hide.bind(this)); | 
|   79     var shadowRoot = UI.createShadowRootWithCoreStyles(this._glassPane.contentEl
     ement, 'ui/suggestBox.css'); |   81     var shadowRoot = UI.createShadowRootWithCoreStyles(this._glassPane.contentEl
     ement, 'ui/suggestBox.css'); | 
|   80     shadowRoot.appendChild(this._element); |   82     shadowRoot.appendChild(this._element); | 
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  309    */ |  311    */ | 
|  310   updateSuggestions(anchorBox, completions, selectHighestPriority, canShowForSin
     gleItem, userEnteredText) { |  312   updateSuggestions(anchorBox, completions, selectHighestPriority, canShowForSin
     gleItem, userEnteredText) { | 
|  311     this._onlyCompletion = null; |  313     this._onlyCompletion = null; | 
|  312     if (this._canShowBox(completions, canShowForSingleItem, userEnteredText)) { |  314     if (this._canShowBox(completions, canShowForSingleItem, userEnteredText)) { | 
|  313       this._userEnteredText = userEnteredText; |  315       this._userEnteredText = userEnteredText; | 
|  314  |  316  | 
|  315       this._show(); |  317       this._show(); | 
|  316       this._updateMaxSize(completions); |  318       this._updateMaxSize(completions); | 
|  317       this._glassPane.setContentAnchorBox(anchorBox); |  319       this._glassPane.setContentAnchorBox(anchorBox); | 
|  318       this._list.invalidateItemHeight(); |  320       this._list.invalidateItemHeight(); | 
|  319       this._list.replaceAllItems(completions); |  321       this._items.replaceAllItems(completions); | 
|  320  |  322  | 
|  321       if (selectHighestPriority) { |  323       if (selectHighestPriority) { | 
|  322         var highestPriorityItem = completions[0]; |  324         var highestPriorityItem = completions[0]; | 
|  323         var highestPriority = completions[0].priority || 0; |  325         var highestPriority = completions[0].priority || 0; | 
|  324         for (var i = 0; i < completions.length; i++) { |  326         for (var i = 0; i < completions.length; i++) { | 
|  325           var priority = completions[i].priority || 0; |  327           var priority = completions[i].priority || 0; | 
|  326           if (highestPriority < priority) { |  328           if (highestPriority < priority) { | 
|  327             highestPriority = priority; |  329             highestPriority = priority; | 
|  328             highestPriorityItem = completions[i]; |  330             highestPriorityItem = completions[i]; | 
|  329           } |  331           } | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  388  |  390  | 
|  389 /** |  391 /** | 
|  390  * @typedef {!{text: string, subtitle: (string|undefined), iconType: (string|und
     efined), priority: (number|undefined), isSecondary: (boolean|undefined), title: 
     (string|undefined)}} |  392  * @typedef {!{text: string, subtitle: (string|undefined), iconType: (string|und
     efined), priority: (number|undefined), isSecondary: (boolean|undefined), title: 
     (string|undefined)}} | 
|  391  */ |  393  */ | 
|  392 UI.SuggestBox.Suggestion; |  394 UI.SuggestBox.Suggestion; | 
|  393  |  395  | 
|  394 /** |  396 /** | 
|  395  * @typedef {!Array<!UI.SuggestBox.Suggestion>} |  397  * @typedef {!Array<!UI.SuggestBox.Suggestion>} | 
|  396  */ |  398  */ | 
|  397 UI.SuggestBox.Suggestions; |  399 UI.SuggestBox.Suggestions; | 
| OLD | NEW |