Changeset 209882 in webkit
- Timestamp:
- Dec 15, 2016 3:52:42 PM (7 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r209855 r209882 1 2016-12-15 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: console search bar jumps, behaves poorly at narrow widths 4 https://bugs.webkit.org/show_bug.cgi?id=164047 5 <rdar://problem/29055582> 6 7 Reviewed by Timothy Hatcher. 8 9 At narrow widths the find banner behaves poorly in the split console 10 toolbar. It should work like the main content browser, appearing below 11 the toolbar when Command-F is pressed and either the split console or 12 quick console prompt has the focus. 13 14 * UserInterface/Base/Main.js: 15 (WebInspector.contentLoaded): 16 Enable split content browser find banner. 17 18 * UserInterface/Views/ContentBrowser.js: 19 (WebInspector.ContentBrowser.prototype.showFindBanner): 20 Check for custom find banner support at runtime. 21 (WebInspector.ContentBrowser.prototype._findBannerDidShow): 22 (WebInspector.ContentBrowser.prototype._findBannerDidHide): 23 Refresh search results when banner is shown/hidden, instead of relying 24 on toggling the "showing-find-banner" class name for everything. 25 26 (WebInspector.ContentBrowser.prototype.handleFindEvent): Deleted. 27 Renamed `showFindBanner`. 28 29 * UserInterface/Views/ContentView.js: 30 (WebInspector.ContentView.prototype.get supportsCustomFindBanner): 31 (WebInspector.ContentView.prototype.showCustomFindBanner): 32 Custom find banner support (used by LogContentView). 33 34 * UserInterface/Views/LogContentView.js: 35 (WebInspector.LogContentView): 36 (WebInspector.LogContentView.prototype.get supportsSearch): 37 (WebInspector.LogContentView.prototype.get numberOfSearchResults): 38 (WebInspector.LogContentView.prototype.get hasPerformedSearch): 39 Cleanup. 40 (WebInspector.LogContentView.prototype.get supportsCustomFindBanner): 41 Use toolbar item find banner when showing Console tab. 42 (WebInspector.LogContentView.prototype.findBannerRevealPreviousResult): 43 (WebInspector.LogContentView.prototype.findBannerRevealNextResult): 44 (WebInspector.LogContentView.prototype._isMessageVisible): 45 (WebInspector.LogContentView.prototype._visibleMessageElements): 46 (WebInspector.LogContentView.prototype._logCleared): 47 (WebInspector.LogContentView.prototype._filterMessageElements): 48 (WebInspector.LogContentView.prototype.findBannerPerformSearch): 49 (WebInspector.LogContentView.prototype.findBannerSearchCleared): 50 (WebInspector.LogContentView.prototype.performSearch): 51 Support both the standard and custom (toolbar item) find banners. 52 (WebInspector.LogContentView.prototype.searchCleared): 53 Refresh search results. 54 (WebInspector.LogContentView.prototype._highlightRanges): 55 Correct spelling: _selectedSearchMathIsValid -> _selectedSearchMatchIsValid. 56 (WebInspector.LogContentView.prototype.get searchInProgress): Deleted. 57 Override ContentView.prototype.hasPerformedSearch instead. 58 (WebInspector.LogContentView.prototype.handleFindEvent): Deleted. 59 Replaced by `showCustomFindBanner`. 60 (WebInspector.LogContentView.prototype.highlightPreviousSearchMatch): Deleted. 61 Absorbed by findBannerRevealPreviousResult. 62 (WebInspector.LogContentView.prototype.highlightNextSearchMatch): Deleted. 63 Absorbed by findBannerRevealNextResult. 64 (WebInspector.LogContentView.prototype._performSearch): Deleted. 65 Override ContentView.prototype.performSearch instead. 66 67 * UserInterface/Views/Main.css: 68 (#split-content-browser > .navigation-bar :matches(.find-banner, .find-banner + .divider)): 69 Hide the toolbar banner and divider. 70 1 71 2016-12-14 Ryosuke Niwa <rniwa@webkit.org> 2 72 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r209631 r209882 271 271 this._contentElement.setAttribute("aria-label", WebInspector.UIString("Content")); 272 272 273 this.splitContentBrowser = new WebInspector.ContentBrowser(document.getElementById("split-content-browser"), this, true, true); 273 const disableBackForward = true; 274 const disableFindBanner = false; 275 this.splitContentBrowser = new WebInspector.ContentBrowser(document.getElementById("split-content-browser"), this, disableBackForward, disableFindBanner); 274 276 this.splitContentBrowser.navigationBar.element.addEventListener("mousedown", this._consoleResizerMouseDown.bind(this)); 275 277 … … 1985 1987 WebInspector._find = function(event) 1986 1988 { 1987 varcontentBrowser = this._focusedOrVisibleContentBrowser();1988 if (!contentBrowser || typeof contentBrowser.handleFindEvent !== "function")1989 return; 1990 1991 contentBrowser. handleFindEvent(event);1989 let contentBrowser = this._focusedOrVisibleContentBrowser(); 1990 if (!contentBrowser) 1991 return; 1992 1993 contentBrowser.showFindBanner(); 1992 1994 }; 1993 1995 -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
r200605 r209882 198 198 } 199 199 200 handleFindEvent(event)200 showFindBanner() 201 201 { 202 202 if (!this._findBanner) … … 207 207 return; 208 208 209 // LogContentView has custom search handling. 210 if (typeof currentContentView.handleFindEvent === "function") { 211 currentContentView.handleFindEvent(event); 209 if (currentContentView.supportsCustomFindBanner) { 210 currentContentView.showCustomFindBanner(); 212 211 return; 213 212 } … … 296 295 297 296 currentContentView.automaticallyRevealFirstSearchResult = true; 297 currentContentView.performSearch(this._findBanner.searchQuery); 298 298 } 299 299 … … 305 305 306 306 currentContentView.automaticallyRevealFirstSearchResult = false; 307 currentContentView.searchCleared(); 307 308 } 308 309 -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentView.js
r208441 r209882 367 367 } 368 368 369 get supportsCustomFindBanner() 370 { 371 // Implemented by subclasses. 372 return false; 373 } 374 375 showCustomFindBanner() 376 { 377 // Implemented by subclasses. 378 } 379 369 380 get numberOfSearchResults() 370 381 { -
trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js
r208725 r209882 58 58 this._lastMessageView = null; 59 59 60 this._findBanner = new WebInspector.FindBanner(this, "console-find-banner", true); 60 const fixed = true; 61 this._findBanner = new WebInspector.FindBanner(this, "console-find-banner", fixed); 61 62 this._findBanner.inputField.placeholder = WebInspector.UIString("Filter Console Log"); 63 this._findBanner.targetElement = this.element; 64 65 this._currentSearchQuery = ""; 66 this._searchMatches = []; 67 this._selectedSearchMatch = null; 68 this._selectedSearchMatchIsValid = false; 62 69 63 70 var scopeBarItems = [ … … 116 123 { 117 124 return true; 118 }119 120 get searchInProgress()121 {122 return this.messagesElement.classList.contains(WebInspector.LogContentView.SearchInProgressStyleClassName);123 125 } 124 126 … … 172 174 } 173 175 174 get supportsSearch() 175 { 176 return true; 177 } 178 179 handleFindEvent(event) 176 get supportsSearch() { return true; } 177 get numberOfSearchResults() { return this.hasPerformedSearch ? this._searchMatches.length : null; } 178 get hasPerformedSearch() { return this._currentSearchQuery !== ""; } 179 180 get supportsCustomFindBanner() 181 { 182 return WebInspector.isShowingConsoleTab(); 183 } 184 185 showCustomFindBanner() 180 186 { 181 187 if (!this.visible) … … 213 219 findBannerRevealPreviousResult() 214 220 { 215 this.highlightPreviousSearchMatch(); 216 } 217 218 highlightPreviousSearchMatch() 219 { 220 if (!this.searchInProgress || isEmptyObject(this._searchMatches)) 221 if (!this.hasPerformedSearch || isEmptyObject(this._searchMatches)) 221 222 return; 222 223 … … 227 228 findBannerRevealNextResult() 228 229 { 229 this.highlightNextSearchMatch(); 230 } 231 232 highlightNextSearchMatch() 233 { 234 if (!this.searchInProgress || isEmptyObject(this._searchMatches)) 230 if (!this.hasPerformedSearch || isEmptyObject(this._searchMatches)) 235 231 return; 236 232 … … 588 584 return false; 589 585 590 if (this. searchInProgress&& node.classList.contains(WebInspector.LogContentView.FilteredOutBySearchStyleClassName))586 if (this.hasPerformedSearch && node.classList.contains(WebInspector.LogContentView.FilteredOutBySearchStyleClassName)) 591 587 return false; 592 588 … … 645 641 var unfilteredMessages = this._unfilteredMessageElements(); 646 642 647 if (!this. searchInProgress)643 if (!this.hasPerformedSearch) 648 644 return unfilteredMessages; 649 645 … … 661 657 this._nestingLevel = 0; 662 658 663 let searchQuery = this._findBanner.searchQuery; 664 if (searchQuery) 665 this._performSearch(searchQuery); 659 if (this._currentSearchQuery) 660 this.performSearch(this._currentSearchQuery); 666 661 } 667 662 … … 717 712 }, this); 718 713 719 this. _performSearch(this._findBanner.searchQuery);714 this.performSearch(this._currentSearchQuery); 720 715 } 721 716 … … 874 869 } 875 870 876 findBannerPerformSearch(findBanner, search Terms)877 { 878 this. _performSearch(searchTerms);871 findBannerPerformSearch(findBanner, searchQuery) 872 { 873 this.performSearch(searchQuery); 879 874 } 880 875 881 876 findBannerSearchCleared() 882 877 { 883 this. _performSearch("");878 this.searchCleared(); 884 879 } 885 880 … … 894 889 } 895 890 896 _performSearch(searchTerms)891 performSearch(searchQuery) 897 892 { 898 893 if (!isEmptyObject(this._searchHighlightDOMChanges)) 899 894 WebInspector.revertDomChanges(this._searchHighlightDOMChanges); 900 895 901 if (searchTerms === "") { 902 delete this._selectedSearchMatch; 903 this._matchingSearchElements = []; 904 this.messagesElement.classList.remove(WebInspector.LogContentView.SearchInProgressStyleClassName); 905 return; 906 } 907 908 this.messagesElement.classList.add(WebInspector.LogContentView.SearchInProgressStyleClassName); 909 896 this._currentSearchQuery = searchQuery; 910 897 this._searchHighlightDOMChanges = []; 911 898 this._searchMatches = []; 912 this._selectedSearchMathIsValid = false; 913 let numberOfResults = 0; 914 915 var searchRegex = new RegExp(searchTerms.escapeForRegExp(), "gi"); 899 this._selectedSearchMatchIsValid = false; 900 this._selectedSearchMatch = null; 901 902 if (this._currentSearchQuery === "") { 903 this.element.classList.remove(WebInspector.LogContentView.SearchInProgressStyleClassName); 904 this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange); 905 return; 906 } 907 908 this.element.classList.add(WebInspector.LogContentView.SearchInProgressStyleClassName); 909 910 let searchRegex = new RegExp(this._currentSearchQuery.escapeForRegExp(), "gi"); 916 911 this._unfilteredMessageElements().forEach(function(message) { 917 varmatchRanges = [];918 vartext = message.textContent;919 varmatch = searchRegex.exec(text);912 let matchRanges = []; 913 let text = message.textContent; 914 let match = searchRegex.exec(text); 920 915 while (match) { 921 numberOfResults++;922 916 matchRanges.push({offset: match.index, length: match[0].length}); 923 917 match = searchRegex.exec(text); … … 927 921 this._highlightRanges(message, matchRanges); 928 922 929 varclassList = message.classList;923 let classList = message.classList; 930 924 if (!isEmptyObject(matchRanges) || message.__commandView instanceof WebInspector.ConsoleCommandView || message.__message instanceof WebInspector.ConsoleCommandResultMessage) 931 925 classList.remove(WebInspector.LogContentView.FilteredOutBySearchStyleClassName); … … 934 928 }, this); 935 929 936 if (!this._selectedSearchMathIsValid && this._selectedSearchMatch) { 930 this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange); 931 932 if (!this._selectedSearchMatchIsValid && this._selectedSearchMatch) { 937 933 this._selectedSearchMatch.highlight.classList.remove(WebInspector.LogContentView.SelectedStyleClassName); 938 delete this._selectedSearchMatch; 939 } 940 941 this._findBanner.numberOfResults = numberOfResults; 934 this._selectedSearchMatch = null; 935 } 936 } 937 938 searchCleared() 939 { 940 this.performSearch(""); 942 941 } 943 942 … … 951 950 this._searchMatches.push({message, range, highlight: highlightedElements[index]}); 952 951 953 if (this._selectedSearchMatch && !this._selectedSearchMat hIsValid && this._selectedSearchMatch.message === message) {954 this._selectedSearchMat hIsValid = this._rangesOverlap(this._selectedSearchMatch.range, range);955 if (this._selectedSearchMat hIsValid) {952 if (this._selectedSearchMatch && !this._selectedSearchMatchIsValid && this._selectedSearchMatch.message === message) { 953 this._selectedSearchMatchIsValid = this._rangesOverlap(this._selectedSearchMatch.range, range); 954 if (this._selectedSearchMatchIsValid) { 956 955 delete this._selectedSearchMatch; 957 956 this._highlightSearchMatchAtIndex(this._searchMatches.length - 1); -
trunk/Source/WebInspectorUI/UserInterface/Views/Main.css
r209342 r209882 157 157 } 158 158 159 #split-content-browser > .navigation-bar :matches(.find-banner, .find-banner + .divider) { 160 display: none; 161 } 162 159 163 #split-content-browser > .navigation-bar .item { 160 164 height: 100%;
Note: See TracChangeset
for help on using the changeset viewer.