Title: [98105] trunk/Source/WebCore
Revision
98105
Author
[email protected]
Date
2011-10-21 09:58:58 -0700 (Fri, 21 Oct 2011)

Log Message

Web Inspector: Advanced search is working very slowly and does not show searching progress.
https://bugs.webkit.org/show_bug.cgi?id=70611

Search implementation changed so that we do not start searching in the next file unless
the previous one was already searched. This allows to interrupt search.
Not all search matches are added on UI by default now, only first 20 for each file.
Search progress information and search stop button were added to drawer status bar.

Reviewed by Pavel Feldman.

* English.lproj/localizedStrings.js:
* inspector/ContentSearchUtils.cpp:
(WebCore::ContentSearchUtils::getRegularExpressionMatchesByLines):
(WebCore::ContentSearchUtils::countRegularExpressionMatches):
* inspector/front-end/AdvancedSearchController.js:
(WebInspector.AdvancedSearchController.prototype._onSearchResult):
(WebInspector.AdvancedSearchController.prototype._onSearchFinished):
(WebInspector.AdvancedSearchController.prototype.startSearch):
(WebInspector.AdvancedSearchController.prototype.resetSearch):
(WebInspector.AdvancedSearchController.prototype.stopSearch):
(WebInspector.SearchView):
(WebInspector.SearchView.prototype.get statusBarItems):
(WebInspector.SearchView.prototype.get counterElement):
(WebInspector.SearchView.prototype.set resultsPane):
(WebInspector.SearchView.prototype.searchStarted):
(WebInspector.SearchView.prototype._updateSearchResultsMessage):
(WebInspector.SearchView.prototype._updateSearchProgress):
(WebInspector.SearchView.prototype.resetResults):
(WebInspector.SearchView.prototype._resetCounters):
(WebInspector.SearchView.prototype.nothingFound):
(WebInspector.SearchView.prototype.addSearchResult):
(WebInspector.SearchView.prototype.searchFinished):
(WebInspector.SearchView.prototype._searchStopButtonPressed):
(WebInspector.SearchResultsPane):
(WebInspector.FileBasedSearchResultsPane):
(WebInspector.FileBasedSearchResultsPane.prototype.addSearchResult):
(WebInspector.FileBasedSearchResultsPane.prototype._fileTreeElementExpanded):
(WebInspector.FileBasedSearchResultsPane.prototype._appendSearchMatches):
(WebInspector.FileBasedSearchResultsPane.prototype._appendShowMoreMatchesElement):
(WebInspector.FileBasedSearchResultsPane.prototype._showMoreMatchesElementSelected):
(WebInspector.FileBasedSearchResultsPane.prototype._addFileTreeElement):
(WebInspector.FileBasedSearchResultsPane.prototype._regexMatchRanges):
* inspector/front-end/Drawer.js:
(WebInspector.Drawer.prototype.hide):
* inspector/front-end/Images/statusbarButtonGlyphs.png:
* inspector/front-end/ScriptsSearchScope.js:
(WebInspector.ScriptsSearchScope):
(WebInspector.ScriptsSearchScope.prototype.performSearch.filterOutContentScripts):
(WebInspector.ScriptsSearchScope.prototype.performSearch.continueSearch):
(WebInspector.ScriptsSearchScope.prototype.performSearch.searchCallbackWrapper):
(WebInspector.ScriptsSearchScope.prototype.performSearch):
(WebInspector.ScriptsSearchScope.prototype.stopSearch):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype._registerShortcuts):
* inspector/front-end/inspector.css:
(#drawer-status-bar .search-status-bar-item):
(#drawer-status-bar .search-status-bar-message):
(#drawer-status-bar .search-status-bar-progress):
(#drawer-status-bar .search-status-bar-stop-button-item):
(#drawer-status-bar .search-status-bar-stop-button .glyph):
(#drawer-status-bar .search-results-status-bar-message):
(.search-view .search-results):
(#search-results-pane-file-based .search-results-outline-disclosure):
(#search-results-pane-file-based .search-result):
(#search-results-pane-file-based .search-result:hover):
(#search-results-pane-file-based .show-more-matches):
(#search-results-pane-file-based .show-more-matches:hover):
(#search-results-pane-file-based .search-match:hover):
* inspector/front-end/utilities.js:
():

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98104 => 98105)


--- trunk/Source/WebCore/ChangeLog	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/ChangeLog	2011-10-21 16:58:58 UTC (rev 98105)
@@ -1,3 +1,76 @@
+2011-10-21  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Advanced search is working very slowly and does not show searching progress.
+        https://bugs.webkit.org/show_bug.cgi?id=70611
+
+        Search implementation changed so that we do not start searching in the next file unless
+        the previous one was already searched. This allows to interrupt search.
+        Not all search matches are added on UI by default now, only first 20 for each file.
+        Search progress information and search stop button were added to drawer status bar.
+
+        Reviewed by Pavel Feldman.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/ContentSearchUtils.cpp:
+        (WebCore::ContentSearchUtils::getRegularExpressionMatchesByLines):
+        (WebCore::ContentSearchUtils::countRegularExpressionMatches):
+        * inspector/front-end/AdvancedSearchController.js:
+        (WebInspector.AdvancedSearchController.prototype._onSearchResult):
+        (WebInspector.AdvancedSearchController.prototype._onSearchFinished):
+        (WebInspector.AdvancedSearchController.prototype.startSearch):
+        (WebInspector.AdvancedSearchController.prototype.resetSearch):
+        (WebInspector.AdvancedSearchController.prototype.stopSearch):
+        (WebInspector.SearchView):
+        (WebInspector.SearchView.prototype.get statusBarItems):
+        (WebInspector.SearchView.prototype.get counterElement):
+        (WebInspector.SearchView.prototype.set resultsPane):
+        (WebInspector.SearchView.prototype.searchStarted):
+        (WebInspector.SearchView.prototype._updateSearchResultsMessage):
+        (WebInspector.SearchView.prototype._updateSearchProgress):
+        (WebInspector.SearchView.prototype.resetResults):
+        (WebInspector.SearchView.prototype._resetCounters):
+        (WebInspector.SearchView.prototype.nothingFound):
+        (WebInspector.SearchView.prototype.addSearchResult):
+        (WebInspector.SearchView.prototype.searchFinished):
+        (WebInspector.SearchView.prototype._searchStopButtonPressed):
+        (WebInspector.SearchResultsPane):
+        (WebInspector.FileBasedSearchResultsPane):
+        (WebInspector.FileBasedSearchResultsPane.prototype.addSearchResult):
+        (WebInspector.FileBasedSearchResultsPane.prototype._fileTreeElementExpanded):
+        (WebInspector.FileBasedSearchResultsPane.prototype._appendSearchMatches):
+        (WebInspector.FileBasedSearchResultsPane.prototype._appendShowMoreMatchesElement):
+        (WebInspector.FileBasedSearchResultsPane.prototype._showMoreMatchesElementSelected):
+        (WebInspector.FileBasedSearchResultsPane.prototype._addFileTreeElement):
+        (WebInspector.FileBasedSearchResultsPane.prototype._regexMatchRanges):
+        * inspector/front-end/Drawer.js:
+        (WebInspector.Drawer.prototype.hide):
+        * inspector/front-end/Images/statusbarButtonGlyphs.png:
+        * inspector/front-end/ScriptsSearchScope.js:
+        (WebInspector.ScriptsSearchScope):
+        (WebInspector.ScriptsSearchScope.prototype.performSearch.filterOutContentScripts):
+        (WebInspector.ScriptsSearchScope.prototype.performSearch.continueSearch):
+        (WebInspector.ScriptsSearchScope.prototype.performSearch.searchCallbackWrapper):
+        (WebInspector.ScriptsSearchScope.prototype.performSearch):
+        (WebInspector.ScriptsSearchScope.prototype.stopSearch):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._registerShortcuts):
+        * inspector/front-end/inspector.css:
+        (#drawer-status-bar .search-status-bar-item):
+        (#drawer-status-bar .search-status-bar-message):
+        (#drawer-status-bar .search-status-bar-progress):
+        (#drawer-status-bar .search-status-bar-stop-button-item):
+        (#drawer-status-bar .search-status-bar-stop-button .glyph):
+        (#drawer-status-bar .search-results-status-bar-message):
+        (.search-view .search-results):
+        (#search-results-pane-file-based .search-results-outline-disclosure):
+        (#search-results-pane-file-based .search-result):
+        (#search-results-pane-file-based .search-result:hover):
+        (#search-results-pane-file-based .show-more-matches):
+        (#search-results-pane-file-based .show-more-matches:hover):
+        (#search-results-pane-file-based .search-match:hover):
+        * inspector/front-end/utilities.js:
+        ():
+
 2011-10-20  Zhenyao Mo  <[email protected]>
 
         Implement mechanism to enable privileged webgl extensions

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/ContentSearchUtils.cpp (98104 => 98105)


--- trunk/Source/WebCore/inspector/ContentSearchUtils.cpp	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/inspector/ContentSearchUtils.cpp	2011-10-21 16:58:58 UTC (rev 98105)
@@ -62,6 +62,8 @@
 static Vector<pair<int, String> > getRegularExpressionMatchesByLines(const RegularExpression& regex, const String& text)
 {
     Vector<pair<int, String> > result;
+    if (text.isEmpty())
+        return result;
 
     int lineNumber = 0;
     unsigned start = 0;
@@ -105,6 +107,9 @@
 
 int countRegularExpressionMatches(const RegularExpression& regex, const String& content)
 {
+    if (content.isEmpty())
+        return 0;
+
     int result = 0;
     int position;
     unsigned start = 0;

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


--- trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2011-10-21 16:58:58 UTC (rev 98105)
@@ -83,6 +83,10 @@
         if (searchId !== this._searchId)
             return;
 
+        this._searchView.addSearchResult(searchResult);
+        if (!searchResult.searchMatches.length)
+            return;
+        
         if (!this._searchResultsPane) 
             this._searchResultsPane = this._currentSearchScope.createSearchResultsPane(this._searchConfig);        
         this._searchView.resultsPane = this._searchResultsPane; 
@@ -91,8 +95,9 @@
     
     /**
      * @param {number} searchId
+     * @param {boolean} finished
      */
-    _onSearchFinished: function(searchId)
+    _onSearchFinished: function(searchId, finished)
     {
         if (searchId !== this._searchId)
             return;
@@ -100,7 +105,7 @@
         if (!this._searchResultsPane)
             this._searchView.nothingFound();
         
-        this._searchView.searchFinished();
+        this._searchView.searchFinished(finished);
     },
     
     /**
@@ -108,20 +113,29 @@
      */
     startSearch: function(searchConfig)
     {
-        this.stopSearch();
+        this.resetSearch();
+        ++this._searchId;
 
         this._searchConfig = searchConfig;
         // FIXME: this._currentSearchScope should be initialized based on searchConfig
         this._currentSearchScope = this._searchScope;
 
-        this._searchView.searchStarted();
-        this._currentSearchScope.performSearch(searchConfig, this._onSearchResult.bind(this, this._searchId), this._onSearchFinished.bind(this, this._searchId));
+        var totalSearchResultsCount = this._currentSearchScope.performSearch(searchConfig, this._onSearchResult.bind(this, this._searchId), this._onSearchFinished.bind(this, this._searchId));
+        this._searchView.searchStarted(totalSearchResultsCount);
     },
     
+    resetSearch: function()
+    {
+        this.stopSearch();
+
+        if (this._searchResultsPane) {
+            this._searchView.resetResults();
+            delete this._searchResultsPane;
+        }
+    },
+    
     stopSearch: function()
     {
-        ++this._searchId;
-        delete this._searchResultsPane;
         if (this._currentSearchScope)
             this._currentSearchScope.stopSearch();
     }
@@ -162,7 +176,6 @@
     this._ignoreCaseCheckbox.addStyleClass("search-config-checkbox");
     this._ignoreCaseLabel.appendChild(document.createTextNode(WebInspector.UIString("Ignore case")));
     
-
     this._regexLabel = this._searchPanelElement.createChild("label");
     this._regexLabel.addStyleClass("search-config-label");
     this._regexCheckbox = this._regexLabel.createChild("input");
@@ -170,6 +183,22 @@
     this._regexCheckbox.addStyleClass("search-config-checkbox");
     this._regexLabel.appendChild(document.createTextNode(WebInspector.UIString("Regular _expression_")));
     
+    this._searchStatusBarElement = document.createElement("div");
+    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 = "search-status-bar-stop-button-item";
+    this._searchStopStatusBarButton = new WebInspector.StatusBarButton(WebInspector.UIString("Stop search"), "search-status-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";
+
     this._load();
 }
 
@@ -178,6 +207,22 @@
 
 WebInspector.SearchView.prototype = {
     /**
+     * @type {Array.<Element>}
+     */
+    get statusBarItems()
+    {
+        return [this._searchStatusBarElement];
+    },
+
+    /**
+     * @type {Element}
+     */
+    get counterElement()
+    {
+        return this._searchResultsMessageElement;
+    },
+
+    /**
      * @type {WebInspector.SearchConfig}
      */
     get searchConfig()
@@ -194,31 +239,89 @@
      */
     set resultsPane(resultsPane)
     {
-        this._searchResultsElement.removeChildren();
+        this.resetResults();
         this._searchResultsElement.appendChild(resultsPane.element);
     },
     
-    searchStarted: function()
+    /**
+     * @param {number} totalSearchResultsCount
+     */
+    searchStarted: function(totalSearchResultsCount)
     {
-        // FIXME: This needs better UI.
-        var searchingView = new WebInspector.EmptyView(WebInspector.UIString("Searching..."))
-        this._searchResultsElement.removeChildren();
+        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._updateSearchResultsMessage();
+        
+        var searchingView = new WebInspector.EmptyView(WebInspector.UIString("Searching..."));
         searchingView.show(this._searchResultsElement);
     },
 
+    _updateSearchResultsMessage: function()
+    {
+        if (this._searchMatchesCount && this._searchResultsCount)
+            this._searchResultsMessageElement.textContent = WebInspector.UIString("Found %d matches in %d files.", this._searchMatchesCount, this._nonEmptySearchResultsCount);
+        else
+            this._searchResultsMessageElement.textContent = "";
+    },
+
+    _updateSearchProgress: function()
+    {
+        this._searchProgressElement.setAttribute("max", this._totalSearchResultsCount);
+        this._searchProgressElement.setAttribute("value", this._searchResultsCount);
+    },
+
+    resetResults: function()
+    {
+        this._searchResultsElement.removeChildren();
+    },
+
+    _resetCounters: function()
+    {
+        this._searchMatchesCount = 0;
+        this._searchResultsCount = 0;
+        this._nonEmptySearchResultsCount = 0;
+    },
+
     nothingFound: function()
     {
-        // FIXME: This needs better UI.
-        var notFoundView = new WebInspector.EmptyView(WebInspector.UIString("Nothing found"))
-        this._searchResultsElement.removeChildren();
+        this.resetResults();
+
+        var notFoundView = new WebInspector.EmptyView(WebInspector.UIString("No matches found."));
         notFoundView.show(this._searchResultsElement);
+        this._searchResultsMessageElement.textContent = WebInspector.UIString("No matches found.");
     },
 
-    searchFinished: function()
+    /**
+     * @param {Object} searchResult
+     */
+    addSearchResult: function(searchResult)
     {
-        // FIXME: add message to drawer status bar
+        this._searchMatchesCount += searchResult.searchMatches.length;
+        this._searchResultsCount++;
+        if (searchResult.searchMatches.length)
+            this._nonEmptySearchResultsCount++;
+        this._updateSearchResultsMessage();
+        this._updateSearchProgress();
     },
 
+    /**
+     * @param {boolean} finished
+     */
+    searchFinished: function(finished)
+    {
+        this._searchMessageElement.textContent = finished ? WebInspector.UIString("Search finished.") : WebInspector.UIString("Search interrupted.");
+        this._searchStatusBarElement.removeChild(this._searchProgressElement);
+        this._searchStatusBarElement.removeChild(this._searchStopButtonItem);
+    },
+
     focus: function()
     {
         WebInspector.currentFocusElement = this._search;
@@ -258,6 +361,12 @@
         this._regexCheckbox.checked = searchConfig.isRegex;
     },
     
+    _searchStopButtonPressed: function()
+    {
+        this._controller.stopSearch();
+        this.focus();
+    },
+    
     _onAction: function()
     {
         this._save();
@@ -290,6 +399,8 @@
 WebInspector.SearchScope.prototype = {
     /**
      * @param {WebInspector.SearchConfig} searchConfig
+     * @param {function(Object)} searchResultCallback
+     * @param {function(boolean)} searchFinishedCallback
      */
     performSearch: function(searchConfig, searchResultCallback, searchFinishedCallback) { },
 
@@ -342,10 +453,16 @@
     
     this._treeOutlineElement = document.createElement("ol");
     this._treeOutlineElement.className = "outline-disclosure";
+    this._treeOutlineElement.addStyleClass("search-results-outline-disclosure");
     this.element.appendChild(this._treeOutlineElement);
     this._treeOutline = new TreeOutline(this._treeOutlineElement);
+    
+    this._matchesExpandedCount = 0;
 }
 
+WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount = 20;
+WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce = 20;
+
 WebInspector.FileBasedSearchResultsPane.prototype = {
     /**
      * @param {Object} file
@@ -354,13 +471,13 @@
      * @return {Element}
      */
     createAnchor: function(file, lineNumber, columnNumber) { },
-    
+
     /**
      * @param {Object} file
      * @return {string}
      */
     fileName: function(file) { },
-    
+
     /**
      * @param {Object} searchResult
      */
@@ -370,12 +487,43 @@
         var file = searchResult.file;
         var fileName = this.fileName(file);
         var searchMatches = searchResult.searchMatches;
-            
-        // Expand first file with matches only.
-        var fileTreeElement = this._addFileTreeElement(fileName, searchMatches.length, this._searchResults.length === 1);
+
+        var fileTreeElement = this._addFileTreeElement(fileName, searchMatches.length, this._searchResults.length - 1);
+    },
+
+    /**
+     * @param {Object} searchResult
+     * @param {TreeElement} fileTreeElement
+     */
+    _fileTreeElementExpanded: function(searchResult, fileTreeElement)
+    {
+        if (fileTreeElement._initialized)
+            return;
         
+        var toIndex = Math.min(searchResult.searchMatches.length, WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce);
+        if (toIndex < searchResult.searchMatches.length) {
+            this._appendSearchMatches(fileTreeElement, searchResult, 0, toIndex - 1);
+            this._appendShowMoreMatchesElement(fileTreeElement, searchResult, toIndex - 1);
+        } else
+            this._appendSearchMatches(fileTreeElement, searchResult, 0, toIndex);
+        
+        fileTreeElement._initialized = true;
+    },
+
+    /**
+     * @param {TreeElement} fileTreeElement
+     * @param {Object} searchResult
+     * @param {number} fromIndex
+     * @param {number} toIndex
+     */
+    _appendSearchMatches: function(fileTreeElement, searchResult, fromIndex, toIndex)
+    {
+        var file = searchResult.file;
+        var fileName = this.fileName(file);
+        var searchMatches = searchResult.searchMatches;
+        
         var regex = createSearchRegex(this._searchConfig.query, !this._searchConfig.ignoreCase, this._searchConfig.isRegex);
-        for (var i = 0; i < searchMatches.length; i++) {
+        for (var i = fromIndex; i < toIndex; ++i) {
             var lineNumber = searchMatches[i].lineNumber;
             var lineContent = searchMatches[i].lineContent;
             var matchRanges = this._regexMatchRanges(lineContent, regex);
@@ -398,16 +546,42 @@
             searchMatchElement.listItemElement.appendChild(anchor);
         }
     },
-        
+
     /**
+     * @param {TreeElement} fileTreeElement
+     * @param {Object} searchResult
+     * @param {number} startMatchIndex
+     */
+    _appendShowMoreMatchesElement: function(fileTreeElement, searchResult, startMatchIndex)
+    {
+        var matchesLeftCount = searchResult.searchMatches.length - startMatchIndex;
+        var showMoreMatchesText = WebInspector.UIString("Show all matches (%d more).", matchesLeftCount);
+        var showMoreMatchesElement = new TreeElement(showMoreMatchesText, null, false);
+        fileTreeElement.appendChild(showMoreMatchesElement);
+        showMoreMatchesElement.listItemElement.addStyleClass("show-more-matches");
+        showMoreMatchesElement._onselect_ = this._showMoreMatchesElementSelected.bind(this, searchResult, startMatchIndex);
+    },
+
+    /**
+     * @param {Object} searchResult
+     * @param {number} startMatchIndex
+     * @param {TreeElement} showMoreMatchesElement
+     */
+    _showMoreMatchesElementSelected: function(searchResult, startMatchIndex, showMoreMatchesElement)
+    {
+        var fileTreeElement = showMoreMatchesElement.parent;
+        fileTreeElement.removeChild(showMoreMatchesElement);
+        this._appendSearchMatches(fileTreeElement, searchResult, startMatchIndex, searchResult.searchMatches.length);
+    },
+
+    /**
      * @param {string} fileName
      * @param {number} searchMatchesCount
-     * @param {boolean} expanded
+     * @param {number} searchResultIndex
      */
-    _addFileTreeElement: function(fileName, searchMatchesCount, expanded)
+    _addFileTreeElement: function(fileName, searchMatchesCount, searchResultIndex)
     {
         var fileTreeElement = new TreeElement("", null, true);
-        fileTreeElement.expanded = expanded;
         fileTreeElement.toggleOnClick = true;
         fileTreeElement.selectable = false;
 
@@ -428,6 +602,14 @@
         
         fileTreeElement.listItemElement.appendChild(matchesCountSpan);
         
+        var searchResult = this._searchResults[searchResultIndex];
+        fileTreeElement._onexpand_ = this._fileTreeElementExpanded.bind(this, searchResult);
+
+        // Expand until at least certain amount of matches is expanded.
+        if (this._matchesExpandedCount < WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount)
+            fileTreeElement.expand();
+        this._matchesExpandedCount += searchResult.searchMatches.length;
+
         return fileTreeElement; 
     },
 
@@ -442,7 +624,7 @@
         var match;
         var offset = 0;
         var matchRanges = [];
-        while (match = regex.exec(lineContent))
+        while ((regex.lastIndex < lineContent.length) && (match = regex.exec(lineContent)))
             matchRanges.push({ offset: match.index, length: match[0].length });
         
         return matchRanges;

Modified: trunk/Source/WebCore/inspector/front-end/Drawer.js (98104 => 98105)


--- trunk/Source/WebCore/inspector/front-end/Drawer.js	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/inspector/front-end/Drawer.js	2011-10-21 16:58:58 UTC (rev 98105)
@@ -74,6 +74,8 @@
     show: function(view, animationType)
     {
         this.immediatelyFinishAnimation();
+        if (this._view && this._view.counterElement)
+            this._view.counterElement.parentNode.removeChild(this._view.counterElement);
 
         var drawerWasVisible = this.visible;
 
@@ -87,6 +89,9 @@
         for (var i = 0; i < statusBarItems.length; ++i)
             this._viewStatusBar.appendChild(statusBarItems[i]);
 
+        if (this._view.counterElement)
+            this._counters.insertBefore(this._view.counterElement, this._counters.firstChild);
+
         document.body.addStyleClass("drawer-visible");
         this._view.show(this._drawerContentsElement);
 
@@ -112,7 +117,7 @@
             this._currentPanelCounters.parentNode.removeChild(this._currentPanelCounters);
             this._mainStatusBar.appendChild(this._currentPanelCounters);
         }
-
+        
         function animationFinished()
         {
             WebInspector.currentPanel().statusBarResized();
@@ -167,6 +172,9 @@
             this._mainStatusBar.insertBefore(anchoredItems, this._mainStatusBar.firstChild);
             this._mainStatusBar.style.removeProperty("padding-left");
 
+            if (this._view.counterElement)
+                this._view.counterElement.parentNode.removeChild(this._view.counterElement);
+
             if (this._currentPanelCounters) {
                 this._currentPanelCounters.setAttribute("style", null);
                 this._currentPanelCounters.parentNode.removeChild(this._currentPanelCounters);

Modified: trunk/Source/WebCore/inspector/front-end/Images/statusbarButtonGlyphs.png


(Binary files differ)

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


--- trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsSearchScope.js	2011-10-21 16:58:58 UTC (rev 98105)
@@ -34,53 +34,60 @@
 {
     // FIXME: Add title once it is used by search controller.
     WebInspector.SearchScope.call(this)
+    this._searchId = 0;
 }
 
 WebInspector.ScriptsSearchScope.prototype = {
     /**
      * @param {WebInspector.SearchConfig} searchConfig
      * @param {function(Object)} searchResultCallback
-     * @param {function()} searchFinishedCallback
+     * @param {function(boolean)} searchFinishedCallback
      */
     performSearch: function(searchConfig, searchResultCallback, searchFinishedCallback)
     {
-        var callbacksLeft = 0;
-
-        function maybeSearchFinished()
+        this.stopSearch();
+        
+        var uiSourceCodes = this._sortedUISourceCodes();
+        var uiSourceCodeIndex = 0;
+        
+        function filterOutContentScripts(uiSourceCode)
         {
-            if (callbacksLeft === 0)
-                searchFinishedCallback();                
+            return !uiSourceCode.isContentScript;
         }
         
-        function searchCallbackWrapper(uiSourceCode, searchMatches)
+        // FIXME: Add setting to search in content scripts as well.
+        uiSourceCodes.filter(filterOutContentScripts);
+
+        function continueSearch()
         {
-            if (searchMatches.length) {
-                var searchResult = new WebInspector.FileBasedSearchResultsPane.SearchResult(uiSourceCode, searchMatches);
-                searchResultCallback(searchResult);
+            // FIXME: Enable support for counting matches for incremental search.
+            // FIXME: Enable support for bounding search results/matches number to keep inspector responsive.
+            if (uiSourceCodeIndex < uiSourceCodes.length) {
+                var uiSourceCode = uiSourceCodes[uiSourceCodeIndex++];
+                uiSourceCode.searchInContent(searchConfig.query, !searchConfig.ignoreCase, searchConfig.isRegex, searchCallbackWrapper.bind(this, this._searchId, uiSourceCode));
+            } else 
+                searchFinishedCallback(true);
+        }
+
+        function searchCallbackWrapper(searchId, uiSourceCode, searchMatches)
+        {
+            if (searchId !== this._searchId) {
+                searchFinishedCallback(false);
+                return;
             }
-            --callbacksLeft;
-            maybeSearchFinished();
+                
+            var searchResult = new WebInspector.FileBasedSearchResultsPane.SearchResult(uiSourceCode, searchMatches);
+            searchResultCallback(searchResult);
+            continueSearch.call(this);
         }
         
-        var uiSourceCodes = this._sortedUISourceCodes();
-        // FIXME: Enable support for counting matches for incremental search.
-        // FIXME: Enable support for bounding search results/matches number to keep inspector responsive.
-        for (var i = 0; i < uiSourceCodes.length; i++) {
-            var uiSourceCode = uiSourceCodes[i];
-            // FIXME: Add setting to search in content scripts as well.
-            if (!uiSourceCode.isContentScript) {
-                // Increase callbacksLeft first because searchInContent call could be synchronous.
-                callbacksLeft++;
-                // FIXME: We should not request next searchInContent unless previous one is already finished.  
-                uiSourceCode.searchInContent(searchConfig.query, !searchConfig.ignoreCase, searchConfig.isRegex, searchCallbackWrapper.bind(this, uiSourceCode));
-            }
-        }
-        maybeSearchFinished();
+        continueSearch.call(this);
+        return uiSourceCodes.length;
     },
 
     stopSearch: function()
     {
-        // FIXME: Implement search so that it could be stopped.
+        ++this._searchId;
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (98104 => 98105)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-10-21 16:58:58 UTC (rev 98105)
@@ -255,10 +255,6 @@
         this._shortcuts[shortcut.makeKey("e", modifiers.CtrlOrMeta)] = this._toggleTimelineButtonClicked.bind(this);
         section.addKey(shortcut.shortcutToString("e", modifiers.CtrlOrMeta), WebInspector.UIString("Start/stop recording"));
 
-        var shortRecordThresholdTitle = Number.secondsToString(WebInspector.TimelinePanel.shortRecordThreshold);
-        this._shortcuts[shortcut.makeKey("f", modifiers.Shift | modifiers.CtrlOrMeta)] = this._toggleFilterButtonClicked.bind(this);
-        section.addKey(shortcut.shortcutToString("f", modifiers.Shift | modifiers.CtrlOrMeta), WebInspector.UIString("Filter out records shorter than %s", shortRecordThresholdTitle));
-
         this._shortcuts[shortcut.makeKey("s", modifiers.CtrlOrMeta)] = this._saveToFile.bind(this);
         section.addKey(shortcut.shortcutToString("s", modifiers.CtrlOrMeta), WebInspector.UIString("Save Timeline data\u2026"));
 

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


--- trunk/Source/WebCore/inspector/front-end/inspector.css	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css	2011-10-21 16:58:58 UTC (rev 98105)
@@ -4159,6 +4159,43 @@
     margin-bottom: 6px;
 }
 
+#drawer-status-bar .search-status-bar-item {
+    cursor: pointer;
+    font-size: 11px;
+    height: 23px;
+}
+
+#drawer-status-bar .search-status-bar-message {
+    margin-left:5px;
+    margin-right:5px;
+    margin-top:6px;
+    float:left;
+}
+
+#drawer-status-bar .search-status-bar-progress {
+    height: 10px;
+    width: 100px;
+    margin-top: 8px;
+    float: left;
+}
+
+#drawer-status-bar .search-status-bar-stop-button-item {
+    width: 19px;
+    height: 24px;
+    overflow: hidden;
+}
+
+#drawer-status-bar .search-status-bar-stop-button .glyph {
+    -webkit-mask-position: -96px -48px;
+    background-color: rgb(216, 0, 0) !important;
+}
+
+#drawer-status-bar .search-results-status-bar-message {
+    margin-right: 10px;
+    cursor: default;
+    font-size: 11px;
+}
+
 .search-view .search-results {
     position: absolute;
     top: 35px;
@@ -4166,15 +4203,25 @@
     left: 0;
     right: 0;
     overflow-y: auto;
-    
+}
+
+#search-results-pane-file-based .search-results-outline-disclosure {
     padding-bottom: 5px;
 }
 
 #search-results-pane-file-based .search-result {
     font-size: 12px;
     margin-top: 3px;
+    word-wrap: normal;
+    white-space: pre;
+    cursor: pointer;
 }
 
+#search-results-pane-file-based .search-result:hover {
+    background-color: rgba(121, 121, 121, 0.1);
+    -webkit-border-radius: 5px;
+}
+
 #search-results-pane-file-based .search-result:first-child {
     margin-top: 1px;
 }
@@ -4190,6 +4237,17 @@
     color: #333;
 }
 
+#search-results-pane-file-based .show-more-matches {
+    margin-left: 5px;
+    color: #333;
+    cursor: pointer;
+}
+
+#search-results-pane-file-based .show-more-matches:hover {
+    text-decoration: underline;
+}
+
+
 #search-results-pane-file-based .search-match {
     font-family: 'dejavu sans mono', monospace;
     font-size: 11px;
@@ -4208,7 +4266,7 @@
 
 #search-results-pane-file-based .search-match:hover {
     background-color: rgba(56, 121, 217, 0.1);
-    -webkit-border-radius: 5px;*/
+    -webkit-border-radius: 5px;
 }
 
 #search-results-pane-file-based .search-match .highlighted-match {

Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (98104 => 98105)


--- trunk/Source/WebCore/inspector/front-end/utilities.js	2011-10-21 16:42:19 UTC (rev 98104)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js	2011-10-21 16:58:58 UTC (rev 98105)
@@ -1046,7 +1046,7 @@
 {
     var numberString = value.toString();
     var paddingLength = Math.max(0, symbolsCount - numberString.length);
-    var paddingString = Array(paddingLength).join("\u00a0");
+    var paddingString = Array(paddingLength + 1).join("\u00a0");
     return paddingString + numberString;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to