Changeset 121911 in webkit
- Timestamp:
- Jul 5, 2012 9:44:46 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r121908 r121911 1 2012-07-05 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: move search field to the bottom of the page. 4 https://bugs.webkit.org/show_bug.cgi?id=90610 5 6 Reviewed by Vsevolod Vlasov. 7 8 This is the first step in the Search/replace implementation. This change moves search 9 field from the inspector toolbar to the inspector view footer that is visible upon Cmd/Ctrl+F. 10 11 * English.lproj/localizedStrings.js: 12 * inspector/front-end/InspectorView.js: 13 (WebInspector.InspectorView): 14 (WebInspector.InspectorView.prototype._pushToHistory): 15 (WebInspector.InspectorView.prototype.panelsElement): 16 (WebInspector.InspectorView.prototype.setFooterElement): 17 * inspector/front-end/Panel.js: 18 (WebInspector.Panel.prototype.show): 19 * inspector/front-end/ProfilesPanel.js: 20 (WebInspector.ProfilesPanel.prototype._reset): 21 * inspector/front-end/SearchController.js: 22 (WebInspector.SearchController): 23 (WebInspector.SearchController.prototype.updateSearchLabel): 24 (WebInspector.SearchController.prototype.cancelSearch): 25 (WebInspector.SearchController.prototype._updateSearchNavigationButtonState): 26 (WebInspector.SearchController.prototype.focusSearchField): 27 (WebInspector.SearchController.prototype._onKeyDown): 28 (WebInspector.SearchController.prototype._onNextButtonSearch): 29 (WebInspector.SearchController.prototype._onPrevButtonSearch): 30 (WebInspector.SearchController.prototype._performSearch): 31 * inspector/front-end/inspector.css: 32 (#search): 33 (.toolbar-search-container): 34 (.toolbar-search-navigation): 35 (.toolbar-search-navigation:hover): 36 (.toolbar-search-navigation.toolbar-search-navigation-prev): 37 (.toolbar-search-navigation.toolbar-search-navigation-next): 38 (.toolbar-search-navigation-hidden): 39 (.status-bar): 40 (.search-drawer-header input[type="search"].search-config-search): 41 (.inspector-footer): 42 (.inspector-footer > div): 43 * inspector/front-end/inspector.html: 44 * inspector/front-end/inspector.js: 45 (WebInspector.get _setCompactMode): 46 (WebInspector.postDocumentKeyDown): 47 1 48 2012-07-05 Sergey Rogulenko <rogulenko@google.com> 2 49 -
trunk/Source/WebCore/English.lproj/localizedStrings.js
r121896 r121911 720 720 localizedStrings["%d Bytes"] = "%d Bytes"; 721 721 localizedStrings["Time End"] = "Time End"; 722 localizedStrings["Search:"] = "Search:"; -
trunk/Source/WebCore/inspector/front-end/InspectorView.js
r118520 r121911 52 52 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); 53 53 this._closeBracketCharCode = "]".charCodeAt(0); 54 this._footerElementContainer = this.element.createChild("div", "inspector-footer status-bar hidden"); 55 this._panelsElement = this.element.createChild("div", "fill"); 54 56 } 55 57 … … 191 193 this._history.push(panelName); 192 194 this._historyIterator = this._history.length - 1; 195 }, 196 197 panelsElement: function() 198 { 199 return this._panelsElement; 200 }, 201 202 /** 203 * @param {Element?} element 204 */ 205 setFooterElement: function(element) 206 { 207 if (element) { 208 this._footerElementContainer.removeStyleClass("hidden"); 209 this._footerElementContainer.appendChild(element); 210 this._panelsElement.style.bottom = this._footerElementContainer.offsetHeight + "px"; 211 } else { 212 this._footerElementContainer.addStyleClass("hidden"); 213 this._footerElementContainer.removeChildren(); 214 this._panelsElement.style.bottom = 0; 215 } 216 this.doResize(); 193 217 } 194 218 } -
trunk/Source/WebCore/inspector/front-end/Panel.js
r114740 r121911 64 64 show: function() 65 65 { 66 WebInspector.View.prototype.show.call(this, WebInspector.inspectorView. element);66 WebInspector.View.prototype.show.call(this, WebInspector.inspectorView.panelsElement()); 67 67 }, 68 68 -
trunk/Source/WebCore/inspector/front-end/SearchController.js
r118152 r121911 32 32 /** 33 33 * @constructor 34 * @param {Element} parentElement 34 35 */ 35 36 WebInspector.SearchController = function() 36 37 { 37 this.element = document.getElementById("search"); 38 this._matchesElement = document.getElementById("search-results-matches"); 39 this._searchItemElement = document.getElementById("toolbar-search-item"); 40 this._searchControlBoxElement = document.getElementById("toolbar-search-navigation-control"); 41 42 this.element.addEventListener("search", this._onSearch.bind(this), false); // when the search is emptied 43 this.element.addEventListener("mousedown", this._onSearchFieldManualFocus.bind(this), false); // when the search field is manually selected 44 this.element.addEventListener("keydown", this._onKeyDown.bind(this), true); 45 46 this._populateSearchNavigationButtons(); 38 this._element = document.createElement("div"); 39 this._element.textContent = "Search:"; 40 41 this._searchInputElement = this._element.createChild("input"); 42 this._searchInputElement.id = "search"; 43 this._searchInputElement.type = "search"; 44 this._searchInputElement.incremental = true; 45 this._searchInputElement.results = 0; 46 47 this._searchNavigationNextElement = this._element.createChild("div", "toolbar-search-navigation toolbar-search-navigation-next hidden"); 48 this._searchNavigationNextElement.addEventListener("mousedown", this._onNextButtonSearch.bind(this), false); 49 this._searchNavigationNextElement.title = WebInspector.UIString("Search Next"); 50 51 this._searchNavigationPrevElement = this._element.createChild("div", "toolbar-search-navigation toolbar-search-navigation-prev hidden"); 52 this._searchNavigationPrevElement.addEventListener("mousedown", this._onPrevButtonSearch.bind(this), false); 53 this._searchNavigationPrevElement.title = WebInspector.UIString("Search Previous"); 54 55 this._matchesElement = this._element.createChild("span", "search-results-matches"); 56 57 this._searchInputElement.addEventListener("search", this._onSearch.bind(this), false); // when the search is emptied 58 this._searchInputElement.addEventListener("mousedown", this._onSearchFieldManualFocus.bind(this), false); // when the search field is manually selected 59 this._searchInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true); 60 61 var closeButtonElement = this._element.createChild("span", "drawer-header-close-button"); 62 closeButtonElement.textContent = WebInspector.UIString("\u00D7"); 63 closeButtonElement.addEventListener("click", this.cancelSearch.bind(this), false); 47 64 } 48 65 … … 71 88 return; 72 89 var newLabel = WebInspector.UIString("Search %s", panelName); 73 this. element.setAttribute("placeholder", newLabel);90 this._searchInputElement.setAttribute("placeholder", newLabel); 74 91 }, 75 92 76 93 cancelSearch: function() 77 94 { 78 this. element.value = "";95 this._searchInputElement.value = ""; 79 96 this._performSearch(""); 97 WebInspector.inspectorView.setFooterElement(null); 80 98 }, 81 99 … … 157 175 }, 158 176 159 _updateSearchNavigationButtonState: function(visible) 160 { 161 if (visible) 162 this._searchItemElement.addStyleClass("with-navigation-buttons"); 163 else 164 this._searchItemElement.removeStyleClass("with-navigation-buttons"); 177 _updateSearchNavigationButtonState: function(enabled) 178 { 179 if (enabled) { 180 this._searchNavigationPrevElement.removeStyleClass("hidden"); 181 this._searchNavigationNextElement.removeStyleClass("hidden"); 182 } else { 183 this._searchNavigationPrevElement.addStyleClass("hidden"); 184 this._searchNavigationNextElement.addStyleClass("hidden"); 185 } 165 186 }, 166 187 … … 205 226 focusSearchField: function() 206 227 { 207 this.element.focus(); 208 this.element.select(); 228 WebInspector.inspectorView.setFooterElement(this._element); 229 this._searchInputElement.focus(); 230 this._searchInputElement.select(); 209 231 }, 210 232 … … 218 240 // Escape Key will clear the field and clear the search results 219 241 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code) { 220 // If focus belongs here and text is empty - nothing to do, return unhandled.221 // When search was selected manually and is currently blank, we'd like Esc stay unhandled222 // and hit console drawer handler.223 if (event.target.value === "")224 return;225 226 242 event.consume(true); 227 228 243 this.cancelSearch(); 229 244 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement()); … … 258 273 { 259 274 // Simulate next search on search-navigation-button click. 260 this._performSearch(this. element.value, true, false, false);275 this._performSearch(this._searchInputElement.value, true, false, false); 261 276 }, 262 277 … … 264 279 { 265 280 // Simulate previous search on search-navigation-button click. 266 this._performSearch(this. element.value, true, true, false);281 this._performSearch(this._searchInputElement.value, true, true, false); 267 282 }, 268 283 … … 328 343 currentPanel.currentQuery = query; 329 344 currentPanel.performSearch(query); 330 },331 332 /**333 * @param {string=} direction334 */335 _createSearchNavigationButton: function(direction)336 {337 var searchNavigationControlElement = document.createElement("div");338 var searchNavigationIconElement = document.createElement("div");339 340 searchNavigationControlElement.className = "toolbar-search-navigation-label";341 342 switch (direction) {343 case "prev":344 var searchTitle = WebInspector.UIString("Search Previous");345 searchNavigationIconElement.className = "toolbar-search-navigation-icon-prev";346 this._searchNavigationPrev = searchNavigationControlElement;347 this._searchNavigationPrev.addEventListener("mousedown", this._onPrevButtonSearch.bind(this), false);348 break;349 350 case "next":351 var searchTitle = WebInspector.UIString("Search Next");352 searchNavigationIconElement.className = "toolbar-search-navigation-icon-next";353 this._searchNavigationNext = searchNavigationControlElement;354 this._searchNavigationNext.addEventListener("mousedown", this._onNextButtonSearch.bind(this), false);355 break;356 }357 358 searchNavigationControlElement.setAttribute("title" , searchTitle);359 searchNavigationControlElement.appendChild(searchNavigationIconElement);360 this._searchControlBoxElement.appendChild(searchNavigationControlElement);361 },362 363 _populateSearchNavigationButtons: function()364 {365 // Lazily adding search navigation keys to dom.366 this._createSearchNavigationButton("prev");367 this._createSearchNavigationButton("next");368 345 } 369 346 } -
trunk/Source/WebCore/inspector/front-end/inspector.css
r121853 r121911 264 264 } 265 265 266 #toolbar-search-item {267 display: -webkit-box;268 -webkit-box-orient: horizontal;269 -webkit-box-align: center;270 -webkit-box-pack: end;271 }272 273 266 #search { 274 267 width: 205px; 275 font-size: 16px; 276 } 277 278 .with-navigation-buttons #search { 279 width: 165px; 280 } 281 282 .toolbar-search-navigation-label { 283 display: none; 268 margin-left: 4px; 269 margin-right: 4px; 270 font-size: 11px; 271 } 272 273 .toolbar-search-navigation { 274 width: 16px; 275 height: 16px; 276 position: relative; 277 top: 4px; 278 margin: 0px 1px; 279 background-repeat: no-repeat; 280 display: inline-block; 281 background-position: 2px 5px; 284 282 border: 1px solid transparent; 285 border-radius: 2px; 286 padding: 3px; 287 margin-left: 2px; 288 width: 18px; 289 height: 18px; 290 float: right; 291 } 292 293 .with-navigation-buttons .toolbar-search-navigation-label { 294 display: block; 295 } 296 297 .toolbar-search-navigation-label:hover { 283 } 284 285 .toolbar-search-navigation:hover { 298 286 border: 1px solid rgba(120, 120, 120, 0.6); 299 287 } 300 288 301 .toolbar-search-navigation-icon-prev , .toolbar-search-navigation-icon-next { 302 width: 9px; 303 margin-top: 2px; 304 height: 100%; 305 background-repeat: no-repeat; 306 } 307 308 .toolbar-search-navigation-icon-prev { 289 .toolbar-search-navigation.toolbar-search-navigation-prev { 309 290 background-image: url(Images/searchPrev.png); 310 291 } 311 292 312 .toolbar-search-navigation -icon-next {293 .toolbar-search-navigation.toolbar-search-navigation-next { 313 294 background-image: url(Images/searchNext.png); 295 } 296 297 .toolbar-search-navigation-hidden { 298 background: none; 314 299 } 315 300 … … 318 303 } 319 304 320 #search-results-matches {305 .search-results-matches { 321 306 font-size: 11px; 322 307 text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0; 308 padding-left: 4px; 323 309 } 324 310 … … 2428 2414 2429 2415 .search-drawer-header input[type="search"].search-config-search { 2430 2416 font-size: 11px; 2431 2417 margin-left: 4px; 2432 2418 color: #303030; … … 2779 2765 max-width: 200px; 2780 2766 } 2767 2768 .inspector-footer { 2769 position: absolute; 2770 bottom: 0; 2771 left: 0; 2772 right: 0; 2773 font-size: 11px; 2774 padding-left: 7px; 2775 padding-bottom: 7px; 2776 } 2777 2778 .inspector-footer > div { 2779 vertical-align: middle; 2780 } -
trunk/Source/WebCore/inspector/front-end/inspector.html
r121850 r121911 227 227 <div id="toolbar-controls"> 228 228 <div class="toolbar-item"><button id="toolbar-dropdown-arrow" class="toolbar-label">»</button></div> 229 <div class="toolbar-item hidden" id="search-results-matches"></div>230 <div class="toolbar-item" id="toolbar-search-item">231 <input id="search" type="search" incremental results="0">232 <div id="toolbar-search-navigation-control"></div>233 </div>234 229 <div class="toolbar-item close-right"><button id="close-button-right"></button></div> 235 230 </div> -
trunk/Source/WebCore/inspector/front-end/inspector.js
r121843 r121911 262 262 WebInspector.toolbar.compact = x; 263 263 264 if (WebInspector.searchController)265 WebInspector.searchController.updateSearchLabel();266 267 264 if (WebInspector.drawer) 268 265 WebInspector.drawer.resize(); … … 820 817 return; 821 818 822 if (event.key Identifier === "U+001B") { // Escape key819 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code) { 823 820 // If drawer is open with some view other than console then close it. 824 821 if (!this._toggleConsoleButton.toggled && WebInspector.drawer.visible)
Note: See TracChangeset
for help on using the changeset viewer.