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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui_lazy/FilteredListWidget.js

Issue 2584113002: DevTools: render progress while picking the go-to-file. (Closed)
Patch Set: rebaselined Created 4 years 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_lazy/FilteredListWidget.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FilteredListWidget.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FilteredListWidget.js
index c74eec5f0c77cbe14f69346d04987948002f9bdb..7cb25afe43d69abeea683fee6793bab7e874db82 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FilteredListWidget.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FilteredListWidget.js
@@ -32,6 +32,9 @@ UI.FilteredListWidget = class extends UI.VBox {
promptProxy.addEventListener('input', this._onInput.bind(this), false);
promptProxy.classList.add('filtered-list-widget-prompt-element');
+ this._progressElement = this.contentElement.createChild('div', 'filtered-list-widget-progress');
+ this._progressBarElement = this._progressElement.createChild('div', 'filtered-list-widget-progress-bar');
+
this._filteredItems = [];
this._viewportControl = new UI.ViewportControl(this);
this._itemElementsContainer = this._viewportControl.element;
@@ -75,6 +78,7 @@ UI.FilteredListWidget = class extends UI.VBox {
this._dialog.setPosition(undefined, 22);
this.show(this._dialog.element);
this._dialog.show();
+ this._progressElementWidth = this._progressElement.offsetWidth;
}
/**
@@ -167,6 +171,9 @@ UI.FilteredListWidget = class extends UI.VBox {
this._refreshViewportWithCurrentResult();
}
+ this._progressBarElement.style.transform = 'scaleX(0)';
+ this._progressBarElement.classList.remove('filtered-widget-progress-fade');
+
var query = this._delegate.rewriteQuery(this._value());
this._query = query;
@@ -182,6 +189,8 @@ UI.FilteredListWidget = class extends UI.VBox {
var minBestScore = 0;
var overflowItems = [];
+ var maxWorkItems = Number.constrain(10, 500, (this._delegate.itemCount() / 10) | 0);
+
scoreItems.call(this, 0);
/**
@@ -199,7 +208,6 @@ UI.FilteredListWidget = class extends UI.VBox {
*/
function scoreItems(fromIndex) {
delete this._scoringTimer;
- var maxWorkItems = 1000;
var workDone = 0;
for (var i = fromIndex; i < this._delegate.itemCount() && workDone < maxWorkItems; ++i) {
@@ -235,9 +243,11 @@ UI.FilteredListWidget = class extends UI.VBox {
// Process everything in chunks.
if (i < this._delegate.itemCount()) {
this._scoringTimer = setTimeout(scoreItems.bind(this, i), 0);
+ this._progressBarElement.style.transform = 'scaleX(' + i / this._delegate.itemCount() + ')';
return;
}
-
+ this._progressBarElement.style.transform = 'scaleX(1)';
+ this._progressBarElement.classList.add('filtered-widget-progress-fade');
this._refreshViewportWithCurrentResult();
}
}

Powered by Google App Engine
This is Rietveld 408576698