Changeset 191071 in webkit
- Timestamp:
- Oct 14, 2015 2:03:05 PM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r191004 r191071 1 2015-10-13 João Oliveira <hello@jxs.pt> 2 3 Web Inspector: Console SearchBar should work more like ContentBrowser FindBanner 4 https://bugs.webkit.org/show_bug.cgi?id=149505 5 6 Reviewed by Joseph Pecoraro. 7 8 Console tab now uses findBanner, adapted LogContentView to use findBanner, 9 and findBanner to be more agnostic to both usecases, either as fixed, on console tab, 10 and hideable on other inspector tabs. 11 12 * UserInterface/Views/FindBanner.css: 13 (.find-banner.console-find-banner): 14 (.find-banner.console-findbanner input[type="search"]): 15 * UserInterface/Views/FindBanner.js: 16 (WebInspector.FindBanner): 17 (WebInspector.FindBanner.set targetElement.delayedWork): 18 (WebInspector.FindBanner.prototype.set targetElement): 19 (WebInspector.FindBanner.prototype.get showing): 20 (WebInspector.FindBanner.prototype.focus): 21 (WebInspector.FindBanner.prototype._clearAndBlur): 22 (WebInspector.FindBanner.prototype.show.delayedWork): 23 (WebInspector.FindBanner.prototype.show): 24 (WebInspector.FindBanner.prototype.hide): 25 (WebInspector.FindBanner.prototype.get element): Deleted. 26 (WebInspector.FindBanner.prototype._inputFieldSearch): Deleted. 27 * UserInterface/Views/LogContentView.js: 28 (WebInspector.LogContentView): 29 (WebInspector.LogContentView.prototype.get navigationItems): 30 (WebInspector.LogContentView.prototype.handleFindEvent): 31 (WebInspector.LogContentView.prototype.findBannerRevealPreviousResult): 32 (WebInspector.LogContentView.prototype.findBannerRevealNextResult): 33 (WebInspector.LogContentView.prototype._filterMessageElements): 34 (WebInspector.LogContentView.prototype.findBannerPerformSearch): 35 (WebInspector.LogContentView.prototype.findBannerSearchCleared): 36 (WebInspector.LogContentView.prototype.revealNextSearchResult): 37 (WebInspector.LogContentView.prototype.revealPreviousSearchResult): 38 (WebInspector.LogContentView.prototype._performSearch): 39 (WebInspector.LogContentView.prototype.searchBarDidActivate): Deleted. 40 (WebInspector.LogContentView.prototype._searchTextDidChange): Deleted. 41 1 42 2015-10-13 Nikita Vasilyev <nvasilyev@apple.com> 2 43 -
trunk/Source/WebInspectorUI/UserInterface/Views/FindBanner.css
r190640 r191071 189 189 line-height: 21px; 190 190 } 191 192 .find-banner.console-find-banner { 193 position: relative; 194 top: auto; 195 border: 0; 196 } 197 198 .find-banner.console-find-banner > input[type="search"] { 199 padding-top: 0; 200 margin: 1px 6px; 201 outline: none; 202 -webkit-appearance: none; 203 border: 1px solid hsla(0, 0%, 0%, 0.35); 204 border-radius: 3px; 205 background-color: hsla(0, 0%, 100%, 0.2); 206 background-clip: padding-box; 207 height: 22px; 208 } 209 210 .find-banner.console-find-banner > input[type="search"]::-webkit-input-placeholder { 211 color: hsla(0, 0%, 0%, 0.35); 212 } 213 214 .find-banner.console-find-banner > input[type="search"]::-webkit-textfield-decoration-container { 215 margin-left: 4px; 216 } 217 218 .find-banner.console-find-banner > input[type="search"]:focus { 219 background-color: white; 220 } -
trunk/Source/WebInspectorUI/UserInterface/Views/FindBanner.js
r183579 r191071 24 24 */ 25 25 26 WebInspector.FindBanner = class FindBanner extends WebInspector. Object26 WebInspector.FindBanner = class FindBanner extends WebInspector.NavigationItem 27 27 { 28 constructor(delegate, element)28 constructor(delegate, className, fixed = false) 29 29 { 30 30 super(); … … 32 32 this._delegate = delegate || null; 33 33 34 this._element = element || document.createElement("div"); 35 this._element.classList.add("find-banner"); 34 this.element.classList.add("find-banner"); 35 36 if (className) 37 this.element.classList.add(className); 36 38 37 39 this._resultCountLabel = document.createElement("label"); 38 this. _element.appendChild(this._resultCountLabel);40 this.element.appendChild(this._resultCountLabel); 39 41 40 42 this._previousResultButton = document.createElement("button"); … … 43 45 this._previousResultButton.disabled = true; 44 46 this._previousResultButton.addEventListener("click", this._previousResultButtonClicked.bind(this)); 45 this. _element.appendChild(this._previousResultButton);47 this.element.appendChild(this._previousResultButton); 46 48 47 49 var previousResultButtonGlyphElement = document.createElement("div"); … … 54 56 this._nextResultButton.disabled = true; 55 57 this._nextResultButton.addEventListener("click", this._nextResultButtonClicked.bind(this)); 56 this. _element.appendChild(this._nextResultButton);58 this.element.appendChild(this._nextResultButton); 57 59 58 60 var nextResultButtonGlyphElement = document.createElement("div"); … … 69 71 this._inputField.addEventListener("keyup", this._inputFieldKeyUp.bind(this), false); 70 72 this._inputField.addEventListener("search", this._inputFieldSearch.bind(this), false); 71 this._element.appendChild(this._inputField); 72 73 this._doneButton = document.createElement("button"); 74 this._doneButton.textContent = WebInspector.UIString("Done"); 75 this._doneButton.addEventListener("click", this._doneButtonClicked.bind(this)); 76 this._element.appendChild(this._doneButton); 73 this.element.appendChild(this._inputField); 74 75 if (fixed) 76 this._clearAndBlurKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape, this._clearAndBlur.bind(this), this.element); 77 else { 78 let doneButtonElement = document.createElement("button"); 79 doneButtonElement.textContent = WebInspector.UIString("Done"); 80 doneButtonElement.addEventListener("click", this._doneButtonClicked.bind(this)); 81 this.element.appendChild(doneButtonElement); 82 this._hideKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape, this.hide.bind(this), this.element); 83 } 77 84 78 85 this._numberOfResults = null; … … 81 88 this._previousSearchValue = ""; 82 89 83 this._hideKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape, this.hide.bind(this), this._element);84 90 this._populateFindKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "E", this._populateSearchQueryFromSelection.bind(this)); 85 91 this._populateFindKeyboardShortcut.implicitlyPreventsDefault = false; … … 102 108 { 103 109 this._delegate = newDelegate || null; 104 }105 106 get element()107 {108 return this._element;109 110 } 110 111 … … 158 159 { 159 160 oldTargetElement.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName); 160 this. _element.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName);161 this.element.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName); 161 162 } 162 163 … … 168 169 this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName); 169 170 170 this. _element.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName);171 this. _element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);171 this.element.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName); 172 this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName); 172 173 173 174 // Delay so we can remove the no transition style class after the other style changes are committed. … … 183 184 get showing() 184 185 { 185 return this._element.classList.contains(WebInspector.FindBanner.ShowingStyleClassName); 186 return this.element.classList.contains(WebInspector.FindBanner.ShowingStyleClassName); 187 } 188 189 focus() 190 { 191 // FIXME: Workaround for: <https://webkit.org/b/149504> Caret missing from <input> after clearing text and calling select() 192 if (!this._inputField.value.length) 193 this._inputField.focus(); 194 else 195 this._inputField.select(); 196 } 197 198 _clearAndBlur() 199 { 200 this.numberOfResults = null; 201 202 this._inputField.value = ""; 203 this._previousSearchValue = ""; 204 205 if (this._delegate.findBannerSearchCleared) 206 this._delegate.findBannerSearchCleared(); 207 if (this._delegate.findBannerWantsToClearAndBlur) 208 this._delegate.findBannerWantsToClearAndBlur(); 186 209 } 187 210 … … 196 219 return; 197 220 198 if (this. _element.parentNode !== this._targetElement.parentNode)199 this._targetElement.parentNode.insertBefore(this. _element, this._targetElement);221 if (this.element.parentNode !== this._targetElement.parentNode) 222 this._targetElement.parentNode.insertBefore(this.element, this._targetElement); 200 223 201 224 function delayedWork() 202 225 { 203 226 this._targetElement.classList.add(WebInspector.FindBanner.ShowingFindBannerStyleClassName); 204 this. _element.classList.add(WebInspector.FindBanner.ShowingStyleClassName);227 this.element.classList.add(WebInspector.FindBanner.ShowingStyleClassName); 205 228 206 229 this._inputField.select(); … … 223 246 224 247 this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName); 225 this. _element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);248 this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName); 226 249 227 250 this.dispatchEventToListeners(WebInspector.FindBanner.Event.DidHide); … … 277 300 } else { 278 301 this.numberOfResults = null; 279 280 302 if (this._delegate && typeof this._delegate.findBannerSearchCleared === "function") 281 303 this._delegate.findBannerSearchCleared(this); -
trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.css
r187105 r191071 186 186 } 187 187 188 .search-bar.log-search-bar > input[type="search"] {189 width: 150px;190 border: 1px solid hsla(0, 0%, 0%, 0.35);191 padding-left: 4px;192 }193 194 188 .search-in-progress .console-item.filtered-out-by-search { 195 189 display: none; -
trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js
r189924 r191071 58 58 this._lastMessageView = null; 59 59 60 this._ searchBar = new WebInspector.SearchBar("log-search-bar", WebInspector.UIString("Filter Console Log"), this);61 this._ searchBar.addEventListener(WebInspector.SearchBar.Event.TextChanged, this._searchTextDidChange, this);60 this._findBanner = new WebInspector.FindBanner(this, "console-find-banner", true); 61 this._findBanner.inputField.placeholder = WebInspector.UIString("Filter Console Log"); 62 62 63 63 var scopeBarItems = [ … … 92 92 get navigationItems() 93 93 { 94 var navigationItems = [this._searchBar, this._scopeBar, this._clearLogNavigationItem];94 let navigationItems = [this._findBanner, this._scopeBar, this._clearLogNavigationItem]; 95 95 if (WebInspector.isShowingSplitConsole()) 96 96 navigationItems.push(this._showConsoleTabNavigationItem); … … 189 189 return; 190 190 191 this._ searchBar.focus();191 this._findBanner.focus(); 192 192 } 193 193 … … 218 218 } 219 219 220 findBannerRevealPreviousResult() 221 { 222 this.highlightPreviousSearchMatch(); 223 } 224 220 225 highlightPreviousSearchMatch() 221 226 { … … 227 232 } 228 233 234 findBannerRevealNextResult() 235 { 236 this.highlightNextSearchMatch(); 237 } 238 229 239 highlightNextSearchMatch() 230 240 { … … 236 246 } 237 247 238 searchBarWantsToLoseFocus(searchBar)248 findBannerWantsToClearAndBlur(findBanner) 239 249 { 240 250 if (this._selectedMessages.length) … … 242 252 else 243 253 this.prompt.focus(); 244 }245 246 searchBarDidActivate(searchBar)247 {248 if (!isEmptyObject(this._searchMatches))249 this._highlightSearchMatchAtIndex(0);250 this.prompt.focus();251 254 } 252 255 … … 695 698 }, this); 696 699 697 this._performSearch( );700 this._performSearch(""); 698 701 } 699 702 … … 850 853 } 851 854 852 _searchTextDidChange(event) 853 { 854 this._performSearch(); 855 } 856 857 _performSearch() 855 findBannerPerformSearch(findBanner, searchTerms) 856 { 857 this._performSearch(searchTerms); 858 } 859 860 findBannerSearchCleared() 861 { 862 this._performSearch(""); 863 } 864 865 revealNextSearchResult() 866 { 867 this.findBannerRevealNextResult(); 868 } 869 870 revealPreviousSearchResult() 871 { 872 this.findBannerRevealPreviousResult(); 873 } 874 875 _performSearch(searchTerms) 858 876 { 859 877 if (!isEmptyObject(this._searchHighlightDOMChanges)) 860 878 WebInspector.revertDomChanges(this._searchHighlightDOMChanges); 861 862 var searchTerms = this._searchBar.text;863 879 864 880 if (searchTerms === "") { … … 874 890 this._searchMatches = []; 875 891 this._selectedSearchMathIsValid = false; 892 let numberOfResults = 0; 876 893 877 894 var searchRegex = new RegExp(searchTerms.escapeForRegExp(), "gi"); … … 881 898 var match = searchRegex.exec(text); 882 899 while (match) { 900 numberOfResults++; 883 901 matchRanges.push({ offset: match.index, length: match[0].length }); 884 902 match = searchRegex.exec(text); … … 899 917 delete this._selectedSearchMatch; 900 918 } 919 920 this._findBanner.numberOfResults = numberOfResults; 901 921 } 902 922 -
trunk/Source/WebInspectorUI/UserInterface/Views/Main.css
r190436 r191071 188 188 } 189 189 190 #split-content-browser > .navigation-bar > :matches(.hierarchical-path, .log-search-bar, .log-scope-bar) { 191 pointer-events: none; 192 } 193 194 #split-content-browser > .navigation-bar > :matches(.log-search-bar, .log-scope-bar) > :matches(li, input) { 190 #split-content-browser > .navigation-bar > .log-scope-bar > li { 195 191 pointer-events: all; 196 192 } -
trunk/Source/WebInspectorUI/UserInterface/Views/SearchBar.css
r187105 r191071 44 44 } 45 45 46 .search-bar > input[type="search"]:focus { background-color: white; } 47 .search-bar > input[type="search"]:not(:placeholder-shown) { background-color: white; } /* Needs to be a separate rule. See http://webkit.org/b/118162 */ 46 .search-bar > input[type="search"]:focus { 47 background-color: white; 48 }
Note: See TracChangeset
for help on using the changeset viewer.