Title: [125166] trunk/Source/WebCore
Revision
125166
Author
[email protected]
Date
2012-08-09 05:18:18 -0700 (Thu, 09 Aug 2012)

Log Message

Web Inspector: use WebInspector.ProgressIndicator in AdvancedSearchController
https://bugs.webkit.org/show_bug.cgi?id=93362

Reviewed by Vsevolod Vlasov.

- drop custom status bar used in AdvancedSearchController, use WebInspector.ProgressIndicator;
- perform additional cancelation check after invoking searchResultCallback to account for stopSearch called from within callback;
- fix compilation warnings in ProgressBar;

* inspector/front-end/AdvancedSearchController.js:
(WebInspector.SearchView):
(WebInspector.SearchView.prototype.searchStarted):
(WebInspector.SearchView.prototype.addSearchResult):
(WebInspector.SearchView.prototype.searchFinished):
(WebInspector.SearchView.prototype._onCancel):
* inspector/front-end/ProgressBar.js:
(WebInspector.CompositeProgress.prototype.createSubProgress):
* inspector/front-end/ScriptsSearchScope.js:
(WebInspector.ScriptsSearchScope.prototype.performSearch.searchCallbackWrapper):
* inspector/front-end/inspector.css:
(.progress-bar-container progress):
(body.platform-mac .progress-bar-container progress):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125165 => 125166)


--- trunk/Source/WebCore/ChangeLog	2012-08-09 12:08:49 UTC (rev 125165)
+++ trunk/Source/WebCore/ChangeLog	2012-08-09 12:18:18 UTC (rev 125166)
@@ -1,3 +1,28 @@
+2012-08-07  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: use WebInspector.ProgressIndicator in AdvancedSearchController
+        https://bugs.webkit.org/show_bug.cgi?id=93362
+
+        Reviewed by Vsevolod Vlasov.
+
+        - drop custom status bar used in AdvancedSearchController, use WebInspector.ProgressIndicator;
+        - perform additional cancelation check after invoking searchResultCallback to account for stopSearch called from within callback;
+        - fix compilation warnings in ProgressBar;
+
+        * inspector/front-end/AdvancedSearchController.js:
+        (WebInspector.SearchView):
+        (WebInspector.SearchView.prototype.searchStarted):
+        (WebInspector.SearchView.prototype.addSearchResult):
+        (WebInspector.SearchView.prototype.searchFinished):
+        (WebInspector.SearchView.prototype._onCancel):
+        * inspector/front-end/ProgressBar.js:
+        (WebInspector.CompositeProgress.prototype.createSubProgress):
+        * inspector/front-end/ScriptsSearchScope.js:
+        (WebInspector.ScriptsSearchScope.prototype.performSearch.searchCallbackWrapper):
+        * inspector/front-end/inspector.css:
+        (.progress-bar-container progress):
+        (body.platform-mac .progress-bar-container progress):
+
 2012-08-09  Pavel Feldman  <[email protected]>
 
         Web Inspector: improve large array logging experience

Modified: trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js (125165 => 125166)


--- trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2012-08-09 12:08:49 UTC (rev 125165)
+++ trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2012-08-09 12:18:18 UTC (rev 125166)
@@ -211,15 +211,7 @@
     this._searchStatusBarElement.className = "search-status-bar-item";
     this._searchMessageElement = this._searchStatusBarElement.createChild("div");
     this._searchMessageElement.className = "search-status-bar-message";
-    this._searchProgressElement = document.createElement("progress");
-    this._searchProgressElement.className = "search-status-bar-progress";
-    
-    this._searchStopButtonItem = document.createElement("div");
-    this._searchStopButtonItem.className = "progress-bar-stop-button-item";
-    this._searchStopStatusBarButton = new WebInspector.StatusBarButton(WebInspector.UIString("Stop search"), "progress-bar-stop-button");
-    this._searchStopButtonItem.appendChild(this._searchStopStatusBarButton.element);
-    this._searchStopStatusBarButton.addEventListener("click", this._searchStopButtonPressed, this);
-    
+
     this._searchResultsMessageElement = document.createElement("span");
     this._searchResultsMessageElement.className = "search-results-status-bar-message";
 
@@ -262,13 +254,11 @@
     {
         this.resetResults();
         this._resetCounters();
-        
-        this._totalSearchResultsCount = totalSearchResultsCount;
 
         this._searchMessageElement.textContent = WebInspector.UIString("Searching...");
-        this._searchStatusBarElement.appendChild(this._searchProgressElement);
-        this._searchStatusBarElement.appendChild(this._searchStopButtonItem);
-        this._updateSearchProgress();
+        this._progressIndicator = new WebInspector.ProgressIndicator();
+        this._progressIndicator.setTotalWork(totalSearchResultsCount);
+        this._progressIndicator.show(this._searchStatusBarElement);
         
         this._updateSearchResultsMessage();
         
@@ -285,12 +275,6 @@
             this._searchResultsMessageElement.textContent = "";
     },
 
-    _updateSearchProgress: function()
-    {
-        this._searchProgressElement.setAttribute("max", this._totalSearchResultsCount);
-        this._searchProgressElement.setAttribute("value", this._searchResultsCount);
-    },
-
     resetResults: function()
     {
         if (this._searchingView)
@@ -327,7 +311,10 @@
         if (searchResult.searchMatches.length)
             this._nonEmptySearchResultsCount++;
         this._updateSearchResultsMessage();
-        this._updateSearchProgress();
+        if (this._progressIndicator.isCanceled())
+            this._onCancel();
+        else
+            this._progressIndicator.setWorked(this._searchResultsCount);
     },
 
     /**
@@ -335,9 +322,8 @@
      */
     searchFinished: function(finished)
     {
+        this._progressIndicator.done();
         this._searchMessageElement.textContent = finished ? WebInspector.UIString("Search finished.") : WebInspector.UIString("Search interrupted.");
-        this._searchStatusBarElement.removeChild(this._searchProgressElement);
-        this._searchStatusBarElement.removeChild(this._searchStopButtonItem);
     },
 
     focus: function()
@@ -386,7 +372,7 @@
         this._regexCheckbox.checked = searchConfig.isRegex;
     },
 
-    _searchStopButtonPressed: function()
+    _onCancel: function()
     {
         this._controller.stopSearch();
         this.focus();

Modified: trunk/Source/WebCore/inspector/front-end/ProgressBar.js (125165 => 125166)


--- trunk/Source/WebCore/inspector/front-end/ProgressBar.js	2012-08-09 12:08:49 UTC (rev 125165)
+++ trunk/Source/WebCore/inspector/front-end/ProgressBar.js	2012-08-09 12:18:18 UTC (rev 125166)
@@ -165,11 +165,10 @@
 
     /**
      * @param {number=} weight
-     * @param {number=} totalWork
      */
-    createSubProgress: function(weight, totalWork)
+    createSubProgress: function(weight)
     {
-        var child = new WebInspector.SubProgress(this, weight, totalWork);
+        var child = new WebInspector.SubProgress(this, weight);
         this._children.push(child);
         return child;
     },
@@ -194,7 +193,6 @@
  * @implements {WebInspector.Progress}
  * @param {WebInspector.CompositeProgress} composite
  * @param {number=} weight
- * @param {number=} totalWork
  */
 WebInspector.SubProgress = function(composite, weight)
 {

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js (125165 => 125166)


--- trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js	2012-08-09 12:08:49 UTC (rev 125165)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js	2012-08-09 12:18:18 UTC (rev 125166)
@@ -77,9 +77,12 @@
                 searchFinishedCallback(false);
                 return;
             }
-                
             var searchResult = new WebInspector.FileBasedSearchResultsPane.SearchResult(uiSourceCode, searchMatches);
             searchResultCallback(searchResult);
+            if (searchId !== this._searchId) {
+                searchFinishedCallback(false);
+                return;
+            }
             continueSearch.call(this);
         }
         

Modified: trunk/Source/WebCore/inspector/front-end/inspector.css (125165 => 125166)


--- trunk/Source/WebCore/inspector/front-end/inspector.css	2012-08-09 12:08:49 UTC (rev 125165)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css	2012-08-09 12:18:18 UTC (rev 125166)
@@ -2579,20 +2579,6 @@
     float:left;
 }
 
-.search-status-bar-progress {
-    height: 11px;
-    width: 100px;
-    float: left;
-}
-
-body:not(.platform-mac) .search-status-bar-progress {
-    margin-top: 7px;
-}
-
-body.platform-mac .search-status-bar-progress {
-    margin-top: 6px;
-}
-
 .progress-bar-stop-button-item {
     width: 19px;
     height: 24px;
@@ -2888,10 +2874,14 @@
 }
 
 .progress-bar-container progress {
-    margin-top: 8px;
+    margin-top: 7px;
     -webkit-flex: 1 0;
 }
 
+body.platform-mac .progress-bar-container progress {
+    margin-top: 6px;
+}
+
 .progress-bar-container button.status-bar-item {
     border-left: none;
     margin-top: 1px;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to