Changeset 122962 in webkit
- Timestamp:
- Jul 18, 2012 6:41:07 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122958 r122962 1 2012-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 1 90 2012-07-18 YoungTaeck Song <youngtaeck.song@samsung.com> 2 91 -
trunk/Source/WebCore/English.lproj/localizedStrings.js
r122847 r122962 724 724 localizedStrings["Replace"] = "Replace"; 725 725 localizedStrings["Replace All"] = "Replace All"; 726 localizedStrings[" Skip"] = "Skip";726 localizedStrings["Previous"] = "Previous"; -
trunk/Source/WebCore/inspector/front-end/ConsolePanel.js
r122847 r122962 79 79 /** 80 80 * @param {string} query 81 * @param {boolean} loop82 81 */ 83 performSearch: function(query , loop)82 performSearch: function(query) 84 83 { 85 84 WebInspector.searchController.updateSearchMatchesCount(0, this); … … 101 100 }, 102 101 103 /** 104 * @param {boolean} loop 105 * @return {boolean} 106 */ 107 jumpToNextSearchResult: function(loop) 102 jumpToNextSearchResult: function() 108 103 { 109 104 if (!this._searchResults || !this._searchResults.length) 110 return false; 111 if (!loop && this._currentSearchResultIndex + 1 >= this._searchResults.length) 112 return false; 105 return; 113 106 this._jumpToSearchResult((this._currentSearchResultIndex + 1) % this._searchResults.length); 114 return true;115 107 }, 116 108 117 /** 118 * @param {boolean} loop 119 * @return {boolean} 120 */ 121 jumpToPreviousSearchResult: function(loop) 109 jumpToPreviousSearchResult: function() 122 110 { 123 111 if (!this._searchResults || !this._searchResults.length) 124 return false;112 return; 125 113 var index = this._currentSearchResultIndex - 1; 126 if (index === -1) { 127 if (!loop) 128 return false; 114 if (index === -1) 129 115 index = this._searchResults.length - 1; 130 }131 116 this._jumpToSearchResult(index); 132 117 return true; -
trunk/Source/WebCore/inspector/front-end/ElementsPanel.js
r122847 r122962 295 295 /** 296 296 * @param {string} query 297 * @param {boolean} loop298 297 */ 299 performSearch: function(query , loop)298 performSearch: function(query) 300 299 { 301 300 // Call searchCanceled since it will reset everything we need before doing a new search. … … 494 493 }, 495 494 496 /** 497 * @param {boolean} loop 498 * @return {boolean} 499 */ 500 jumpToNextSearchResult: function(loop) 495 jumpToNextSearchResult: function() 501 496 { 502 497 if (!this._searchResults) 503 return false;498 return; 504 499 505 500 this._hideSearchHighlights(); 506 if (++this._currentSearchResultIndex >= this._searchResults.length) { 507 if (!loop) 508 return false; 501 if (++this._currentSearchResultIndex >= this._searchResults.length) 509 502 this._currentSearchResultIndex = 0; 510 } 511 503 512 504 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() 521 508 { 522 509 if (!this._searchResults) 523 return false;510 return; 524 511 525 512 this._hideSearchHighlights(); 526 if (--this._currentSearchResultIndex < 0) { 527 if (!loop) 528 return false; 513 if (--this._currentSearchResultIndex < 0) 529 514 this._currentSearchResultIndex = (this._searchResults.length - 1); 530 }531 515 532 516 this._highlightCurrentSearchResult(); -
trunk/Source/WebCore/inspector/front-end/ExtensionPanel.js
r122847 r122962 154 154 /** 155 155 * @param {string} query 156 * @param {boolean} loop 157 */ 158 performSearch: function(query, loop) 156 */ 157 performSearch: function(query) 159 158 { 160 159 WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PerformSearch, query); … … 162 161 }, 163 162 164 /** 165 * @param {boolean} loop 166 * @return {boolean} 167 */ 168 jumpToNextSearchResult: function(loop) 163 jumpToNextSearchResult: function() 169 164 { 170 165 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() 180 170 { 181 171 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); 184 173 }, 185 174 -
trunk/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js
r122847 r122962 155 155 }, 156 156 157 beforeTextChanged: function( userInput)158 { 159 WebInspector.SourceFrame.prototype.beforeTextChanged.call(this , userInput);157 beforeTextChanged: function() 158 { 159 WebInspector.SourceFrame.prototype.beforeTextChanged.call(this); 160 160 this._removeBreakpointsBeforeEditing(); 161 161 }, -
trunk/Source/WebCore/inspector/front-end/NetworkPanel.js
r122847 r122962 1167 1167 }, 1168 1168 1169 /** 1170 * @param {boolean} loop 1171 * @return {boolean} 1172 */ 1173 jumpToPreviousSearchResult: function(loop) 1169 jumpToPreviousSearchResult: function() 1174 1170 { 1175 1171 if (!this._matchedRequests.length) 1176 return false; 1177 if (!loop && this._currentMatchedRequestIndex <= 0) 1178 return false; 1172 return; 1179 1173 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() 1188 1177 { 1189 1178 if (!this._matchedRequests.length) 1190 return false; 1191 if (!loop && this._currentMatchedRequestIndex + 1 >= this._matchedRequests.length) 1192 return false; 1179 return; 1193 1180 this._highlightNthMatchedRequest((this._currentMatchedRequestIndex + 1) % this._matchedRequests.length, true); 1194 return true;1195 1181 }, 1196 1182 … … 1439 1425 }, 1440 1426 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(); 1455 1435 }, 1456 1436 -
trunk/Source/WebCore/inspector/front-end/Panel.js
r122847 r122962 109 109 /** 110 110 * @param {string} query 111 * @param {boolean} loop 112 */ 113 performSearch: function(query, loop) 111 */ 112 performSearch: function(query) 114 113 { 115 114 // Call searchCanceled since it will reset everything we need before doing a new search. … … 117 116 }, 118 117 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 { 135 124 }, 136 125 -
trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js
r122847 r122962 740 740 /** 741 741 * @param {string} query 742 * @param {boolean} loop 743 */ 744 performSearch: function(query, loop) 742 */ 743 performSearch: function(query) 745 744 { 746 745 this.searchCanceled(); … … 817 816 }, 818 817 819 /** 820 * @param {boolean} loop 821 * @return {boolean} 822 */ 823 jumpToNextSearchResult: function(loop) 818 jumpToNextSearchResult: function() 824 819 { 825 820 if (!this.showView || !this._searchResults || !this._searchResults.length) 826 return false;821 return; 827 822 828 823 var showFirstResult = false; … … 854 849 else 855 850 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() 864 854 { 865 855 if (!this.showView || !this._searchResults || !this._searchResults.length) 866 return false;856 return; 867 857 868 858 var showLastResult = false; … … 894 884 else 895 885 currentView.jumpToPreviousSearchResult(); 896 return true;897 886 }, 898 887 -
trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js
r122847 r122962 638 638 /** 639 639 * @param {string} query 640 * @param {boolean} loop 641 */ 642 performSearch: function(query, loop) 640 */ 641 performSearch: function(query) 643 642 { 644 643 this._resetSearchResults(); … … 750 749 }, 751 750 752 /** 753 * @param {boolean} loop 754 * @return {boolean} 755 */ 756 jumpToNextSearchResult: function(loop) 751 jumpToNextSearchResult: function() 757 752 { 758 753 if (!this.currentSearchMatches) 759 return false;754 return; 760 755 var currentTreeElement = this.sidebarTree.selectedTreeElement; 761 756 var nextSearchResult = this._searchController.nextSearchResult(currentTreeElement); 762 757 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() 771 761 { 772 762 if (!this.currentSearchMatches) 773 return false;763 return; 774 764 var currentTreeElement = this.sidebarTree.selectedTreeElement; 775 765 var previousSearchResult = this._searchController.previousSearchResult(currentTreeElement); 776 766 this._showSearchResult(previousSearchResult); 777 return true;778 767 }, 779 768 -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r122847 r122962 574 574 // ScriptsNavigator does not need to update on EditorClosed. 575 575 this._updateScriptViewStatusBarItems(); 576 WebInspector.searchController.resetSearch(); 576 577 }, 577 578 … … 582 583 this._navigatorController.hideNavigatorOverlay(); 583 584 sourceFrame.focus(); 585 WebInspector.searchController.resetSearch(); 584 586 }, 585 587 … … 879 881 /** 880 882 * @param {string} query 881 * @param {boolean} loop 882 */ 883 performSearch: function(query, loop) 883 */ 884 performSearch: function(query) 884 885 { 885 886 WebInspector.searchController.updateSearchMatchesCount(0, this); … … 900 901 901 902 WebInspector.searchController.updateSearchMatchesCount(searchMatches, this); 902 view.jumpToNextSearchResult( loop);903 view.jumpToNextSearchResult(); 903 904 WebInspector.searchController.updateCurrentMatchIndex(view.currentSearchResultIndex, this); 904 905 } … … 907 908 }, 908 909 909 /** 910 * @param {boolean} loop 911 * @return {boolean} 912 */ 913 jumpToNextSearchResult: function(loop) 910 jumpToNextSearchResult: function() 914 911 { 915 912 if (!this._searchView) 916 return false;913 return; 917 914 918 915 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()) 926 921 this._searchView.jumpToFirstSearchResult(); 927 }else922 else 928 923 this._searchView.jumpToNextSearchResult(); 929 924 WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this); … … 931 926 }, 932 927 933 /** 934 * @param {boolean} loop 935 */ 936 jumpToPreviousSearchResult: function(loop) 928 jumpToPreviousSearchResult: function() 937 929 { 938 930 if (!this._searchView) … … 940 932 941 933 if (this._searchView !== this.visibleView) { 942 this.performSearch(this._searchQuery , loop);934 this.performSearch(this._searchQuery); 943 935 if (this._searchView) 944 936 this._searchView.jumpToLastSearchResult(); … … 946 938 } 947 939 948 if (this._searchView.showingFirstSearchResult()) { 949 if (!loop) 950 return false; 940 if (this._searchView.showingFirstSearchResult()) 951 941 this._searchView.jumpToLastSearchResult(); 952 }else942 else 953 943 this._searchView.jumpToPreviousSearchResult(); 954 944 WebInspector.searchController.updateCurrentMatchIndex(this._searchView.currentSearchResultIndex, this); … … 969 959 replaceSelectionWith: function(text) 970 960 { 971 var view = /** @type {WebInspector.SourceFrame} */ this. _searchView;961 var view = /** @type {WebInspector.SourceFrame} */ this.visibleView; 972 962 view.replaceSearchMatchWith(text); 973 963 }, … … 979 969 replaceAllWith: function(query, text) 980 970 { 981 var view = /** @type {WebInspector.SourceFrame} */ this. _searchView;971 var view = /** @type {WebInspector.SourceFrame} */ this.visibleView; 982 972 view.replaceAllWith(query, text); 983 973 }, -
trunk/Source/WebCore/inspector/front-end/SearchController.js
r122847 r122962 35 35 WebInspector.SearchController = function() 36 36 { 37 this._element = document.createElement(" div");37 this._element = document.createElement("table"); 38 38 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"); 45 46 this._searchInputElement = this._searchControlElement.createChild("input", "search-replace"); 46 47 this._searchInputElement.id = "search-input-field"; 48 this._searchInputElement.placeholder = WebInspector.UIString("Find"); 47 49 48 50 this._matchesElement = this._searchControlElement.createChild("label", "search-results-matches"); … … 63 65 this._searchInputElement.addEventListener("input", this._onInput.bind(this), false); 64 66 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"); 66 96 67 97 this._replaceCheckboxElement = this._replaceElement.createChild("input"); 68 98 this._replaceCheckboxElement.type = "checkbox"; 69 99 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); 72 101 73 102 this._replaceLabelElement = this._replaceElement.createChild("label"); … … 75 104 this._replaceLabelElement.setAttribute("for", "search-replace-trigger"); 76 105 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); 97 111 } 98 112 … … 120 134 return; 121 135 delete this._searchIsVisible; 122 this._performSearch("", false, false, false);123 136 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 = ""; 126 145 }, 127 146 128 147 disableSearchUntilExplicitAction: function(event) 129 148 { 130 this._performSearch("", false, false , false);149 this._performSearch("", false, false); 131 150 }, 132 151 … … 164 183 165 184 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 170 188 currentPanel.jumpToNextSearchResult(); 171 189 event.consume(true); … … 179 197 _updateSearchNavigationButtonState: function(enabled) 180 198 { 199 this._replaceButtonElement.disabled = !enabled; 200 this._prevButtonElement.disabled = !enabled; 181 201 var panel = WebInspector.inspectorView.currentPanel(); 182 202 if (enabled) { … … 212 232 { 213 233 var panel = WebInspector.inspectorView.currentPanel(); 214 if ( WebInspector.experimentsSettings.searchReplace.isEnabled()&& panel.canSearchAndReplace())234 if (panel && panel.canSearchAndReplace()) 215 235 this._replaceElement.removeStyleClass("hidden"); 216 else 236 else { 217 237 this._replaceElement.addStyleClass("hidden"); 238 this._replaceCheckboxElement.checked = false; 239 this._updateSecondRowVisibility(); 240 } 218 241 }, 219 242 … … 237 260 if (isEnterKey(event)) { 238 261 if (event.target === this._searchInputElement) 239 this._performSearch(event.target.value, true, event.shiftKey , true);262 this._performSearch(event.target.value, true, event.shiftKey); 240 263 else if (event.target === this._replaceInputElement) 241 264 this._replace(); … … 245 268 _onInput: function(event) 246 269 { 247 this._performSearch(event.target.value, false, false , true);270 this._performSearch(event.target.value, false, false); 248 271 }, 249 272 … … 251 274 { 252 275 // 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); 254 277 this._searchInputElement.focus(); 255 278 }, … … 257 280 _onPrevButtonSearch: function(event) 258 281 { 282 if (!this._searchNavigationPrevElement.hasStyleClass("enabled")) 283 return; 259 284 // 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); 261 286 this._searchInputElement.focus(); 262 287 }, … … 266 291 * @param {boolean} forceSearch 267 292 * @param {boolean} isBackwardSearch 268 * @param {boolean} loop269 293 */ 270 _performSearch: function(query, forceSearch, isBackwardSearch , loop)294 _performSearch: function(query, forceSearch, isBackwardSearch) 271 295 { 272 296 if (!query || !query.length) { … … 277 301 var hadCurrentQuery = !!panel.currentQuery; 278 302 delete panel.currentQuery; 279 if (hadCurrentQuery && panel.searchCanceled)303 if (hadCurrentQuery) 280 304 panel.searchCanceled(); 281 305 } … … 290 314 if (forceSearch) { 291 315 if (!isBackwardSearch) 292 currentPanel.jumpToNextSearchResult( loop);316 currentPanel.jumpToNextSearchResult(); 293 317 else if (isBackwardSearch) 294 currentPanel.jumpToPreviousSearchResult( loop);318 currentPanel.jumpToPreviousSearchResult(); 295 319 } 296 320 return; … … 303 327 304 328 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; 310 336 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; 312 342 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); 315 352 }, 316 353 … … 321 358 var query = this._currentQuery; 322 359 delete this._currentQuery; 323 this._performSearch(query, true, false , false);360 this._performSearch(query, true, false); 324 361 }, 325 362 … … 327 364 { 328 365 var currentPanel = WebInspector.inspectorView.currentPanel(); 329 currentPanel.replaceAllWith(this._ currentQuery, this._replaceInputElement.value);366 currentPanel.replaceAllWith(this._searchInputElement.value, this._replaceInputElement.value); 330 367 } 331 368 } -
trunk/Source/WebCore/inspector/front-end/Settings.js
r122847 r122962 189 189 this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection"); 190 190 this.mainThreadMonitoring = this._createExperiment("mainThreadMonitoring", "Show CPU activity in Timeline"); 191 this.searchReplace = this._createExperiment("searchReplace", "Search / Replace");192 191 193 192 this._cleanUpSetting(); -
trunk/Source/WebCore/inspector/front-end/SourceFrame.js
r122847 r122962 271 271 }, 272 272 273 /** 274 * @param {boolean} userInput 275 */ 276 beforeTextChanged: function(userInput) 277 { 278 if (userInput) 273 beforeTextChanged: function() 274 { 275 if (!this._isReplacing) 279 276 WebInspector.searchController.cancelSearch(); 280 277 this.clearMessages(); … … 356 353 if (shiftToIndex) 357 354 this._searchResults = this._searchResults.rotate(shiftToIndex); 358 355 359 356 callback(this, this._searchResults.length); 360 357 } … … 432 429 replaceSearchMatchWith: function(text) 433 430 { 434 this.beforeTextChanged(false);435 436 431 var range = this._searchResults[this._currentSearchResultIndex]; 437 432 if (!range) 438 433 return; 439 434 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()); 445 441 }, 446 442 … … 451 447 replaceAllWith: function(query, replacement) 452 448 { 453 this.beforeTextChanged(false); 449 this._textEditor.markAndRevealRange(null); 450 454 451 var text = this._textModel.text(); 455 452 var range = this._textModel.range(); 456 453 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; 459 458 }, 460 459 … … 646 645 beforeTextChanged: function() 647 646 { 648 this._sourceFrame.beforeTextChanged( true);647 this._sourceFrame.beforeTextChanged(); 649 648 }, 650 649 -
trunk/Source/WebCore/inspector/front-end/TextEditor.js
r122847 r122962 233 233 }, 234 234 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 235 249 _enterInternalTextChangeMode: function() 236 250 { -
trunk/Source/WebCore/inspector/front-end/inspector.css
r122847 r122962 270 270 margin: 0; 271 271 width: 165px; 272 position: relative;273 top: 1px;274 272 } 275 273 276 274 .search-replace:focus { 277 275 outline: none; 276 } 277 278 .toolbar-search { 279 border-spacing: 1px; 280 } 281 282 .toolbar-search td { 283 padding: 0 5px 0 0; 278 284 } 279 285 … … 300 306 } 301 307 302 .toolbar-search {303 line-height: 19px;304 height: 22px;305 }306 307 308 .toolbar-search input[type="checkbox"] { 308 309 position: relative; … … 315 316 border: 1px solid rgb(163, 163, 163); 316 317 border-radius: 12px; 317 margin: 0 0 06px;318 margin: 0 6px; 318 319 font-size: 11px; 319 320 background-image: -webkit-linear-gradient(rgb(241, 241, 241), rgb(220, 220, 220)); 321 width: 100%; 320 322 } 321 323 … … 329 331 background-color: white; 330 332 border: 1px solid rgb(163, 163, 163); 331 margin: 1px 2px 1px 5px;332 333 height: 20px; 333 334 border-radius: 2px; 334 padding- right: 36px;335 padding-top: 1px; 335 336 } 336 337 … … 339 340 height: 20px; 340 341 border-radius: 2px; 341 margin-left: 5px;342 width: 100%; 342 343 } 343 344 … … 2867 2868 font-size: 11px; 2868 2869 height: auto; 2869 padding-left: 5px; 2870 } 2870 }
Note: See TracChangeset
for help on using the changeset viewer.