Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/ui/ListControl.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ListControl.js b/third_party/WebKit/Source/devtools/front_end/ui/ListControl.js |
| index b55c2034cdfbfaaa3619d0e399d2c49445532b4f..d40d09fa04aacf093b16583cb35b844f7dc4701e 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/ui/ListControl.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/ListControl.js |
| @@ -181,6 +181,23 @@ UI.ListControl = class { |
| this.replaceItemsInRange(0, this._items.length, items); |
| } |
| + |
|
dgozman
2017/05/08 23:16:47
nit: remove extra blank line
einbinder
2017/05/09 22:00:45
Done.
|
| + refreshAllItems() { |
| + this.refreshItemsInRange(0, this._items.length); |
| + } |
| + |
| + /** |
| + * @param {number} from |
| + * @param {number} to |
| + */ |
| + refreshItemsInRange(from, to) { |
| + for (var i = from; i < to; i++) |
| + this._itemToElement.delete(this._items[i]); |
| + this.invalidateRange(from, to); |
| + if (this._selectedIndex !== -1) |
| + this._select(this._selectedIndex, null, null); |
| + } |
| + |
| /** |
| * @param {number} from |
| * @param {number} to |
| @@ -244,8 +261,9 @@ UI.ListControl = class { |
| /** |
| * @param {?T} item |
| * @param {boolean=} center |
| + * @param {boolean=} dontScroll |
| */ |
| - selectItem(item, center) { |
| + selectItem(item, center, dontScroll) { |
| var index = -1; |
| if (item !== null) { |
| index = this._items.indexOf(item); |
| @@ -256,7 +274,7 @@ UI.ListControl = class { |
| } |
| if (this._selectedIndex !== index) |
| this._select(index); |
| - if (index !== -1) |
| + if (index !== -1 && !dontScroll) |
| this._scrollIntoView(index, center); |
| } |