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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/ViewContainers.js

Issue 2207283002: DevTools: make sidebar section headers wider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 * @param {!WebInspector.View} view 8 * @param {!WebInspector.View} view
9 */ 9 */
10 WebInspector.View._ContainerWidget = function(view) 10 WebInspector.View._ContainerWidget = function(view)
(...skipping 26 matching lines...) Expand all
37 WebInspector.VBox.call(this, true); 37 WebInspector.VBox.call(this, true);
38 this.element.classList.add("flex-none"); 38 this.element.classList.add("flex-none");
39 this.registerRequiredCSS("ui/viewContainers.css"); 39 this.registerRequiredCSS("ui/viewContainers.css");
40 40
41 this._titleElement = createElementWithClass("div", "expandable-view-title"); 41 this._titleElement = createElementWithClass("div", "expandable-view-title");
42 this._titleElement.textContent = view.title(); 42 this._titleElement.textContent = view.title();
43 this._titleElement.tabIndex = 0; 43 this._titleElement.tabIndex = 0;
44 this._titleElement.addEventListener("click", this._toggleExpanded.bind(this) , false); 44 this._titleElement.addEventListener("click", this._toggleExpanded.bind(this) , false);
45 this._titleElement.addEventListener("keydown", this._onTitleKeyDown.bind(thi s), false); 45 this._titleElement.addEventListener("keydown", this._onTitleKeyDown.bind(thi s), false);
46 this.contentElement.insertBefore(this._titleElement, this.contentElement.fir stChild); 46 this.contentElement.insertBefore(this._titleElement, this.contentElement.fir stChild);
47
47 var toolbarElement = this.contentElement.createChild("div"); 48 var toolbarElement = this.contentElement.createChild("div");
48 var toolbarItems = view.toolbarItems(); 49 var toolbarItems = view.toolbarItems();
49 if (toolbarItems.length) { 50 if (toolbarItems.length) {
50 var toolbar = new WebInspector.Toolbar("", this._titleElement); 51 this._toolbar = new WebInspector.Toolbar("");
51 for (var item of toolbarItems) 52 for (var item of toolbarItems)
52 toolbar.appendToolbarItem(item); 53 this._toolbar.appendToolbarItem(item);
53 } 54 }
54 55
55 this.contentElement.createChild("content"); 56 this.contentElement.createChild("content");
56 this._view = view; 57 this._view = view;
57 this._view.attach(this); 58 this._view.attach(this);
58 this._view[WebInspector.View._ExpandableContainerWidget._elementSymbol] = th is.element; 59 this._view[WebInspector.View._ExpandableContainerWidget._elementSymbol] = th is.element;
59 if (expanded) 60 if (expanded)
60 this.revealChild(this._view); 61 this.revealChild(this._view);
61 } 62 }
62 63
63 WebInspector.View._ExpandableContainerWidget._elementSymbol = Symbol("container- widget-element"); 64 WebInspector.View._ExpandableContainerWidget._elementSymbol = Symbol("container- widget-element");
64 65
65 WebInspector.View._ExpandableContainerWidget.prototype = { 66 WebInspector.View._ExpandableContainerWidget.prototype = {
66 /** 67 /**
67 * @override 68 * @override
68 * @param {!WebInspector.Widget} child 69 * @param {!WebInspector.Widget} child
69 * @return {boolean} 70 * @return {boolean}
70 */ 71 */
71 revealChild: function(child) 72 revealChild: function(child)
72 { 73 {
73 if (this._titleElement.classList.contains("expanded")) 74 if (this._titleElement.classList.contains("expanded"))
74 return true; 75 return true;
76 if (this._toolbar)
77 this._titleElement.appendChild(this._toolbar.element);
75 this._titleElement.classList.add("expanded"); 78 this._titleElement.classList.add("expanded");
76 this._view.showWidget(this.element); 79 this._view.showWidget(this.element);
77 return true; 80 return true;
78 }, 81 },
79 82
80 _collapse: function() 83 _collapse: function()
81 { 84 {
82 if (!this._titleElement.classList.contains("expanded")) 85 if (!this._titleElement.classList.contains("expanded"))
83 return; 86 return;
87 if (this._toolbar)
88 this._toolbar.element.remove();
84 this._titleElement.classList.remove("expanded"); 89 this._titleElement.classList.remove("expanded");
85 this._view.hideWidget(); 90 this._view.hideWidget();
86 }, 91 },
87 92
88 _toggleExpanded: function() 93 _toggleExpanded: function()
89 { 94 {
90 if (this._titleElement.classList.contains("expanded")) 95 if (this._titleElement.classList.contains("expanded"))
91 this._collapse(); 96 this._collapse();
92 else 97 else
93 this.revealChild(this._view); 98 this.revealChild(this._view);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 * @param {boolean=} reveal 216 * @param {boolean=} reveal
212 * @override 217 * @override
213 */ 218 */
214 insertViewBefore: function(view, insertBefore, reveal) 219 insertViewBefore: function(view, insertBefore, reveal)
215 { 220 {
216 new WebInspector.View._ExpandableContainerWidget(view, reveal || false). show(this.contentElement, insertBefore ? insertBefore[WebInspector.View._Expanda bleContainerWidget._elementSymbol] : null); 221 new WebInspector.View._ExpandableContainerWidget(view, reveal || false). show(this.contentElement, insertBefore ? insertBefore[WebInspector.View._Expanda bleContainerWidget._elementSymbol] : null);
217 }, 222 },
218 223
219 __proto__: WebInspector.VBox.prototype 224 __proto__: WebInspector.VBox.prototype
220 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698