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

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: 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 = new WebInspector.HBox();
dgozman 2015/06/11 08:39:31 div.hbox
pfeldman 2015/06/11 09:56:03 Done.
44 hbox.element.classList.add("styles-sidebarpane-toolbar");
45 hbox.show(this.element);
46 var filterContainerElement = hbox.element.createChild("div", "styles-sidebar -pane-filter-box");
47 this._filterInput = WebInspector.StylesSidebarPane.createPropertyFilterEleme nt(WebInspector.UIString("Filter"), hbox.element, this._onFilterChanged.bind(thi s));
48 filterContainerElement.appendChild(this._filterInput);
49
50 var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar ", hbox.element);
dgozman 2015/06/11 08:39:31 Same class for toolbar and hbox. Intended?
pfeldman 2015/06/11 09:56:03 This is not a classname - this is extension point'
44 toolbar.element.classList.add("styles-pane-toolbar"); 51 toolbar.element.classList.add("styles-pane-toolbar");
45 52
46 this._requestShowCallback = requestShowCallback; 53 this._requestShowCallback = requestShowCallback;
47 var toolbarPaneContainer = this.element.createChild("div", "styles-sidebar-t oolbar-pane-container"); 54 var toolbarPaneContainer = this.element.createChild("div", "styles-sidebar-t oolbar-pane-container");
48 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s idebar-toolbar-pane"); 55 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s idebar-toolbar-pane");
49 this._sectionsContainer = this.element.createChild("div"); 56 this._sectionsContainer = this.element.createChild("div");
50 57
51 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper(); 58 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper();
52 59
53 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter()); 60 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) 260 _contextMenuEventFired: function(event)
254 { 261 {
255 // We start editing upon click -> default navigation to resources panel is not available 262 // We start editing upon click -> default navigation to resources panel is not available
256 // Hence we add a soft context menu for hrefs. 263 // Hence we add a soft context menu for hrefs.
257 var contextMenu = new WebInspector.ContextMenu(event); 264 var contextMenu = new WebInspector.ContextMenu(event);
258 contextMenu.appendApplicableItems(/** @type {!Node} */ (event.target)); 265 contextMenu.appendApplicableItems(/** @type {!Node} */ (event.target));
259 contextMenu.show(); 266 contextMenu.show();
260 }, 267 },
261 268
262 /** 269 /**
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 270 * @param {string} propertyName
273 */ 271 */
274 tracePropertyName: function(propertyName) 272 tracePropertyName: function(propertyName)
275 { 273 {
276 this._requestShowCallback(); 274 this._requestShowCallback();
277 this._filterInput.setFilterValue(WebInspector.CSSMetadata.canonicalPrope rtyName(propertyName)); 275 this._filterInput.setFilterValue(WebInspector.CSSMetadata.canonicalPrope rtyName(propertyName));
278 }, 276 },
279 277
280 /** 278 /**
281 * @param {?RegExp} regex 279 * @param {?RegExp} regex
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 delete this._pendingWidget; 859 delete this._pendingWidget;
862 } 860 }
863 } 861 }
864 }, 862 },
865 863
866 __proto__: WebInspector.ElementsSidebarPane.prototype 864 __proto__: WebInspector.ElementsSidebarPane.prototype
867 } 865 }
868 866
869 /** 867 /**
870 * @param {string} placeholder 868 * @param {string} placeholder
869 * @param {!Element} container
870 * @param {function(?RegExp)} filterCallback
871 * @return {!Element} 871 * @return {!Element}
872 * @param {function(?RegExp)} filterCallback
873 */ 872 */
874 WebInspector.StylesSidebarPane.createPropertyFilterElement = function(placeholde r, filterCallback) 873 WebInspector.StylesSidebarPane.createPropertyFilterElement = function(placeholde r, container, filterCallback)
875 { 874 {
876 var input = createElement("input"); 875 var input = createElement("input");
877 input.type = "search"; 876 input.type = "search";
878 input.placeholder = placeholder; 877 input.placeholder = placeholder;
879 878
880 function searchHandler() 879 function searchHandler()
881 { 880 {
882 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null; 881 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null;
883 filterCallback(regex); 882 filterCallback(regex);
884 input.parentNode.classList.toggle("styles-filter-engaged", !!input.value ); 883 container.classList.toggle("styles-filter-engaged", !!input.value);
885 } 884 }
886 input.addEventListener("input", searchHandler, false); 885 input.addEventListener("input", searchHandler, false);
887 886
888 /** 887 /**
889 * @param {!Event} event 888 * @param {!Event} event
890 */ 889 */
891 function keydownHandler(event) 890 function keydownHandler(event)
892 { 891 {
893 var Esc = "U+001B"; 892 var Esc = "U+001B";
894 if (event.keyIdentifier !== Esc || !input.value) 893 if (event.keyIdentifier !== Esc || !input.value)
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 3260
3262 /** 3261 /**
3263 * @override 3262 * @override
3264 * @return {?WebInspector.ToolbarItem} 3263 * @return {?WebInspector.ToolbarItem}
3265 */ 3264 */
3266 item: function() 3265 item: function()
3267 { 3266 {
3268 return this._button; 3267 return this._button;
3269 } 3268 }
3270 } 3269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698