Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ListControl.js

Issue 2842843003: DevTools: Display product information in ConsoleContextSelector (Closed)
Patch Set: cleanup Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
+
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698