OLD | NEW |
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 * @template T | 6 * @template T |
7 * @interface | 7 * @interface |
8 */ | 8 */ |
9 UI.ListDelegate = function() {}; | 9 UI.ListDelegate = function() {}; |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 /** | 47 /** |
48 * @template T | 48 * @template T |
49 */ | 49 */ |
50 UI.ListControl = class { | 50 UI.ListControl = class { |
51 /** | 51 /** |
52 * @param {!UI.ListDelegate<T>} delegate | 52 * @param {!UI.ListDelegate<T>} delegate |
53 * @param {!UI.ListMode=} mode | 53 * @param {!UI.ListMode=} mode |
54 */ | 54 */ |
55 constructor(delegate, mode) { | 55 constructor(delegate, mode) { |
56 this.element = createElement('div'); | 56 this.element = createElement('div'); |
57 this.element.style.overflow = 'auto'; | 57 this.element.style.overflowY = 'auto'; |
58 this._topElement = this.element.createChild('div'); | 58 this._topElement = this.element.createChild('div'); |
59 this._bottomElement = this.element.createChild('div'); | 59 this._bottomElement = this.element.createChild('div'); |
60 this._firstIndex = 0; | 60 this._firstIndex = 0; |
61 this._lastIndex = 0; | 61 this._lastIndex = 0; |
62 this._renderedHeight = 0; | 62 this._renderedHeight = 0; |
63 this._topHeight = 0; | 63 this._topHeight = 0; |
64 this._bottomHeight = 0; | 64 this._bottomHeight = 0; |
65 | 65 |
66 /** @type {!Array<T>} */ | 66 /** @type {!Array<T>} */ |
67 this._items = []; | 67 this._items = []; |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 this._firstIndex = firstIndex; | 589 this._firstIndex = firstIndex; |
590 this._lastIndex = lastIndex; | 590 this._lastIndex = lastIndex; |
591 this._topHeight = this._offsetAtIndex(firstIndex); | 591 this._topHeight = this._offsetAtIndex(firstIndex); |
592 this._topElement.style.height = this._topHeight + 'px'; | 592 this._topElement.style.height = this._topHeight + 'px'; |
593 this._bottomHeight = totalHeight - this._offsetAtIndex(lastIndex); | 593 this._bottomHeight = totalHeight - this._offsetAtIndex(lastIndex); |
594 this._bottomElement.style.height = this._bottomHeight + 'px'; | 594 this._bottomElement.style.height = this._bottomHeight + 'px'; |
595 this._renderedHeight = totalHeight; | 595 this._renderedHeight = totalHeight; |
596 this.element.scrollTop = scrollTop; | 596 this.element.scrollTop = scrollTop; |
597 } | 597 } |
598 }; | 598 }; |
OLD | NEW |