Title: [92849] trunk/Source/WebCore
Revision
92849
Author
vse...@chromium.org
Date
2011-08-11 07:59:15 -0700 (Thu, 11 Aug 2011)

Log Message

Web Inspector: Scripts panel: display the current search match index in the toolbar.
https://bugs.webkit.org/show_bug.cgi?id=66048

Reviewed by Pavel Feldman.

* English.lproj/localizedStrings.js:
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback):
(WebInspector.ScriptsPanel.prototype.performSearch):
(WebInspector.ScriptsPanel.prototype.jumpToNextSearchResult):
(WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult):
* inspector/front-end/SearchController.js:
(WebInspector.SearchController.prototype.updateSearchMatchesCount):
(WebInspector.SearchController.prototype.updateCurrentMatchIndex):
(WebInspector.SearchController.prototype.activePanelChanged.performPanelSearch):
(WebInspector.SearchController.prototype.activePanelChanged):
(WebInspector.SearchController.prototype._updateSearchMatchesCountAndCurrentMatchIndex):
(WebInspector.SearchController.prototype._performSearch):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype.get currentSearchResultIndex):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92848 => 92849)


--- trunk/Source/WebCore/ChangeLog	2011-08-11 14:43:59 UTC (rev 92848)
+++ trunk/Source/WebCore/ChangeLog	2011-08-11 14:59:15 UTC (rev 92849)
@@ -1,3 +1,26 @@
+2011-08-11  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: Scripts panel: display the current search match index in the toolbar.
+        https://bugs.webkit.org/show_bug.cgi?id=66048
+
+        Reviewed by Pavel Feldman.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback):
+        (WebInspector.ScriptsPanel.prototype.performSearch):
+        (WebInspector.ScriptsPanel.prototype.jumpToNextSearchResult):
+        (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult):
+        * inspector/front-end/SearchController.js:
+        (WebInspector.SearchController.prototype.updateSearchMatchesCount):
+        (WebInspector.SearchController.prototype.updateCurrentMatchIndex):
+        (WebInspector.SearchController.prototype.activePanelChanged.performPanelSearch):
+        (WebInspector.SearchController.prototype.activePanelChanged):
+        (WebInspector.SearchController.prototype._updateSearchMatchesCountAndCurrentMatchIndex):
+        (WebInspector.SearchController.prototype._performSearch):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype.get currentSearchResultIndex):
+
 2011-08-11  Xan Lopez  <xlo...@igalia.com>
 
         [GTK] Add another missing file to GNUmakefile

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


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (92848 => 92849)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-08-11 14:43:59 UTC (rev 92848)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-08-11 14:59:15 UTC (rev 92849)
@@ -1058,6 +1058,7 @@
 
             WebInspector.searchController.updateSearchMatchesCount(searchMatches, this);
             view.jumpToFirstSearchResult();
+            WebInspector.searchController.updateCurrentMatchIndex(view.currentSearchResultIndex + 1, this);
         }
 
         this._searchView.performSearch(query, finishedCallback.bind(this));
@@ -1077,6 +1078,7 @@
             this._searchView.jumpToFirstSearchResult();
         else
             this._searchView.jumpToNextSearchResult();
+        WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex + 1, this);
     },
 
     jumpToPreviousSearchResult: function()
@@ -1095,6 +1097,7 @@
             this._searchView.jumpToLastSearchResult();
         else
             this._searchView.jumpToPreviousSearchResult();
+        WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex + 1, this);
     },
 
     _toggleFormatSourceFiles: function()

Modified: trunk/Source/WebCore/inspector/front-end/SearchController.js (92848 => 92849)


--- trunk/Source/WebCore/inspector/front-end/SearchController.js	2011-08-11 14:43:59 UTC (rev 92848)
+++ trunk/Source/WebCore/inspector/front-end/SearchController.js	2011-08-11 14:59:15 UTC (rev 92849)
@@ -49,9 +49,15 @@
         panel.currentSearchMatches = matches;
 
         if (panel === WebInspector.currentPanel)
-            this._updateSearchMatchesCount(WebInspector.currentPanel.currentQuery && matches);
+            this._updateSearchMatchesCountAndCurrentMatchIndex(WebInspector.currentPanel.currentQuery && matches);
     },
 
+    updateCurrentMatchIndex: function(currentMatchIndex, panel)
+    {
+        if (panel === WebInspector.currentPanel)
+            this._updateSearchMatchesCountAndCurrentMatchIndex(panel.currentSearchMatches, currentMatchIndex);
+    },
+
     updateSearchLabel: function()
     {
         var panelName = WebInspector.currentPanel && WebInspector.currentPanel.toolbarItemLabel;
@@ -123,7 +129,7 @@
         if (panel.performSearch) {
             function performPanelSearch()
             {
-                this._updateSearchMatchesCount();
+                this._updateSearchMatchesCountAndCurrentMatchIndex();
 
                 panel.currentQuery = this._currentQuery;
                 panel.performSearch(this._currentQuery);
@@ -133,11 +139,11 @@
             setTimeout(performPanelSearch.bind(this), 0);
         } else {
             // Update to show Not found for panels that can't be searched.
-            this._updateSearchMatchesCount();
+            this._updateSearchMatchesCountAndCurrentMatchIndex();
         }
     },
 
-    _updateSearchMatchesCount: function(matches)
+    _updateSearchMatchesCountAndCurrentMatchIndex: function(matches, currentMatchIndex)
     {
         if (matches == null) {
             this._matchesElement.addStyleClass("hidden");
@@ -145,10 +151,17 @@
         }
 
         if (matches) {
-            if (matches === 1)
-                var matchesString = WebInspector.UIString("1 match");
-            else
-                var matchesString = WebInspector.UIString("%d matches", matches);
+            if (matches === 1) {
+                if (currentMatchIndex === 1)
+                    var matchesString = WebInspector.UIString("1 of 1 match");
+                else
+                    var matchesString = WebInspector.UIString("1 match");
+            } else {
+                if (currentMatchIndex)
+                    var matchesString = WebInspector.UIString("%d of %d matches", currentMatchIndex, matches);
+                else
+                    var matchesString = WebInspector.UIString("%d matches", matches);
+            }
         } else
             var matchesString = WebInspector.UIString("Not Found");
 
@@ -238,7 +251,7 @@
                     panel.searchCanceled();
             }
 
-            this._updateSearchMatchesCount();
+            this._updateSearchMatchesCountAndCurrentMatchIndex();
 
             return;
         }
@@ -258,7 +271,7 @@
 
         this._currentQuery = query;
 
-        this._updateSearchMatchesCount();
+        this._updateSearchMatchesCountAndCurrentMatchIndex();
 
         if (!currentPanel.performSearch)
             return;

Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (92848 => 92849)


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-08-11 14:43:59 UTC (rev 92848)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-08-11 14:59:15 UTC (rev 92849)
@@ -420,6 +420,11 @@
         return this._searchResults.length && this._currentSearchResultIndex === (this._searchResults.length - 1);
     },
 
+    get currentSearchResultIndex()
+    {
+        return this._currentSearchResultIndex;
+    },
+
     jumpToSearchResult: function(index)
     {
         if (!this.loaded || !this._searchResults.length)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to