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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 while (node && node.parentNodeOrShadowHost() !== this.element) | 217 while (node && node.parentNodeOrShadowHost() !== this.element) |
218 node = node.parentNodeOrShadowHost(); | 218 node = node.parentNodeOrShadowHost(); |
219 if (!node) | 219 if (!node) |
220 return null; | 220 return null; |
221 var element = /** @type {!Element} */ (node); | 221 var element = /** @type {!Element} */ (node); |
222 var index = this._items.findIndex(item => this._itemToElement.get(item) === element); | 222 var index = this._items.findIndex(item => this._itemToElement.get(item) === element); |
223 return index !== -1 ? this._items[index] : null; | 223 return index !== -1 ? this._items[index] : null; |
224 } | 224 } |
225 | 225 |
226 /** | 226 /** |
227 * @param {!T} item | |
228 * @return {?Element} | |
229 */ | |
230 elementForItem(item) { | |
einbinder
2017/05/04 07:05:09
This is unused.
eostroukhov
2017/05/04 17:55:51
Right. Removed.
| |
231 return this._itemToElement.get(item); | |
232 } | |
233 | |
234 /** | |
227 * @param {T} item | 235 * @param {T} item |
228 * @param {boolean=} center | 236 * @param {boolean=} center |
229 */ | 237 */ |
230 scrollItemIntoView(item, center) { | 238 scrollItemIntoView(item, center) { |
231 var index = this._items.indexOf(item); | 239 var index = this._items.indexOf(item); |
232 if (index === -1) | 240 if (index === -1) |
233 throw 'Attempt to scroll onto missing item'; | 241 throw 'Attempt to scroll onto missing item'; |
234 this._scrollIntoView(index, center); | 242 this._scrollIntoView(index, center); |
235 } | 243 } |
236 | 244 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 this._firstIndex = firstIndex; | 669 this._firstIndex = firstIndex; |
662 this._lastIndex = lastIndex; | 670 this._lastIndex = lastIndex; |
663 this._topHeight = this._offsetAtIndex(firstIndex); | 671 this._topHeight = this._offsetAtIndex(firstIndex); |
664 this._topElement.style.height = this._topHeight + 'px'; | 672 this._topElement.style.height = this._topHeight + 'px'; |
665 this._bottomHeight = totalHeight - this._offsetAtIndex(lastIndex); | 673 this._bottomHeight = totalHeight - this._offsetAtIndex(lastIndex); |
666 this._bottomElement.style.height = this._bottomHeight + 'px'; | 674 this._bottomElement.style.height = this._bottomHeight + 'px'; |
667 this._renderedHeight = totalHeight; | 675 this._renderedHeight = totalHeight; |
668 this.element.scrollTop = scrollTop; | 676 this.element.scrollTop = scrollTop; |
669 } | 677 } |
670 }; | 678 }; |
OLD | NEW |