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

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

Issue 2617293002: DevTools: TabbedLocations only materialize tabs when needed (Closed)
Patch Set: Created 3 years, 11 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 | no next file » | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 super(); 36 super();
37 UI.Dialog.setModalHostView(this); 37 UI.Dialog.setModalHostView(this);
38 this.setMinimumSize(240, 72); 38 this.setMinimumSize(240, 72);
39 39
40 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer. 40 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer.
41 this._drawerSplitWidget = new UI.SplitWidget(false, true, 'Inspector.drawerS plitViewState', 200, 200); 41 this._drawerSplitWidget = new UI.SplitWidget(false, true, 'Inspector.drawerS plitViewState', 200, 200);
42 this._drawerSplitWidget.hideSidebar(); 42 this._drawerSplitWidget.hideSidebar();
43 this._drawerSplitWidget.hideDefaultResizer(); 43 this._drawerSplitWidget.hideDefaultResizer();
44 this._drawerSplitWidget.enableShowModeSaving(); 44 this._drawerSplitWidget.enableShowModeSaving();
45 this._drawerSplitWidget.show(this.element); 45 this._drawerSplitWidget.show(this.element);
46 46 this._drawerBuilt = false;
einbinder 2017/01/07 11:51:59 What is this used for?
47 // Create drawer tabbed pane. 47 if (this._drawerSplitWidget.showMode() === UI.SplitWidget.ShowMode.Both)
48 this._drawerTabbedLocation = 48 this._drawerLocation();
49 UI.viewManager.createTabbedLocation(this._showDrawer.bind(this, false), 'drawer-view', true);
50 this._drawerTabbedLocation.enableMoreTabsButton();
51 this._drawerTabbedPane = this._drawerTabbedLocation.tabbedPane();
52 this._drawerTabbedPane.setMinimumSize(0, 27);
53 var closeDrawerButton = new UI.ToolbarButton(Common.UIString('Close drawer') , 'largeicon-delete');
54 closeDrawerButton.addEventListener(UI.ToolbarButton.Events.Click, this._clos eDrawer, this);
55 this._drawerTabbedPane.rightToolbar().appendToolbarItem(closeDrawerButton);
56 this._drawerSplitWidget.installResizer(this._drawerTabbedPane.headerElement( ));
57 this._drawerSplitWidget.setSidebarWidget(this._drawerTabbedPane);
58 49
59 // Create main area tabbed pane. 50 // Create main area tabbed pane.
60 this._tabbedLocation = UI.viewManager.createTabbedLocation( 51 this._tabbedLocation = UI.viewManager.createTabbedLocation(
61 InspectorFrontendHost.bringToFront.bind(InspectorFrontendHost), 'panel', true, true, 52 InspectorFrontendHost.bringToFront.bind(InspectorFrontendHost), 'panel', true, true,
62 Runtime.queryParam('panel')); 53 Runtime.queryParam('panel'));
63 54
64 this._tabbedPane = this._tabbedLocation.tabbedPane(); 55 this._tabbedPane = this._tabbedLocation.tabbedPane();
65 this._tabbedPane.registerRequiredCSS('ui/inspectorViewTabbedPane.css'); 56 this._tabbedPane.registerRequiredCSS('ui/inspectorViewTabbedPane.css');
66 this._tabbedPane.setTabSlider(true); 57 this._tabbedPane.setTabSlider(true);
67 this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._ta bSelected, this); 58 this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._ta bSelected, this);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 willHide() { 94 willHide() {
104 this.element.ownerDocument.removeEventListener('keydown', this._keyDownBound , false); 95 this.element.ownerDocument.removeEventListener('keydown', this._keyDownBound , false);
105 } 96 }
106 97
107 /** 98 /**
108 * @override 99 * @override
109 * @param {string} locationName 100 * @param {string} locationName
110 * @return {?UI.ViewLocation} 101 * @return {?UI.ViewLocation}
111 */ 102 */
112 resolveLocation(locationName) { 103 resolveLocation(locationName) {
113 return this._drawerTabbedLocation; 104 return this._drawerLocation();
114 } 105 }
115 106
116 createToolbars() { 107 createToolbars() {
117 this._tabbedPane.leftToolbar().appendLocationItems('main-toolbar-left'); 108 this._tabbedPane.leftToolbar().appendLocationItems('main-toolbar-left');
118 this._tabbedPane.rightToolbar().appendLocationItems('main-toolbar-right'); 109 this._tabbedPane.rightToolbar().appendLocationItems('main-toolbar-right');
119 } 110 }
120 111
121 /** 112 /**
122 * @param {!UI.View} view 113 * @param {!UI.View} view
123 */ 114 */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 this._tabbedPane.setTabIcon(panelName, icon); 166 this._tabbedPane.setTabIcon(panelName, icon);
176 } 167 }
177 168
178 /** 169 /**
179 * @return {!UI.Panel} 170 * @return {!UI.Panel}
180 */ 171 */
181 currentPanelDeprecated() { 172 currentPanelDeprecated() {
182 return /** @type {!UI.Panel} */ (UI.viewManager.materializedWidget(this._tab bedPane.selectedTabId || '')); 173 return /** @type {!UI.Panel} */ (UI.viewManager.materializedWidget(this._tab bedPane.selectedTabId || ''));
183 } 174 }
184 175
176 _drawerLocation() {
einbinder 2017/01/07 11:51:59 jsdoc @return
177 if (this._drawerTabbedLocation)
178 return this._drawerTabbedLocation;
179 this._drawerBuilt = true;
180 this._drawerTabbedLocation =
einbinder 2017/01/07 11:51:59 jsdoc @type this in constructor
181 UI.viewManager.createTabbedLocation(this._showDrawer.bind(this, false), 'drawer-view', true);
182 this._drawerTabbedLocation.enableMoreTabsButton();
183 this._drawerTabbedPane = this._drawerTabbedLocation.tabbedPane();
einbinder 2017/01/07 11:51:59 var drawerTabbedPane =
184 this._drawerTabbedPane.setMinimumSize(0, 27);
185 var closeDrawerButton = new UI.ToolbarButton(Common.UIString('Close drawer') , 'largeicon-delete');
186 closeDrawerButton.addEventListener(UI.ToolbarButton.Events.Click, this._clos eDrawer, this);
187 this._drawerTabbedPane.rightToolbar().appendToolbarItem(closeDrawerButton);
188 this._drawerSplitWidget.installResizer(this._drawerTabbedPane.headerElement( ));
189 this._drawerSplitWidget.setSidebarWidget(this._drawerTabbedPane);
190 return this._drawerTabbedLocation;
191 }
192
185 /** 193 /**
186 * @param {boolean} focus 194 * @param {boolean} focus
187 */ 195 */
188 _showDrawer(focus) { 196 _showDrawer(focus) {
189 if (this._drawerTabbedPane.isShowing()) 197 if (this._drawerLocation().tabbedPane().isShowing())
190 return; 198 return;
191 this._drawerSplitWidget.showBoth(); 199 this._drawerSplitWidget.showBoth();
192 if (focus) 200 if (focus)
193 this._focusRestorer = new UI.WidgetFocusRestorer(this._drawerTabbedPane); 201 this._focusRestorer = new UI.WidgetFocusRestorer(this._drawerLocation().ta bbedPane());
194 else 202 else
195 this._focusRestorer = null; 203 this._focusRestorer = null;
196 } 204 }
197 205
198 /** 206 /**
199 * @return {boolean} 207 * @return {boolean}
200 */ 208 */
201 drawerVisible() { 209 drawerVisible() {
202 return this._drawerTabbedPane.isShowing(); 210 return this._drawerLocation().tabbedPane().isShowing();
einbinder 2017/01/07 11:51:59 !!this._drawerTabbedLocation && this._drawerLocati
203 } 211 }
204 212
205 _closeDrawer() { 213 _closeDrawer() {
206 if (!this._drawerTabbedPane.isShowing()) 214 if (!this._drawerLocation().tabbedPane().isShowing())
einbinder 2017/01/07 11:51:59 !!this._drawerTabbedLocation && this._drawerLocati
207 return; 215 return;
208 if (this._focusRestorer) 216 if (this._focusRestorer)
209 this._focusRestorer.restore(); 217 this._focusRestorer.restore();
210 this._drawerSplitWidget.hideSidebar(true); 218 this._drawerSplitWidget.hideSidebar(true);
211 } 219 }
212 220
213 /** 221 /**
214 * @param {boolean} minimized 222 * @param {boolean} minimized
215 */ 223 */
216 setDrawerMinimized(minimized) { 224 setDrawerMinimized(minimized) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 * @return {boolean} 321 * @return {boolean}
314 */ 322 */
315 handleAction(context, actionId) { 323 handleAction(context, actionId) {
316 if (UI.inspectorView.drawerVisible()) 324 if (UI.inspectorView.drawerVisible())
317 UI.inspectorView._closeDrawer(); 325 UI.inspectorView._closeDrawer();
318 else 326 else
319 UI.inspectorView._showDrawer(true); 327 UI.inspectorView._showDrawer(true);
320 return true; 328 return true;
321 } 329 }
322 }; 330 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698