Changeset 122962 in webkit


Ignore:
Timestamp:
Jul 18, 2012 6:41:07 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: remove search replace from behind experiment, polish the behavior
https://bugs.webkit.org/show_bug.cgi?id=91519

Reviewed by Vsevolod Vlasov.

  • This change makes replace loop with no boundary, removes the loop parameter from jumpToNext/Previous;
  • Lays out replace as a second row
  • Fixes replace all with no search matches
  • Splits Search and Search and Replace
  • Introduces explicit Next / Previous buttons in the search mode
  • Introduces editRange on the TextEditor so that it was preserving the undo stack (we'll need to fix editor so that it does not require it).
  • English.lproj/localizedStrings.js:
  • inspector/front-end/ConsolePanel.js:

(WebInspector.ConsolePanel.prototype.performSearch):
(WebInspector.ConsolePanel.prototype.jumpToNextSearchResult):
(WebInspector.ConsolePanel.prototype.jumpToPreviousSearchResult):

  • inspector/front-end/ElementsPanel.js:

(WebInspector.ElementsPanel.prototype.jumpToNextSearchResult):
(WebInspector.ElementsPanel.prototype.jumpToPreviousSearchResult):

  • inspector/front-end/ExtensionPanel.js:

(WebInspector.ExtensionPanel.prototype.performSearch):
(WebInspector.ExtensionPanel.prototype.jumpToNextSearchResult):
(WebInspector.ExtensionPanel.prototype.jumpToPreviousSearchResult):

  • inspector/front-end/JavaScriptSourceFrame.js:

(WebInspector.JavaScriptSourceFrame.prototype.beforeTextChanged):

  • inspector/front-end/NetworkPanel.js:

(WebInspector.NetworkLogView.prototype.jumpToPreviousSearchResult):
(WebInspector.NetworkLogView.prototype.jumpToNextSearchResult):
(WebInspector.NetworkPanel.prototype.jumpToPreviousSearchResult):
(WebInspector.NetworkPanel.prototype.jumpToNextSearchResult):

  • inspector/front-end/Panel.js:

(WebInspector.Panel.prototype.performSearch):
(WebInspector.Panel.prototype.jumpToNextSearchResult):
(WebInspector.Panel.prototype.jumpToPreviousSearchResult):

  • inspector/front-end/ProfilesPanel.js:

(WebInspector.ProfilesPanel.prototype.jumpToNextSearchResult):
(WebInspector.ProfilesPanel.prototype.jumpToPreviousSearchResult):

  • inspector/front-end/ResourcesPanel.js:

(WebInspector.ResourcesPanel.prototype.jumpToNextSearchResult):
(WebInspector.ResourcesPanel.prototype.jumpToPreviousSearchResult):

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.prototype._editorClosed):
(WebInspector.ScriptsPanel.prototype._editorSelected):
(WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback):
(WebInspector.ScriptsPanel.prototype.performSearch):
(WebInspector.ScriptsPanel.prototype.jumpToNextSearchResult):
(WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult):
(WebInspector.ScriptsPanel.prototype.replaceSelectionWith):
(WebInspector.ScriptsPanel.prototype.replaceAllWith):

  • inspector/front-end/SearchController.js:

(WebInspector.SearchController):
(WebInspector.SearchController.prototype.cancelSearch):
(WebInspector.SearchController.prototype.resetSearch):
(WebInspector.SearchController.prototype.handleShortcut):
(WebInspector.SearchController.prototype._updateSearchNavigationButtonState):
(WebInspector.SearchController.prototype._updateReplaceVisibility):
(WebInspector.SearchController.prototype._onKeyDown):
(WebInspector.SearchController.prototype._onNextButtonSearch):
(WebInspector.SearchController.prototype._onPrevButtonSearch):
(WebInspector.SearchController.prototype._performSearch):
(WebInspector.SearchController.prototype._updateReplaceDetailsVisibility):
(WebInspector.SearchController.prototype._replace):
(WebInspector.SearchController.prototype._replaceAll):

  • inspector/front-end/Settings.js:

(WebInspector.ExperimentsSettings):

  • inspector/front-end/SourceFrame.js:

(WebInspector.SourceFrame.prototype.beforeTextChanged):
(WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
(WebInspector.SourceFrame.prototype.performSearch):
(WebInspector.SourceFrame.prototype.replaceSearchMatchWith):
(WebInspector.SourceFrame.prototype.replaceAllWith):
(WebInspector.TextEditorDelegateForSourceFrame.prototype.beforeTextChanged):

  • inspector/front-end/TextEditor.js:

(WebInspector.TextEditor.prototype.editRange):

  • inspector/front-end/inspector.css:

(.toolbar-search-replace .search-replace):
(.toolbar-search):
(.toolbar-search-replace):
(.toolbar-search-close-button):
(.toolbar-search-close-button:hover):
(.toolbar-search-close-button:active):
(.toolbar-search input[type="checkbox"]):
(.toolbar-search-replace .toolbar-replace-control):

Location:
trunk/Source/WebCore
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122958 r122962  
     12012-07-18  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: remove search replace from behind experiment, polish the behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=91519
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        - This change makes replace loop with no boundary, removes the loop parameter
     9          from jumpToNext/Previous;
     10        - Lays out replace as a second row
     11        - Fixes replace all with no search matches
     12        - Splits Search and Search and Replace
     13        - Introduces explicit Next / Previous buttons in the search mode
     14        - Introduces editRange on the TextEditor so that it was preserving the undo stack
     15          (we'll need to fix editor so that it does not require it).
     16
     17        * English.lproj/localizedStrings.js:
     18        * inspector/front-end/ConsolePanel.js:
     19        (WebInspector.ConsolePanel.prototype.performSearch):
     20        (WebInspector.ConsolePanel.prototype.jumpToNextSearchResult):
     21        (WebInspector.ConsolePanel.prototype.jumpToPreviousSearchResult):
     22        * inspector/front-end/ElementsPanel.js:
     23        (WebInspector.ElementsPanel.prototype.jumpToNextSearchResult):
     24        (WebInspector.ElementsPanel.prototype.jumpToPreviousSearchResult):
     25        * inspector/front-end/ExtensionPanel.js:
     26        (WebInspector.ExtensionPanel.prototype.performSearch):
     27        (WebInspector.ExtensionPanel.prototype.jumpToNextSearchResult):
     28        (WebInspector.ExtensionPanel.prototype.jumpToPreviousSearchResult):
     29        * inspector/front-end/JavaScriptSourceFrame.js:
     30        (WebInspector.JavaScriptSourceFrame.prototype.beforeTextChanged):
     31        * inspector/front-end/NetworkPanel.js:
     32        (WebInspector.NetworkLogView.prototype.jumpToPreviousSearchResult):
     33        (WebInspector.NetworkLogView.prototype.jumpToNextSearchResult):
     34        (WebInspector.NetworkPanel.prototype.jumpToPreviousSearchResult):
     35        (WebInspector.NetworkPanel.prototype.jumpToNextSearchResult):
     36        * inspector/front-end/Panel.js:
     37        (WebInspector.Panel.prototype.performSearch):
     38        (WebInspector.Panel.prototype.jumpToNextSearchResult):
     39        (WebInspector.Panel.prototype.jumpToPreviousSearchResult):
     40        * inspector/front-end/ProfilesPanel.js:
     41        (WebInspector.ProfilesPanel.prototype.jumpToNextSearchResult):
     42        (WebInspector.ProfilesPanel.prototype.jumpToPreviousSearchResult):
     43        * inspector/front-end/ResourcesPanel.js:
     44        (WebInspector.ResourcesPanel.prototype.jumpToNextSearchResult):
     45        (WebInspector.ResourcesPanel.prototype.jumpToPreviousSearchResult):
     46        * inspector/front-end/ScriptsPanel.js:
     47        (WebInspector.ScriptsPanel.prototype._editorClosed):
     48        (WebInspector.ScriptsPanel.prototype._editorSelected):
     49        (WebInspector.ScriptsPanel.prototype.performSearch.finishedCallback):
     50        (WebInspector.ScriptsPanel.prototype.performSearch):
     51        (WebInspector.ScriptsPanel.prototype.jumpToNextSearchResult):
     52        (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult):
     53        (WebInspector.ScriptsPanel.prototype.replaceSelectionWith):
     54        (WebInspector.ScriptsPanel.prototype.replaceAllWith):
     55        * inspector/front-end/SearchController.js:
     56        (WebInspector.SearchController):
     57        (WebInspector.SearchController.prototype.cancelSearch):
     58        (WebInspector.SearchController.prototype.resetSearch):
     59        (WebInspector.SearchController.prototype.handleShortcut):
     60        (WebInspector.SearchController.prototype._updateSearchNavigationButtonState):
     61        (WebInspector.SearchController.prototype._updateReplaceVisibility):
     62        (WebInspector.SearchController.prototype._onKeyDown):
     63        (WebInspector.SearchController.prototype._onNextButtonSearch):
     64        (WebInspector.SearchController.prototype._onPrevButtonSearch):
     65        (WebInspector.SearchController.prototype._performSearch):
     66        (WebInspector.SearchController.prototype._updateReplaceDetailsVisibility):
     67        (WebInspector.SearchController.prototype._replace):
     68        (WebInspector.SearchController.prototype._replaceAll):
     69        * inspector/front-end/Settings.js:
     70        (WebInspector.ExperimentsSettings):
     71        * inspector/front-end/SourceFrame.js:
     72        (WebInspector.SourceFrame.prototype.beforeTextChanged):
     73        (WebInspector.SourceFrame.prototype.performSearch.doFindSearchMatches):
     74        (WebInspector.SourceFrame.prototype.performSearch):
     75        (WebInspector.SourceFrame.prototype.replaceSearchMatchWith):
     76        (WebInspector.SourceFrame.prototype.replaceAllWith):
     77        (WebInspector.TextEditorDelegateForSourceFrame.prototype.beforeTextChanged):
     78        * inspector/front-end/TextEditor.js:
     79        (WebInspector.TextEditor.prototype.editRange):
     80        * inspector/front-end/inspector.css:
     81        (.toolbar-search-replace .search-replace):
     82        (.toolbar-search):
     83        (.toolbar-search-replace):
     84        (.toolbar-search-close-button):
     85        (.toolbar-search-close-button:hover):
     86        (.toolbar-search-close-button:active):
     87        (.toolbar-search input[type="checkbox"]):
     88        (.toolbar-search-replace .toolbar-replace-control):
     89
    1902012-07-18  YoungTaeck Song  <youngtaeck.song@samsung.com>
    291
  • trunk/Source/WebCore/English.lproj/localizedStrings.js

    r122847 r122962  
    724724localizedStrings["Replace"] = "Replace";
    725725localizedStrings["Replace All"] = "Replace All";
    726 localizedStrings["Skip"] = "Skip";
     726localizedStrings["Previous"] = "Previous";
  • trunk/Source/WebCore/inspector/front-end/ConsolePanel.js

    r122847 r122962  
    7979    /**
    8080     * @param {string} query
    81      * @param {boolean} loop
    8281     */
    83     performSearch: function(query, loop)
     82    performSearch: function(query)
    8483    {
    8584        WebInspector.searchController.updateSearchMatchesCount(0, this);
     
    101100    },
    102101
    103     /**
    104      * @param {boolean} loop
    105      * @return {boolean}
    106      */
    107     jumpToNextSearchResult: function(loop)
     102    jumpToNextSearchResult: function()
    108103    {
    109104        if (!this._searchResults || !this._searchResults.length)
    110             return false;
    111         if (!loop && this._currentSearchResultIndex + 1 >= this._searchResults.length)
    112             return false;
     105            return;
    113106        this._jumpToSearchResult((this._currentSearchResultIndex + 1) % this._searchResults.length);
    114         return true;
    115107    },
    116108
    117     /**
    118      * @param {boolean} loop
    119      * @return {boolean}
    120      */
    121     jumpToPreviousSearchResult: function(loop)
     109    jumpToPreviousSearchResult: function()
    122110    {
    123111        if (!this._searchResults || !this._searchResults.length)
    124             return false;
     112            return;
    125113        var index = this._currentSearchResultIndex - 1;
    126         if (index === -1) {
    127             if (!loop)
    128                 return false;
     114        if (index === -1)
    129115            index = this._searchResults.length - 1;
    130         }
    131116        this._jumpToSearchResult(index);
    132117        return true;
  • trunk/Source/WebCore/inspector/front-end/ElementsPanel.js

    r122847 r122962  
    295295    /**
    296296     * @param {string} query
    297      * @param {boolean} loop
    298297     */
    299     performSearch: function(query, loop)
     298    performSearch: function(query)
    300299    {
    301300        // Call searchCanceled since it will reset everything we need before doing a new search.
     
    494493    },
    495494
    496     /**
    497      * @param {boolean} loop
    498      * @return {boolean}
    499      */
    500     jumpToNextSearchResult: function(loop)
     495    jumpToNextSearchResult: function()
    501496    {
    502497        if (!this._searchResults)
    503             return false;
     498            return;
    504499
    505500        this._hideSearchHighlights();
    506         if (++this._currentSearchResultIndex >= this._searchResults.length) {
    507             if (!loop)
    508                 return false;
     501        if (++this._currentSearchResultIndex >= this._searchResults.length)
    509502            this._currentSearchResultIndex = 0;
    510         }
    511            
     503
    512504        this._highlightCurrentSearchResult();
    513         return true;
    514     },
    515 
    516     /**
    517      * @param {boolean} loop
    518      * @return {boolean}
    519      */
    520     jumpToPreviousSearchResult: function(loop)
     505    },
     506
     507    jumpToPreviousSearchResult: function()
    521508    {
    522509        if (!this._searchResults)
    523             return false;
     510            return;
    524511
    525512        this._hideSearchHighlights();
    526         if (--this._currentSearchResultIndex < 0) {
    527             if (!loop)
    528                 return false;
     513        if (--this._currentSearchResultIndex < 0)
    529514            this._currentSearchResultIndex = (this._searchResults.length - 1);
    530         }
    531515
    532516        this._highlightCurrentSearchResult();
  • trunk/Source/WebCore/inspector/front-end/ExtensionPanel.js

    r122847 r122962  
    154154    /**
    155155     * @param {string} query
    156      * @param {boolean} loop
    157      */
    158     performSearch: function(query, loop)
     156     */
     157    performSearch: function(query)
    159158    {
    160159        WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PerformSearch, query);
     
    162161    },
    163162
    164     /**
    165      * @param {boolean} loop
    166      * @return {boolean}
    167      */
    168     jumpToNextSearchResult: function(loop)
     163    jumpToNextSearchResult: function()
    169164    {
    170165        WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.NextSearchResult);
    171         WebInspector.Panel.prototype.jumpToNextSearchResult.call(this, loop);
    172         return true;
    173     },
    174 
    175     /**
    176      * @param {boolean} loop
    177      * @return {boolean}
    178      */
    179     jumpToPreviousSearchResult: function(loop)
     166        WebInspector.Panel.prototype.jumpToNextSearchResult.call(this);
     167    },
     168
     169    jumpToPreviousSearchResult: function()
    180170    {
    181171        WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PreviousSearchResult);
    182         WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this, loop);
    183         return true;
     172        WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this);
    184173    },
    185174
  • trunk/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js

    r122847 r122962  
    155155    },
    156156
    157     beforeTextChanged: function(userInput)
    158     {
    159         WebInspector.SourceFrame.prototype.beforeTextChanged.call(this, userInput);
     157    beforeTextChanged: function()
     158    {
     159        WebInspector.SourceFrame.prototype.beforeTextChanged.call(this);
    160160        this._removeBreakpointsBeforeEditing();
    161161    },
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r122847 r122962  
    11671167    },
    11681168
    1169     /**
    1170      * @param {boolean} loop
    1171      * @return {boolean}
    1172      */
    1173     jumpToPreviousSearchResult: function(loop)
     1169    jumpToPreviousSearchResult: function()
    11741170    {
    11751171        if (!this._matchedRequests.length)
    1176             return false;
    1177         if (!loop && this._currentMatchedRequestIndex <= 0)
    1178             return false;
     1172            return;
    11791173        this._highlightNthMatchedRequest((this._currentMatchedRequestIndex + this._matchedRequests.length - 1) % this._matchedRequests.length, true);
    1180         return true;
    1181     },
    1182 
    1183     /**
    1184      * @param {boolean} loop
    1185      * @return {boolean}
    1186      */
    1187     jumpToNextSearchResult: function(loop)
     1174    },
     1175
     1176    jumpToNextSearchResult: function()
    11881177    {
    11891178        if (!this._matchedRequests.length)
    1190             return false;
    1191         if (!loop && this._currentMatchedRequestIndex + 1 >= this._matchedRequests.length)
    1192             return false;
     1179            return;
    11931180        this._highlightNthMatchedRequest((this._currentMatchedRequestIndex + 1) % this._matchedRequests.length, true);
    1194         return true;
    11951181    },
    11961182
     
    14391425    },
    14401426
    1441     /**
    1442      * @param {boolean} loop
    1443      */
    1444     jumpToPreviousSearchResult: function(loop)
    1445     {
    1446         this._networkLogView.jumpToPreviousSearchResult(loop);
    1447     },
    1448 
    1449     /**
    1450      * @param {boolean} loop
    1451      */
    1452     jumpToNextSearchResult: function(loop)
    1453     {
    1454         this._networkLogView.jumpToNextSearchResult(loop);
     1427    jumpToPreviousSearchResult: function()
     1428    {
     1429        this._networkLogView.jumpToPreviousSearchResult();
     1430    },
     1431
     1432    jumpToNextSearchResult: function()
     1433    {
     1434        this._networkLogView.jumpToNextSearchResult();
    14551435    },
    14561436
  • trunk/Source/WebCore/inspector/front-end/Panel.js

    r122847 r122962  
    109109    /**
    110110     * @param {string} query
    111      * @param {boolean} loop
    112      */
    113     performSearch: function(query, loop)
     111     */
     112    performSearch: function(query)
    114113    {
    115114        // Call searchCanceled since it will reset everything we need before doing a new search.
     
    117116    },
    118117
    119     /**
    120      * @param {boolean} loop
    121      * @return {boolean} true iff operation is successful
    122      */
    123     jumpToNextSearchResult: function(loop)
    124     {
    125         return false;
    126     },
    127 
    128     /**
    129      * @param {boolean} loop
    130      * @return {boolean} true iff operation is successful
    131      */
    132     jumpToPreviousSearchResult: function(loop)
    133     {
    134         return false;
     118    jumpToNextSearchResult: function()
     119    {
     120    },
     121
     122    jumpToPreviousSearchResult: function()
     123    {
    135124    },
    136125
  • trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js

    r122847 r122962  
    740740    /**
    741741     * @param {string} query
    742      * @param {boolean} loop
    743      */
    744     performSearch: function(query, loop)
     742     */
     743    performSearch: function(query)
    745744    {
    746745        this.searchCanceled();
     
    817816    },
    818817
    819     /**
    820      * @param {boolean} loop
    821      * @return {boolean}
    822      */
    823     jumpToNextSearchResult: function(loop)
     818    jumpToNextSearchResult: function()
    824819    {
    825820        if (!this.showView || !this._searchResults || !this._searchResults.length)
    826             return false;
     821            return;
    827822
    828823        var showFirstResult = false;
     
    854849        else
    855850            currentView.jumpToNextSearchResult();
    856         return true;
    857     },
    858 
    859     /**
    860      * @param {boolean} loop
    861      * @return {boolean}
    862      */
    863     jumpToPreviousSearchResult: function(loop)
     851    },
     852
     853    jumpToPreviousSearchResult: function()
    864854    {
    865855        if (!this.showView || !this._searchResults || !this._searchResults.length)
    866             return false;
     856            return;
    867857
    868858        var showLastResult = false;
     
    894884        else
    895885            currentView.jumpToPreviousSearchResult();
    896         return true;
    897886    },
    898887
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r122847 r122962  
    638638    /**
    639639     * @param {string} query
    640      * @param {boolean} loop
    641      */
    642     performSearch: function(query, loop)
     640     */
     641    performSearch: function(query)
    643642    {
    644643        this._resetSearchResults();
     
    750749    },
    751750
    752     /**
    753      * @param {boolean} loop
    754      * @return {boolean}
    755      */
    756     jumpToNextSearchResult: function(loop)
     751    jumpToNextSearchResult: function()
    757752    {
    758753        if (!this.currentSearchMatches)
    759             return false;
     754            return;
    760755        var currentTreeElement = this.sidebarTree.selectedTreeElement;
    761756        var nextSearchResult = this._searchController.nextSearchResult(currentTreeElement);
    762757        this._showSearchResult(nextSearchResult);
    763         return true;
    764     },
    765 
    766     /**
    767      * @param {boolean} loop
    768      * @return {boolean}
    769      */
    770     jumpToPreviousSearchResult: function(loop)
     758    },
     759
     760    jumpToPreviousSearchResult: function()
    771761    {
    772762        if (!this.currentSearchMatches)
    773             return false;
     763            return;
    774764        var currentTreeElement = this.sidebarTree.selectedTreeElement;
    775765        var previousSearchResult = this._searchController.previousSearchResult(currentTreeElement);
    776766        this._showSearchResult(previousSearchResult);
    777         return true;
    778767    },
    779768
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r122847 r122962  
    574574        // ScriptsNavigator does not need to update on EditorClosed.
    575575        this._updateScriptViewStatusBarItems();
     576        WebInspector.searchController.resetSearch();
    576577    },
    577578
     
    582583        this._navigatorController.hideNavigatorOverlay();
    583584        sourceFrame.focus();
     585        WebInspector.searchController.resetSearch();
    584586    },
    585587
     
    879881    /**
    880882     * @param {string} query
    881      * @param {boolean} loop
    882      */
    883     performSearch: function(query, loop)
     883     */
     884    performSearch: function(query)
    884885    {
    885886        WebInspector.searchController.updateSearchMatchesCount(0, this);
     
    900901
    901902            WebInspector.searchController.updateSearchMatchesCount(searchMatches, this);
    902             view.jumpToNextSearchResult(loop);
     903            view.jumpToNextSearchResult();
    903904            WebInspector.searchController.updateCurrentMatchIndex(view.currentSearchResultIndex, this);
    904905        }
     
    907908    },
    908909
    909     /**
    910      * @param {boolean} loop
    911      * @return {boolean}
    912      */
    913     jumpToNextSearchResult: function(loop)
     910    jumpToNextSearchResult: function()
    914911    {
    915912        if (!this._searchView)
    916             return false;
     913            return;
    917914
    918915        if (this._searchView !== this.visibleView) {
    919             this.performSearch(this._searchQuery, loop);
    920             return false;
    921         }
    922 
    923         if (this._searchView.showingLastSearchResult()) {
    924             if (!loop)
    925                 return false;
     916            this.performSearch(this._searchQuery);
     917            return;
     918        }
     919
     920        if (this._searchView.showingLastSearchResult())
    926921            this._searchView.jumpToFirstSearchResult();
    927         } else
     922        else
    928923            this._searchView.jumpToNextSearchResult();
    929924        WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this);
     
    931926    },
    932927
    933     /**
    934      * @param {boolean} loop
    935      */
    936     jumpToPreviousSearchResult: function(loop)
     928    jumpToPreviousSearchResult: function()
    937929    {
    938930        if (!this._searchView)
     
    940932
    941933        if (this._searchView !== this.visibleView) {
    942             this.performSearch(this._searchQuery, loop);
     934            this.performSearch(this._searchQuery);
    943935            if (this._searchView)
    944936                this._searchView.jumpToLastSearchResult();
     
    946938        }
    947939
    948         if (this._searchView.showingFirstSearchResult()) {
    949             if (!loop)
    950                 return false;
     940        if (this._searchView.showingFirstSearchResult())
    951941            this._searchView.jumpToLastSearchResult();
    952         } else
     942        else
    953943            this._searchView.jumpToPreviousSearchResult();
    954944        WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this);
     
    969959    replaceSelectionWith: function(text)
    970960    {
    971         var view = /** @type {WebInspector.SourceFrame} */ this._searchView;
     961        var view = /** @type {WebInspector.SourceFrame} */ this.visibleView;
    972962        view.replaceSearchMatchWith(text);
    973963    },
     
    979969    replaceAllWith: function(query, text)
    980970    {
    981         var view = /** @type {WebInspector.SourceFrame} */ this._searchView;
     971        var view = /** @type {WebInspector.SourceFrame} */ this.visibleView;
    982972        view.replaceAllWith(query, text);
    983973    },
  • trunk/Source/WebCore/inspector/front-end/SearchController.js

    r122847 r122962  
    3535WebInspector.SearchController = function()
    3636{
    37     this._element = document.createElement("div");
     37    this._element = document.createElement("table");
    3838    this._element.className = "toolbar-search";
    39 
    40     var labelElement = this._element.createChild("span");
    41     labelElement.textContent = WebInspector.UIString("Find");
    42 
    43     this._searchControlElement = this._element.createChild("div", "toolbar-search-control");
    44 
     39    this._element.cellSpacing = 0;
     40
     41    this._firstRowElement = this._element.createChild("tr");
     42    this._secondRowElement = this._element.createChild("tr", "hidden");
     43
     44    // Column 1
     45    this._searchControlElement = this._firstRowElement.createChild("td").createChild("span", "toolbar-search-control");
    4546    this._searchInputElement = this._searchControlElement.createChild("input", "search-replace");
    4647    this._searchInputElement.id = "search-input-field";
     48    this._searchInputElement.placeholder = WebInspector.UIString("Find");
    4749
    4850    this._matchesElement = this._searchControlElement.createChild("label", "search-results-matches");
     
    6365    this._searchInputElement.addEventListener("input", this._onInput.bind(this), false);
    6466
    65     this._replaceElement = this._element.createChild("span");
     67    this._replaceInputElement = this._secondRowElement.createChild("td").createChild("input", "search-replace toolbar-replace-control");
     68    this._replaceInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true);
     69    this._replaceInputElement.placeholder = WebInspector.UIString("Replace");
     70
     71    // Column 2
     72    this._findButtonElement = this._firstRowElement.createChild("td").createChild("button", "hidden");
     73    this._findButtonElement.textContent = WebInspector.UIString("Find");
     74    this._findButtonElement.tabIndex = -1;
     75    this._findButtonElement.addEventListener("click", this._onNextButtonSearch.bind(this), false);
     76
     77    this._replaceButtonElement = this._secondRowElement.createChild("td").createChild("button");
     78    this._replaceButtonElement.textContent = WebInspector.UIString("Replace");
     79    this._replaceButtonElement.disabled = true;
     80    this._replaceButtonElement.tabIndex = -1;
     81    this._replaceButtonElement.addEventListener("click", this._replace.bind(this), false);
     82
     83    // Column 3
     84    this._prevButtonElement = this._firstRowElement.createChild("td").createChild("button", "hidden");
     85    this._prevButtonElement.textContent = WebInspector.UIString("Previous");
     86    this._prevButtonElement.disabled = true;
     87    this._prevButtonElement.tabIndex = -1;
     88    this._prevButtonElement.addEventListener("click", this._onPrevButtonSearch.bind(this), false);
     89
     90    this._replaceAllButtonElement = this._secondRowElement.createChild("td").createChild("button");
     91    this._replaceAllButtonElement.textContent = WebInspector.UIString("Replace All");
     92    this._replaceAllButtonElement.addEventListener("click", this._replaceAll.bind(this), false);
     93
     94    // Column 4
     95    this._replaceElement = this._firstRowElement.createChild("td").createChild("span");
    6696
    6797    this._replaceCheckboxElement = this._replaceElement.createChild("input");
    6898    this._replaceCheckboxElement.type = "checkbox";
    6999    this._replaceCheckboxElement.id = "search-replace-trigger";
    70     this._replaceCheckboxElement.tabIndex = -1;
    71     this._replaceCheckboxElement.addEventListener("click", this._toggleReplaceVisibility.bind(this), false);
     100    this._replaceCheckboxElement.addEventListener("click", this._updateSecondRowVisibility.bind(this), false);
    72101
    73102    this._replaceLabelElement = this._replaceElement.createChild("label");
     
    75104    this._replaceLabelElement.setAttribute("for", "search-replace-trigger");
    76105
    77     this._replaceDetailsElement = this._replaceElement.createChild("span", "hidden");
    78 
    79     this._replaceInputElement = this._replaceDetailsElement.createChild("input", "search-replace toolbar-replace-control");
    80     this._replaceInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true);
    81 
    82     this._replaceButtonElement = this._replaceDetailsElement.createChild("button");
    83     this._replaceButtonElement.textContent = WebInspector.UIString("Replace");
    84     this._replaceButtonElement.addEventListener("click", this._replace.bind(this), false);
    85 
    86     this._skipButtonElement = this._replaceDetailsElement.createChild("button");
    87     this._skipButtonElement.textContent = WebInspector.UIString("Skip");
    88     this._skipButtonElement.addEventListener("click", this._onNextButtonSearch.bind(this), false);
    89 
    90     this._replaceAllButtonElement = this._replaceDetailsElement.createChild("button");
    91     this._replaceAllButtonElement.textContent = WebInspector.UIString("Replace All");
    92     this._replaceAllButtonElement.addEventListener("click", this._replaceAll.bind(this), false);
    93 
    94     var closeButtonElement = this._element.createChild("span", "drawer-header-close-button");
    95     closeButtonElement.textContent = WebInspector.UIString("\u00D7");
    96     closeButtonElement.addEventListener("click", this.cancelSearch.bind(this), false);
     106    // Column 5
     107    var cancelButtonElement = this._firstRowElement.createChild("td").createChild("button");
     108    cancelButtonElement.textContent = WebInspector.UIString("Cancel");
     109    cancelButtonElement.tabIndex = -1;
     110    cancelButtonElement.addEventListener("click", this.cancelSearch.bind(this), false);
    97111}
    98112
     
    120134            return;
    121135        delete this._searchIsVisible;
    122         this._performSearch("", false, false, false);
    123136        WebInspector.inspectorView.setFooterElement(null);
    124         this._replaceCheckboxElement.checked = false;
    125         this._toggleReplaceVisibility();
     137        this.resetSearch();
     138    },
     139
     140    resetSearch: function()
     141    {
     142        this._performSearch("", false, false);
     143        this._updateReplaceVisibility();
     144        this._matchesElement.textContent = "";
    126145    },
    127146
    128147    disableSearchUntilExplicitAction: function(event)
    129148    {
    130         this._performSearch("", false, false, false);
     149        this._performSearch("", false, false);
    131150    },
    132151
     
    164183
    165184                if (isMac && event.metaKey && !event.ctrlKey && !event.altKey) {
    166                     if (event.shiftKey) {
    167                         if (currentPanel.jumpToPreviousSearchResult)
    168                             currentPanel.jumpToPreviousSearchResult();
    169                     } else if (currentPanel.jumpToNextSearchResult)
     185                    if (event.shiftKey)
     186                        currentPanel.jumpToPreviousSearchResult();
     187                    else
    170188                        currentPanel.jumpToNextSearchResult();
    171189                    event.consume(true);
     
    179197    _updateSearchNavigationButtonState: function(enabled)
    180198    {
     199        this._replaceButtonElement.disabled = !enabled;
     200        this._prevButtonElement.disabled = !enabled;
    181201        var panel = WebInspector.inspectorView.currentPanel();
    182202        if (enabled) {
     
    212232    {
    213233        var panel = WebInspector.inspectorView.currentPanel();
    214         if (WebInspector.experimentsSettings.searchReplace.isEnabled() && panel.canSearchAndReplace())
     234        if (panel && panel.canSearchAndReplace())
    215235            this._replaceElement.removeStyleClass("hidden");
    216         else
     236        else {
    217237            this._replaceElement.addStyleClass("hidden");
     238            this._replaceCheckboxElement.checked = false;
     239            this._updateSecondRowVisibility();
     240        }
    218241    },
    219242
     
    237260        if (isEnterKey(event)) {
    238261            if (event.target === this._searchInputElement)
    239                 this._performSearch(event.target.value, true, event.shiftKey, true);
     262                this._performSearch(event.target.value, true, event.shiftKey);
    240263            else if (event.target === this._replaceInputElement)
    241264                this._replace();
     
    245268    _onInput: function(event)
    246269    {
    247         this._performSearch(event.target.value, false, false, true);
     270        this._performSearch(event.target.value, false, false);
    248271    },
    249272
     
    251274    {
    252275        // Simulate next search on search-navigation-button click.
    253         this._performSearch(this._searchInputElement.value, true, false, true);
     276        this._performSearch(this._searchInputElement.value, true, false);
    254277        this._searchInputElement.focus();
    255278    },
     
    257280    _onPrevButtonSearch: function(event)
    258281    {
     282        if (!this._searchNavigationPrevElement.hasStyleClass("enabled"))
     283            return;
    259284        // Simulate previous search on search-navigation-button click.
    260         this._performSearch(this._searchInputElement.value, true, true, true);
     285        this._performSearch(this._searchInputElement.value, true, true);
    261286        this._searchInputElement.focus();
    262287    },
     
    266291     * @param {boolean} forceSearch
    267292     * @param {boolean} isBackwardSearch
    268      * @param {boolean} loop
    269293     */
    270     _performSearch: function(query, forceSearch, isBackwardSearch, loop)
     294    _performSearch: function(query, forceSearch, isBackwardSearch)
    271295    {
    272296        if (!query || !query.length) {
     
    277301                var hadCurrentQuery = !!panel.currentQuery;
    278302                delete panel.currentQuery;
    279                 if (hadCurrentQuery && panel.searchCanceled)
     303                if (hadCurrentQuery)
    280304                    panel.searchCanceled();
    281305            }
     
    290314            if (forceSearch) {
    291315                if (!isBackwardSearch)
    292                     currentPanel.jumpToNextSearchResult(loop);
     316                    currentPanel.jumpToNextSearchResult();
    293317                else if (isBackwardSearch)
    294                     currentPanel.jumpToPreviousSearchResult(loop);
     318                    currentPanel.jumpToPreviousSearchResult();
    295319            }
    296320            return;
     
    303327
    304328        currentPanel.currentQuery = query;
    305         currentPanel.performSearch(query, loop);
    306     },
    307 
    308     _toggleReplaceVisibility: function()
    309     {
     329        currentPanel.performSearch(query);
     330    },
     331
     332    _updateSecondRowVisibility: function()
     333    {
     334        if (!this._searchIsVisible)
     335            return;
    310336        if (this._replaceCheckboxElement.checked) {
    311             this._replaceDetailsElement.removeStyleClass("hidden");
     337            this._element.addStyleClass("toolbar-search-replace");
     338            this._secondRowElement.removeStyleClass("hidden");
     339            this._prevButtonElement.removeStyleClass("hidden");
     340            this._findButtonElement.removeStyleClass("hidden");
     341            this._replaceCheckboxElement.tabIndex = -1;
    312342            this._replaceInputElement.focus();
    313         } else
    314             this._replaceDetailsElement.addStyleClass("hidden");
     343        } else {
     344            this._element.removeStyleClass("toolbar-search-replace");
     345            this._secondRowElement.addStyleClass("hidden");
     346            this._prevButtonElement.addStyleClass("hidden");
     347            this._findButtonElement.addStyleClass("hidden");
     348            this._replaceCheckboxElement.tabIndex = 0;
     349            this._searchInputElement.focus();
     350        }
     351        WebInspector.inspectorView.setFooterElement(this._element);
    315352    },
    316353
     
    321358        var query = this._currentQuery;
    322359        delete this._currentQuery;
    323         this._performSearch(query, true, false, false);
     360        this._performSearch(query, true, false);
    324361    },
    325362
     
    327364    {
    328365        var currentPanel = WebInspector.inspectorView.currentPanel();
    329         currentPanel.replaceAllWith(this._currentQuery, this._replaceInputElement.value);
     366        currentPanel.replaceAllWith(this._searchInputElement.value, this._replaceInputElement.value);
    330367    }
    331368}
  • trunk/Source/WebCore/inspector/front-end/Settings.js

    r122847 r122962  
    189189    this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection");
    190190    this.mainThreadMonitoring = this._createExperiment("mainThreadMonitoring", "Show CPU activity in Timeline");
    191     this.searchReplace = this._createExperiment("searchReplace", "Search / Replace");
    192191
    193192    this._cleanUpSetting();
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r122847 r122962  
    271271    },
    272272
    273     /**
    274      * @param {boolean} userInput
    275      */
    276     beforeTextChanged: function(userInput)
    277     {
    278         if (userInput)
     273    beforeTextChanged: function()
     274    {
     275        if (!this._isReplacing)
    279276            WebInspector.searchController.cancelSearch();
    280277        this.clearMessages();
     
    356353            if (shiftToIndex)
    357354                this._searchResults = this._searchResults.rotate(shiftToIndex);
    358            
     355
    359356            callback(this, this._searchResults.length);
    360357        }
     
    432429    replaceSearchMatchWith: function(text)
    433430    {
    434         this.beforeTextChanged(false);
    435 
    436431        var range = this._searchResults[this._currentSearchResultIndex];
    437432        if (!range)
    438433            return;
    439434        this._textEditor.markAndRevealRange(null);
    440         var newRange = this._textModel.editRange(range, text);
    441         this.afterTextChanged(range, newRange);
    442 
    443         // Collapse current match so that we don't replace things twice.
    444         this._textEditor.markAndRevealRange(newRange.collapseToEnd());
     435
     436        this._isReplacing = true;
     437        var newRange = this._textEditor.editRange(range, text);
     438        delete this._isReplacing;
     439
     440        this._textEditor.setSelection(newRange.collapseToEnd());
    445441    },
    446442
     
    451447    replaceAllWith: function(query, replacement)
    452448    {
    453         this.beforeTextChanged(false);
     449        this._textEditor.markAndRevealRange(null);
     450
    454451        var text = this._textModel.text();
    455452        var range = this._textModel.range();
    456453        text = text.replace(WebInspector.SourceFrame.createSearchRegex(query, "g"), replacement);
    457         var newRange = this._textModel.editRange(range, text);
    458         this.afterTextChanged(range, newRange);
     454
     455        this._isReplacing = true;
     456        this._textEditor.editRange(range, text);
     457        delete this._isReplacing;
    459458    },
    460459
     
    646645    beforeTextChanged: function()
    647646    {
    648         this._sourceFrame.beforeTextChanged(true);
     647        this._sourceFrame.beforeTextChanged();
    649648    },
    650649
  • trunk/Source/WebCore/inspector/front-end/TextEditor.js

    r122847 r122962  
    233233    },
    234234
     235    /**
     236     * @param {WebInspector.TextRange} range
     237     * @param {string} text
     238     * @return {WebInspector.TextRange}
     239     */
     240    editRange: function(range, text)
     241    {
     242        this._enterInternalTextChangeMode();
     243        this._textModel.markUndoableState();
     244        var newRange = this._textModel.editRange(range, text);
     245        this._exitInternalTextChangeMode(range, newRange);
     246        return newRange;
     247    },
     248
    235249    _enterInternalTextChangeMode: function()
    236250    {
  • trunk/Source/WebCore/inspector/front-end/inspector.css

    r122847 r122962  
    270270    margin: 0;
    271271    width: 165px;
    272     position: relative;
    273     top: 1px;
    274272}
    275273
    276274.search-replace:focus {
    277275    outline: none;
     276}
     277
     278.toolbar-search {
     279    border-spacing: 1px;
     280}
     281
     282.toolbar-search td {
     283    padding: 0 5px 0 0;
    278284}
    279285
     
    300306}
    301307
    302 .toolbar-search {
    303     line-height: 19px;
    304     height: 22px;
    305 }
    306 
    307308.toolbar-search input[type="checkbox"] {
    308309    position: relative;
     
    315316    border: 1px solid rgb(163, 163, 163);
    316317    border-radius: 12px;
    317     margin: 0 0 0 6px;
     318    margin: 0 6px;
    318319    font-size: 11px;
    319320    background-image: -webkit-linear-gradient(rgb(241, 241, 241), rgb(220, 220, 220));
     321    width: 100%;
    320322}
    321323
     
    329331    background-color: white;
    330332    border: 1px solid rgb(163, 163, 163);
    331     margin: 1px 2px 1px 5px;
    332333    height: 20px;
    333334    border-radius: 2px;
    334     padding-right: 36px;
     335    padding-top: 1px;
    335336}
    336337
     
    339340    height: 20px;
    340341    border-radius: 2px;
    341     margin-left: 5px;
     342    width: 100%;
    342343}
    343344
     
    28672868    font-size: 11px;
    28682869    height: auto;
    2869     padding-left: 5px;
    2870 }
     2870}
Note: See TracChangeset for help on using the changeset viewer.