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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 | 45 |
46 /** | 46 /** |
47 * @template T | 47 * @template T |
48 */ | 48 */ |
49 UI.ListControl = class { | 49 UI.ListControl = class { |
50 /** | 50 /** |
51 * @param {!UI.ListDelegate<T>} delegate | 51 * @param {!UI.ListDelegate<T>} delegate |
52 */ | 52 */ |
53 constructor(delegate) { | 53 constructor(delegate) { |
54 this.element = createElement('div'); | 54 this.element = createElement('div'); |
55 this.element.style.overflow = 'auto'; | 55 this.element.style.overflowY = 'auto'; |
56 this.element.style.overflowX = 'hidden'; | |
dgozman
2016/12/30 02:30:40
I think this line belongs to clients. I can easily
einbinder
2017/01/03 20:06:53
The ListControl doesn't viewport horizontally, so
einbinder
2017/01/05 18:45:32
That makes sense. Done.
| |
56 this._topElement = this.element.createChild('div'); | 57 this._topElement = this.element.createChild('div'); |
57 this._bottomElement = this.element.createChild('div'); | 58 this._bottomElement = this.element.createChild('div'); |
58 this._firstIndex = 0; | 59 this._firstIndex = 0; |
59 this._lastIndex = 0; | 60 this._lastIndex = 0; |
60 this._renderedHeight = 0; | 61 this._renderedHeight = 0; |
61 this._topHeight = 0; | 62 this._topHeight = 0; |
62 this._bottomHeight = 0; | 63 this._bottomHeight = 0; |
63 this._clearViewport(); | 64 this._clearViewport(); |
64 | 65 |
65 /** @type {!Array<T>} */ | 66 /** @type {!Array<T>} */ |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 this._firstIndex = firstIndex; | 549 this._firstIndex = firstIndex; |
549 this._lastIndex = lastIndex; | 550 this._lastIndex = lastIndex; |
550 this._topHeight = this._offsetAtIndex(firstIndex); | 551 this._topHeight = this._offsetAtIndex(firstIndex); |
551 this._topElement.style.height = this._topHeight + 'px'; | 552 this._topElement.style.height = this._topHeight + 'px'; |
552 this._bottomHeight = totalHeight - this._offsetAtIndex(lastIndex); | 553 this._bottomHeight = totalHeight - this._offsetAtIndex(lastIndex); |
553 this._bottomElement.style.height = this._bottomHeight + 'px'; | 554 this._bottomElement.style.height = this._bottomHeight + 'px'; |
554 this._renderedHeight = totalHeight; | 555 this._renderedHeight = totalHeight; |
555 this.element.scrollTop = scrollTop; | 556 this.element.scrollTop = scrollTop; |
556 } | 557 } |
557 }; | 558 }; |
OLD | NEW |