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

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

Issue 2175903002: DevTools: follow-up to view introduction, fix styles css. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean 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 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 /** 125 /**
126 * @constructor 126 * @constructor
127 * @extends {WebInspector.TabbedPane} 127 * @extends {WebInspector.TabbedPane}
128 */ 128 */
129 WebInspector.SidebarTabbedPane = function() 129 WebInspector.SidebarTabbedPane = function()
130 { 130 {
131 WebInspector.TabbedPane.call(this); 131 WebInspector.TabbedPane.call(this);
132 this.element.classList.add("sidebar-pane-container", "sidebar-tabbed-pane"); 132 this.element.classList.add("sidebar-pane-container", "sidebar-tabbed-pane");
133 } 133 }
134 134
135 WebInspector.SidebarTabbedPane._toolbarSymbol = Symbol("toolbar");
136
135 WebInspector.SidebarTabbedPane.prototype = { 137 WebInspector.SidebarTabbedPane.prototype = {
136 /** 138 /**
137 * @param {!WebInspector.View} pane 139 * @param {!WebInspector.View} pane
138 */ 140 */
139 addPane: function(pane) 141 addPane: function(pane)
140 { 142 {
143 // Detach first to trigger toolbar cleanup.
144 pane.detach();
145
141 var title = pane.title(); 146 var title = pane.title();
142
143 var toolbarItems = pane.toolbarItems(); 147 var toolbarItems = pane.toolbarItems();
144 if (toolbarItems.length) { 148 if (toolbarItems.length) {
145 var toolbar = new WebInspector.Toolbar(""); 149 var toolbar = new WebInspector.Toolbar("");
150 pane[WebInspector.SidebarTabbedPane._toolbarSymbol] = toolbar;
146 pane.element.insertBefore(toolbar.element, pane.element.firstChild); 151 pane.element.insertBefore(toolbar.element, pane.element.firstChild);
147 for (var item of toolbarItems) 152 for (var item of toolbarItems)
148 toolbar.appendToolbarItem(item); 153 toolbar.appendToolbarItem(item);
149 } 154 }
150 this.appendTab(title, title, pane); 155 this.appendTab(title, title, pane);
151 pane.setRequestVisibleCallback(this._setPaneVisible.bind(this, pane)); 156 pane.setRequestVisibleCallback(this._setPaneVisible.bind(this, pane));
152 pane.setRevealCallback(this.selectTab.bind(this, title)); 157 pane.setRevealCallback(this.selectTab.bind(this, title));
153 }, 158 },
154 159
155 /** 160 /**
161 * @param {!WebInspector.Widget} widget
162 * @override
163 */
164 childWasDetached: function(widget)
165 {
166 WebInspector.TabbedPane.prototype.childWasDetached.call(this, widget);
167
168 var toolbar = widget[WebInspector.SidebarTabbedPane._toolbarSymbol];
169 if (toolbar)
170 toolbar.element.remove();
171 },
172
173 /**
156 * @param {!WebInspector.View} pane 174 * @param {!WebInspector.View} pane
157 * @param {boolean} visible 175 * @param {boolean} visible
158 */ 176 */
159 _setPaneVisible: function(pane, visible) 177 _setPaneVisible: function(pane, visible)
160 { 178 {
161 var title = pane.title(); 179 var title = pane.title();
162 if (visible) { 180 if (visible) {
163 if (!this.hasTab(title)) 181 if (!this.hasTab(title))
164 this.appendTab(title, title, pane); 182 this.appendTab(title, title, pane);
165 } else { 183 } else {
166 if (this.hasTab(title)) 184 if (this.hasTab(title))
167 this.closeTab(title); 185 this.closeTab(title);
168 } 186 }
169 }, 187 },
170 188
171 __proto__: WebInspector.TabbedPane.prototype 189 __proto__: WebInspector.TabbedPane.prototype
172 } 190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698