Changeset 92849 in webkit


Ignore:
Timestamp:
Aug 11, 2011, 7:59:15 AM (14 years ago)
Author:
vsevik@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r92848 r92849  
     12011-08-11  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Scripts panel: display the current search match index in the toolbar.
     4        https://bugs.webkit.org/show_bug.cgi?id=66048
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * English.lproj/localizedStrings.js:
     9        * inspector/front-end/ScriptsPanel.js:
     10        (WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback):
     11        (WebInspector.ScriptsPanel.prototype.performSearch):
     12        (WebInspector.ScriptsPanel.prototype.jumpToNextSearchResult):
     13        (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult):
     14        * inspector/front-end/SearchController.js:
     15        (WebInspector.SearchController.prototype.updateSearchMatchesCount):
     16        (WebInspector.SearchController.prototype.updateCurrentMatchIndex):
     17        (WebInspector.SearchController.prototype.activePanelChanged.performPanelSearch):
     18        (WebInspector.SearchController.prototype.activePanelChanged):
     19        (WebInspector.SearchController.prototype._updateSearchMatchesCountAndCurrentMatchIndex):
     20        (WebInspector.SearchController.prototype._performSearch):
     21        * inspector/front-end/SourceFrame.js:
     22        (WebInspector.SourceFrame.prototype.get currentSearchResultIndex):
     23
    1242011-08-11  Xan Lopez  <xlopez@igalia.com>
    225
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r92842 r92849  
    10591059            WebInspector.searchController.updateSearchMatchesCount(searchMatches, this);
    10601060            view.jumpToFirstSearchResult();
     1061            WebInspector.searchController.updateCurrentMatchIndex(view.currentSearchResultIndex + 1, this);
    10611062        }
    10621063
     
    10781079        else
    10791080            this._searchView.jumpToNextSearchResult();
     1081        WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex + 1, this);
    10801082    },
    10811083
     
    10961098        else
    10971099            this._searchView.jumpToPreviousSearchResult();
     1100        WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex + 1, this);
    10981101    },
    10991102
  • trunk/Source/WebCore/inspector/front-end/SearchController.js

    r87894 r92849  
    5050
    5151        if (panel === WebInspector.currentPanel)
    52             this._updateSearchMatchesCount(WebInspector.currentPanel.currentQuery && matches);
     52            this._updateSearchMatchesCountAndCurrentMatchIndex(WebInspector.currentPanel.currentQuery && matches);
     53    },
     54
     55    updateCurrentMatchIndex: function(currentMatchIndex, panel)
     56    {
     57        if (panel === WebInspector.currentPanel)
     58            this._updateSearchMatchesCountAndCurrentMatchIndex(panel.currentSearchMatches, currentMatchIndex);
    5359    },
    5460
     
    124130            function performPanelSearch()
    125131            {
    126                 this._updateSearchMatchesCount();
     132                this._updateSearchMatchesCountAndCurrentMatchIndex();
    127133
    128134                panel.currentQuery = this._currentQuery;
     
    134140        } else {
    135141            // Update to show Not found for panels that can't be searched.
    136             this._updateSearchMatchesCount();
    137         }
    138     },
    139 
    140     _updateSearchMatchesCount: function(matches)
     142            this._updateSearchMatchesCountAndCurrentMatchIndex();
     143        }
     144    },
     145
     146    _updateSearchMatchesCountAndCurrentMatchIndex: function(matches, currentMatchIndex)
    141147    {
    142148        if (matches == null) {
     
    146152
    147153        if (matches) {
    148             if (matches === 1)
    149                 var matchesString = WebInspector.UIString("1 match");
    150             else
    151                 var matchesString = WebInspector.UIString("%d matches", matches);
     154            if (matches === 1) {
     155                if (currentMatchIndex === 1)
     156                    var matchesString = WebInspector.UIString("1 of 1 match");
     157                else
     158                    var matchesString = WebInspector.UIString("1 match");
     159            } else {
     160                if (currentMatchIndex)
     161                    var matchesString = WebInspector.UIString("%d of %d matches", currentMatchIndex, matches);
     162                else
     163                    var matchesString = WebInspector.UIString("%d matches", matches);
     164            }
    152165        } else
    153166            var matchesString = WebInspector.UIString("Not Found");
     
    239252            }
    240253
    241             this._updateSearchMatchesCount();
     254            this._updateSearchMatchesCountAndCurrentMatchIndex();
    242255
    243256            return;
     
    259272        this._currentQuery = query;
    260273
    261         this._updateSearchMatchesCount();
     274        this._updateSearchMatchesCountAndCurrentMatchIndex();
    262275
    263276        if (!currentPanel.performSearch)
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r92766 r92849  
    421421    },
    422422
     423    get currentSearchResultIndex()
     424    {
     425        return this._currentSearchResultIndex;
     426    },
     427
    423428    jumpToSearchResult: function(index)
    424429    {
Note: See TracChangeset for help on using the changeset viewer.