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

Side by Side Diff: Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 1175253002: DevTools: move filter bar into the style toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments addressed. Created 5 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 * @param {function()} requestShowCallback 33 * @param {function()} requestShowCallback
34 */ 34 */
35 WebInspector.StylesSidebarPane = function(requestShowCallback) 35 WebInspector.StylesSidebarPane = function(requestShowCallback)
36 { 36 {
37 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles")) ; 37 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles")) ;
38 38
39 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true); 39 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true);
40 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind (this)); 40 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind (this));
41 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update .bind(this)); 41 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update .bind(this));
42 42
43 var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar ", this.element); 43 var hbox = this.element.createChild("div", "hbox styles-sidebar-pane-toolbar ");
44 var filterContainerElement = hbox.createChild("div", "styles-sidebar-pane-fi lter-box");
45 this._filterInput = WebInspector.StylesSidebarPane.createPropertyFilterEleme nt(WebInspector.UIString("Filter"), hbox, this._onFilterChanged.bind(this));
46 filterContainerElement.appendChild(this._filterInput);
47
48 var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar ", hbox);
44 toolbar.element.classList.add("styles-pane-toolbar"); 49 toolbar.element.classList.add("styles-pane-toolbar");
45 50
46 this._requestShowCallback = requestShowCallback; 51 this._requestShowCallback = requestShowCallback;
47 var toolbarPaneContainer = this.element.createChild("div", "styles-sidebar-t oolbar-pane-container"); 52 var toolbarPaneContainer = this.element.createChild("div", "styles-sidebar-t oolbar-pane-container");
48 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s idebar-toolbar-pane"); 53 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s idebar-toolbar-pane");
49 this._sectionsContainer = this.element.createChild("div"); 54 this._sectionsContainer = this.element.createChild("div");
50 55
51 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper(); 56 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper();
52 57
53 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter()); 58 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter());
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 _contextMenuEventFired: function(event) 258 _contextMenuEventFired: function(event)
254 { 259 {
255 // We start editing upon click -> default navigation to resources panel is not available 260 // We start editing upon click -> default navigation to resources panel is not available
256 // Hence we add a soft context menu for hrefs. 261 // Hence we add a soft context menu for hrefs.
257 var contextMenu = new WebInspector.ContextMenu(event); 262 var contextMenu = new WebInspector.ContextMenu(event);
258 contextMenu.appendApplicableItems(/** @type {!Node} */ (event.target)); 263 contextMenu.appendApplicableItems(/** @type {!Node} */ (event.target));
259 contextMenu.show(); 264 contextMenu.show();
260 }, 265 },
261 266
262 /** 267 /**
263 * @param {!Element} matchedStylesElement
264 */
265 setFilterBoxContainer: function(matchedStylesElement)
266 {
267 this._filterInput = WebInspector.StylesSidebarPane.createPropertyFilterE lement(WebInspector.UIString("Find in Styles"), this._onFilterChanged.bind(this) );
268 matchedStylesElement.appendChild(this._filterInput);
269 },
270
271 /**
272 * @param {string} propertyName 268 * @param {string} propertyName
273 */ 269 */
274 tracePropertyName: function(propertyName) 270 tracePropertyName: function(propertyName)
275 { 271 {
276 this._requestShowCallback(); 272 this._requestShowCallback();
277 this._filterInput.setFilterValue(WebInspector.CSSMetadata.canonicalPrope rtyName(propertyName)); 273 this._filterInput.setFilterValue(WebInspector.CSSMetadata.canonicalPrope rtyName(propertyName));
278 }, 274 },
279 275
280 /** 276 /**
281 * @param {?RegExp} regex 277 * @param {?RegExp} regex
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 delete this._pendingWidget; 857 delete this._pendingWidget;
862 } 858 }
863 } 859 }
864 }, 860 },
865 861
866 __proto__: WebInspector.ElementsSidebarPane.prototype 862 __proto__: WebInspector.ElementsSidebarPane.prototype
867 } 863 }
868 864
869 /** 865 /**
870 * @param {string} placeholder 866 * @param {string} placeholder
867 * @param {!Element} container
868 * @param {function(?RegExp)} filterCallback
871 * @return {!Element} 869 * @return {!Element}
872 * @param {function(?RegExp)} filterCallback
873 */ 870 */
874 WebInspector.StylesSidebarPane.createPropertyFilterElement = function(placeholde r, filterCallback) 871 WebInspector.StylesSidebarPane.createPropertyFilterElement = function(placeholde r, container, filterCallback)
875 { 872 {
876 var input = createElement("input"); 873 var input = createElement("input");
877 input.type = "search";
878 input.placeholder = placeholder; 874 input.placeholder = placeholder;
879 875
880 function searchHandler() 876 function searchHandler()
881 { 877 {
882 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null; 878 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null;
883 filterCallback(regex); 879 filterCallback(regex);
884 input.parentNode.classList.toggle("styles-filter-engaged", !!input.value ); 880 container.classList.toggle("styles-filter-engaged", !!input.value);
885 } 881 }
886 input.addEventListener("input", searchHandler, false); 882 input.addEventListener("input", searchHandler, false);
887 883
888 /** 884 /**
889 * @param {!Event} event 885 * @param {!Event} event
890 */ 886 */
891 function keydownHandler(event) 887 function keydownHandler(event)
892 { 888 {
893 var Esc = "U+001B"; 889 var Esc = "U+001B";
894 if (event.keyIdentifier !== Esc || !input.value) 890 if (event.keyIdentifier !== Esc || !input.value)
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 3257
3262 /** 3258 /**
3263 * @override 3259 * @override
3264 * @return {?WebInspector.ToolbarItem} 3260 * @return {?WebInspector.ToolbarItem}
3265 */ 3261 */
3266 item: function() 3262 item: function()
3267 { 3263 {
3268 return this._button; 3264 return this._button;
3269 } 3265 }
3270 } 3266 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/ElementsPanel.js ('k') | Source/devtools/front_end/elements/computedStyleSidebarPane.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698