Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: Source/WebCore/inspector/front-end/SearchController.js

Issue 10377162: Merge 116672 - Web Inspector: search title is shown beside the search field (not under) in the vert… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/WebCore/inspector/front-end/inspector.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * Copyright (C) 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2011 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 18 matching lines...) Expand all
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 /** 32 /**
33 * @constructor 33 * @constructor
34 */ 34 */
35 WebInspector.SearchController = function() 35 WebInspector.SearchController = function()
36 { 36 {
37 this.element = document.getElementById("search"); 37 this.element = document.getElementById("search");
38 this._matchesElement = document.getElementById("search-results-matches"); 38 this._matchesElement = document.getElementById("search-results-matches");
39 this._toolbarLabelElement = document.getElementById("search-toolbar-label"); 39 this._searchItemElement = document.getElementById("toolbar-search-item");
40 this._searchControlBoxElement = document.getElementById("toolbar-search-navi gation-control"); 40 this._searchControlBoxElement = document.getElementById("toolbar-search-navi gation-control");
41 41
42 this.element.addEventListener("search", this._onSearch.bind(this), false); / / when the search is emptied 42 this.element.addEventListener("search", this._onSearch.bind(this), false); / / when the search is emptied
43 this.element.addEventListener("mousedown", this._onSearchFieldManualFocus.bi nd(this), false); // when the search field is manually selected 43 this.element.addEventListener("mousedown", this._onSearchFieldManualFocus.bi nd(this), false); // when the search field is manually selected
44 this.element.addEventListener("keydown", this._onKeyDown.bind(this), true); 44 this.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
45 45
46 this._populateSearchNavigationButtons(); 46 this._populateSearchNavigationButtons();
47 } 47 }
48 48
49 WebInspector.SearchController.prototype = { 49 WebInspector.SearchController.prototype = {
(...skipping 13 matching lines...) Expand all
63 if (panel === WebInspector.inspectorView.currentPanel()) 63 if (panel === WebInspector.inspectorView.currentPanel())
64 this._updateSearchMatchesCountAndCurrentMatchIndex(panel.currentSear chMatches, currentMatchIndex); 64 this._updateSearchMatchesCountAndCurrentMatchIndex(panel.currentSear chMatches, currentMatchIndex);
65 }, 65 },
66 66
67 updateSearchLabel: function() 67 updateSearchLabel: function()
68 { 68 {
69 var panelName = WebInspector.inspectorView.currentPanel() && WebInspecto r.inspectorView.currentPanel().toolbarItemLabel; 69 var panelName = WebInspector.inspectorView.currentPanel() && WebInspecto r.inspectorView.currentPanel().toolbarItemLabel;
70 if (!panelName) 70 if (!panelName)
71 return; 71 return;
72 var newLabel = WebInspector.UIString("Search %s", panelName); 72 var newLabel = WebInspector.UIString("Search %s", panelName);
73 if (WebInspector.isCompactMode()) 73 this.element.setAttribute("placeholder", newLabel);
74 this.element.setAttribute("placeholder", newLabel);
75 else {
76 this.element.removeAttribute("placeholder");
77 this._toolbarLabelElement.textContent = newLabel;
78 }
79 }, 74 },
80 75
81 cancelSearch: function() 76 cancelSearch: function()
82 { 77 {
83 this.element.value = ""; 78 this.element.value = "";
84 this._performSearch(""); 79 this._performSearch("");
85 }, 80 },
86 81
87 disableSearchUntilExplicitAction: function(event) 82 disableSearchUntilExplicitAction: function(event)
88 { 83 {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Perform the search on a timeout so the panel switches fast. 144 // Perform the search on a timeout so the panel switches fast.
150 setTimeout(performPanelSearch.bind(this), 0); 145 setTimeout(performPanelSearch.bind(this), 0);
151 } else { 146 } else {
152 // Update to show Not found for panels that can't be searched. 147 // Update to show Not found for panels that can't be searched.
153 this._updateSearchMatchesCountAndCurrentMatchIndex(); 148 this._updateSearchMatchesCountAndCurrentMatchIndex();
154 } 149 }
155 }, 150 },
156 151
157 _updateSearchNavigationButtonState: function(visible) 152 _updateSearchNavigationButtonState: function(visible)
158 { 153 {
159 if (visible) { 154 if (visible)
160 this._searchNavigationNext.removeStyleClass("hidden"); 155 this._searchItemElement.addStyleClass("with-navigation-buttons");
161 this._searchNavigationPrev.removeStyleClass("hidden"); 156 else
162 } else { 157 this._searchItemElement.removeStyleClass("with-navigation-buttons");
163 this._searchNavigationNext.addStyleClass("hidden");
164 this._searchNavigationPrev.addStyleClass("hidden");
165 }
166 }, 158 },
167 159
168 /** 160 /**
169 * @param {?number=} matches 161 * @param {?number=} matches
170 * @param {number=} currentMatchIndex 162 * @param {number=} currentMatchIndex
171 */ 163 */
172 _updateSearchMatchesCountAndCurrentMatchIndex: function(matches, currentMatc hIndex) 164 _updateSearchMatchesCountAndCurrentMatchIndex: function(matches, currentMatc hIndex)
173 { 165 {
174 if (matches == null) { 166 if (matches == null) {
175 this._matchesElement.addStyleClass("hidden"); 167 this._matchesElement.addStyleClass("hidden");
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 }, 323 },
332 324
333 /** 325 /**
334 * @param {string=} direction 326 * @param {string=} direction
335 */ 327 */
336 _createSearchNavigationButton: function(direction) 328 _createSearchNavigationButton: function(direction)
337 { 329 {
338 var searchNavigationControlElement = document.createElement("div"); 330 var searchNavigationControlElement = document.createElement("div");
339 var searchNavigationIconElement = document.createElement("div"); 331 var searchNavigationIconElement = document.createElement("div");
340 332
341 searchNavigationControlElement.className = "toolbar-search-navigation-la bel hidden"; 333 searchNavigationControlElement.className = "toolbar-search-navigation-la bel";
342 334
343 switch (direction) { 335 switch (direction) {
344 case "prev": 336 case "prev":
345 var searchTitle = WebInspector.UIString("Search Previous"); 337 var searchTitle = WebInspector.UIString("Search Previous");
346 searchNavigationIconElement.className = "toolbar-search-navigation-i con-prev"; 338 searchNavigationIconElement.className = "toolbar-search-navigation-i con-prev";
347 this._searchNavigationPrev = searchNavigationControlElement; 339 this._searchNavigationPrev = searchNavigationControlElement;
348 this._searchNavigationPrev.addEventListener("mousedown", this._onPre vButtonSearch.bind(this), false); 340 this._searchNavigationPrev.addEventListener("mousedown", this._onPre vButtonSearch.bind(this), false);
349 break; 341 break;
350 342
351 case "next": 343 case "next":
(...skipping 14 matching lines...) Expand all
366 // Lazily adding search navigation keys to dom. 358 // Lazily adding search navigation keys to dom.
367 this._createSearchNavigationButton("prev"); 359 this._createSearchNavigationButton("prev");
368 this._createSearchNavigationButton("next"); 360 this._createSearchNavigationButton("next");
369 } 361 }
370 } 362 }
371 363
372 /** 364 /**
373 * @type {?WebInspector.SearchController} 365 * @type {?WebInspector.SearchController}
374 */ 366 */
375 WebInspector.searchController = null; 367 WebInspector.searchController = null;
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/inspector/front-end/inspector.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698