| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 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 * 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 tabbedPane.rightToolbar().appendToolbarItem(navigatorMenuButton); | 73 tabbedPane.rightToolbar().appendToolbarItem(navigatorMenuButton); |
| 74 this.editorView.setSidebarWidget(tabbedPane); | 74 this.editorView.setSidebarWidget(tabbedPane); |
| 75 | 75 |
| 76 this._sourcesView = new WebInspector.SourcesView(); | 76 this._sourcesView = new WebInspector.SourcesView(); |
| 77 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel
ected, this._editorSelected.bind(this)); | 77 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel
ected, this._editorSelected.bind(this)); |
| 78 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo
sed, this._editorClosed.bind(this)); | 78 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo
sed, this._editorClosed.bind(this)); |
| 79 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); | 79 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); |
| 80 | 80 |
| 81 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSidebarBu
tton("navigator"); | 81 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSidebarBu
tton("navigator"); |
| 82 this._toggleDebuggerSidebarButton = this._splitWidget.createShowHideSidebarB
utton("debugger"); | 82 this._toggleDebuggerSidebarButton = this._splitWidget.createShowHideSidebarB
utton("debugger"); |
| 83 this._showSourcesViewInPanel(); | 83 this.editorView.setMainWidget(this._sourcesView); |
| 84 this._editorChanged(this._sourcesView.currentUISourceCode()); | 84 this._editorChanged(this._sourcesView.currentUISourceCode()); |
| 85 | 85 |
| 86 this._threadsSidebarPane = null; | 86 this._threadsSidebarPane = null; |
| 87 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie
wManager.view("sources.watch")); | 87 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie
wManager.view("sources.watch")); |
| 88 // TODO: Force installing listeners from the model, not the UI. | 88 // TODO: Force installing listeners from the model, not the UI. |
| 89 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane); | 89 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane); |
| 90 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide
barPane); | 90 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide
barPane); |
| 91 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this)); | 91 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this)); |
| 92 | 92 |
| 93 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update
SidebarPosition.bind(this)); | 93 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update
SidebarPosition.bind(this)); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 return this._paused; | 177 return this._paused; |
| 178 }, | 178 }, |
| 179 | 179 |
| 180 wasShown: function() | 180 wasShown: function() |
| 181 { | 181 { |
| 182 WebInspector.context.setFlavor(WebInspector.SourcesPanel, this); | 182 WebInspector.context.setFlavor(WebInspector.SourcesPanel, this); |
| 183 WebInspector.Panel.prototype.wasShown.call(this); | 183 WebInspector.Panel.prototype.wasShown.call(this); |
| 184 var wrapper = WebInspector.SourcesPanel.WrapperView._instance; | 184 var wrapper = WebInspector.SourcesPanel.WrapperView._instance; |
| 185 if (wrapper && wrapper.isShowing()) { | 185 if (wrapper && wrapper.isShowing()) { |
| 186 WebInspector.inspectorView.setDrawerMinimized(true); | 186 WebInspector.inspectorView.setDrawerMinimized(true); |
| 187 WebInspector.SourcesPanel.updateResizer(this); | 187 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this); |
| 188 } | 188 } |
| 189 this._showSourcesViewInPanel(); | 189 this.editorView.setMainWidget(this._sourcesView); |
| 190 }, | 190 }, |
| 191 | 191 |
| 192 willHide: function() | 192 willHide: function() |
| 193 { | 193 { |
| 194 WebInspector.Panel.prototype.willHide.call(this); | 194 WebInspector.Panel.prototype.willHide.call(this); |
| 195 WebInspector.context.setFlavor(WebInspector.SourcesPanel, null); | 195 WebInspector.context.setFlavor(WebInspector.SourcesPanel, null); |
| 196 if (WebInspector.SourcesPanel.WrapperView.isShowing()) { | 196 if (WebInspector.SourcesPanel.WrapperView.isShowing()) { |
| 197 WebInspector.SourcesPanel.WrapperView._instance._showViewInWrapper()
; | 197 WebInspector.SourcesPanel.WrapperView._instance._showViewInWrapper()
; |
| 198 WebInspector.inspectorView.setDrawerMinimized(false); | 198 WebInspector.inspectorView.setDrawerMinimized(false); |
| 199 WebInspector.SourcesPanel.updateResizer(this); | 199 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this); |
| 200 } | 200 } |
| 201 }, | 201 }, |
| 202 | 202 |
| 203 _showSourcesViewInPanel: function() | |
| 204 { | |
| 205 this._sourcesView.leftToolbar().removeToolbarItems(); | |
| 206 this._sourcesView.leftToolbar().appendToolbarItem(this._toggleNavigatorS
idebarButton); | |
| 207 this._sourcesView.rightToolbar().removeToolbarItems(); | |
| 208 this._sourcesView.rightToolbar().appendToolbarItem(this._toggleDebuggerS
idebarButton); | |
| 209 this.editorView.setMainWidget(this._sourcesView); | |
| 210 }, | |
| 211 | |
| 212 /** | 203 /** |
| 213 * @override | 204 * @override |
| 214 * @param {string} locationName | 205 * @param {string} locationName |
| 215 * @return {?WebInspector.ViewLocation} | 206 * @return {?WebInspector.ViewLocation} |
| 216 */ | 207 */ |
| 217 resolveLocation: function(locationName) | 208 resolveLocation: function(locationName) |
| 218 { | 209 { |
| 219 if (locationName === "sources-sidebar") | 210 if (locationName === "sources-sidebar") |
| 220 return this._sidebarPaneStack; | 211 return this._sidebarPaneStack; |
| 221 else | 212 else |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 | 1036 |
| 1046 if (this.sidebarPaneView && this.sidebarPaneView.shouldHideOnDetach()) | 1037 if (this.sidebarPaneView && this.sidebarPaneView.shouldHideOnDetach()) |
| 1047 return; // We can't reparent extension iframes. | 1038 return; // We can't reparent extension iframes. |
| 1048 | 1039 |
| 1049 if (this.sidebarPaneView) | 1040 if (this.sidebarPaneView) |
| 1050 this.sidebarPaneView.detach(); | 1041 this.sidebarPaneView.detach(); |
| 1051 | 1042 |
| 1052 this._splitWidget.setVertical(!vertically); | 1043 this._splitWidget.setVertical(!vertically); |
| 1053 this._splitWidget.element.classList.toggle("sources-split-view-vertical"
, vertically); | 1044 this._splitWidget.element.classList.toggle("sources-split-view-vertical"
, vertically); |
| 1054 | 1045 |
| 1055 WebInspector.SourcesPanel.updateResizer(this); | 1046 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this); |
| 1056 | 1047 |
| 1057 // Create vertical box with stack. | 1048 // Create vertical box with stack. |
| 1058 var vbox = new WebInspector.VBox(); | 1049 var vbox = new WebInspector.VBox(); |
| 1059 vbox.element.appendChild(this._debugToolbarDrawer); | 1050 vbox.element.appendChild(this._debugToolbarDrawer); |
| 1060 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo
olbarWidth, 100); | 1051 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo
olbarWidth, 100); |
| 1061 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th
is._revealDebuggerSidebar.bind(this)); | 1052 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th
is._revealDebuggerSidebar.bind(this)); |
| 1062 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); | 1053 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); |
| 1063 this._sidebarPaneStack.widget().show(vbox.element); | 1054 this._sidebarPaneStack.widget().show(vbox.element); |
| 1064 vbox.element.appendChild(this._debugToolbar.element); | 1055 vbox.element.appendChild(this._debugToolbar.element); |
| 1065 | 1056 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 WebInspector.SourcesPanel.instance = function() | 1323 WebInspector.SourcesPanel.instance = function() |
| 1333 { | 1324 { |
| 1334 if (WebInspector.SourcesPanel._instance) | 1325 if (WebInspector.SourcesPanel._instance) |
| 1335 return WebInspector.SourcesPanel._instance; | 1326 return WebInspector.SourcesPanel._instance; |
| 1336 return /** @type {!WebInspector.SourcesPanel} */ (self.runtime.sharedInstanc
e(WebInspector.SourcesPanel)); | 1327 return /** @type {!WebInspector.SourcesPanel} */ (self.runtime.sharedInstanc
e(WebInspector.SourcesPanel)); |
| 1337 } | 1328 } |
| 1338 | 1329 |
| 1339 /** | 1330 /** |
| 1340 * @param {!WebInspector.SourcesPanel} panel | 1331 * @param {!WebInspector.SourcesPanel} panel |
| 1341 */ | 1332 */ |
| 1342 WebInspector.SourcesPanel.updateResizer = function(panel) | 1333 WebInspector.SourcesPanel.updateResizerAndSidebarButtons = function(panel) |
| 1343 { | 1334 { |
| 1344 if (panel._splitWidget.isVertical() || (WebInspector.SourcesPanel.WrapperVie
w.isShowing() && !WebInspector.inspectorView.isDrawerMinimized())) | 1335 panel._sourcesView.leftToolbar().removeToolbarItems(); |
| 1336 panel._sourcesView.rightToolbar().removeToolbarItems(); |
| 1337 panel._sourcesView.bottomToolbar().removeToolbarItems(); |
| 1338 var isInWrapper = WebInspector.SourcesPanel.WrapperView.isShowing() && !WebI
nspector.inspectorView.isDrawerMinimized(); |
| 1339 if (panel._splitWidget.isVertical() || isInWrapper) |
| 1345 panel._splitWidget.uninstallResizer(panel._sourcesView.toolbarContainerE
lement()); | 1340 panel._splitWidget.uninstallResizer(panel._sourcesView.toolbarContainerE
lement()); |
| 1346 else | 1341 else |
| 1347 panel._splitWidget.installResizer(panel._sourcesView.toolbarContainerEle
ment()); | 1342 panel._splitWidget.installResizer(panel._sourcesView.toolbarContainerEle
ment()); |
| 1343 if (!isInWrapper) { |
| 1344 panel._sourcesView.leftToolbar().appendToolbarItem(panel._toggleNavigato
rSidebarButton); |
| 1345 if (panel._splitWidget.isVertical()) |
| 1346 panel._sourcesView.rightToolbar().appendToolbarItem(panel._toggleDeb
uggerSidebarButton); |
| 1347 else |
| 1348 panel._sourcesView.bottomToolbar().appendToolbarItem(panel._toggleDe
buggerSidebarButton); |
| 1349 } |
| 1348 } | 1350 } |
| 1349 | 1351 |
| 1350 /** | 1352 /** |
| 1351 * @constructor | 1353 * @constructor |
| 1352 * @extends {WebInspector.VBox} | 1354 * @extends {WebInspector.VBox} |
| 1353 */ | 1355 */ |
| 1354 WebInspector.SourcesPanel.WrapperView = function() | 1356 WebInspector.SourcesPanel.WrapperView = function() |
| 1355 { | 1357 { |
| 1356 WebInspector.VBox.call(this); | 1358 WebInspector.VBox.call(this); |
| 1357 this.element.classList.add("sources-view-wrapper"); | 1359 this.element.classList.add("sources-view-wrapper"); |
| 1358 WebInspector.SourcesPanel.WrapperView._instance = this; | 1360 WebInspector.SourcesPanel.WrapperView._instance = this; |
| 1359 this._view = WebInspector.SourcesPanel.instance()._sourcesView; | 1361 this._view = WebInspector.SourcesPanel.instance()._sourcesView; |
| 1360 } | 1362 } |
| 1361 | 1363 |
| 1362 WebInspector.SourcesPanel.WrapperView.prototype = { | 1364 WebInspector.SourcesPanel.WrapperView.prototype = { |
| 1363 wasShown: function() | 1365 wasShown: function() |
| 1364 { | 1366 { |
| 1365 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV
iew.currentPanel().name !== "sources") | 1367 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV
iew.currentPanel().name !== "sources") |
| 1366 this._showViewInWrapper(); | 1368 this._showViewInWrapper(); |
| 1367 else | 1369 else |
| 1368 WebInspector.inspectorView.setDrawerMinimized(true); | 1370 WebInspector.inspectorView.setDrawerMinimized(true); |
| 1369 WebInspector.SourcesPanel.updateResizer(WebInspector.SourcesPanel.instan
ce()); | 1371 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(WebInspector.So
urcesPanel.instance()); |
| 1370 }, | 1372 }, |
| 1371 | 1373 |
| 1372 willHide: function() | 1374 willHide: function() |
| 1373 { | 1375 { |
| 1374 WebInspector.inspectorView.setDrawerMinimized(false); | 1376 WebInspector.inspectorView.setDrawerMinimized(false); |
| 1375 setImmediate(() => WebInspector.SourcesPanel.updateResizer(WebInspector.
SourcesPanel.instance())); | 1377 setImmediate(() => WebInspector.SourcesPanel.updateResizerAndSidebarButt
ons(WebInspector.SourcesPanel.instance())); |
| 1376 }, | 1378 }, |
| 1377 | 1379 |
| 1378 _showViewInWrapper: function() | 1380 _showViewInWrapper: function() |
| 1379 { | 1381 { |
| 1380 this._view.leftToolbar().removeToolbarItems(); | |
| 1381 this._view.rightToolbar().removeToolbarItems(); | |
| 1382 this._view.show(this.element); | 1382 this._view.show(this.element); |
| 1383 }, | 1383 }, |
| 1384 | 1384 |
| 1385 __proto__: WebInspector.VBox.prototype | 1385 __proto__: WebInspector.VBox.prototype |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 /** | 1388 /** |
| 1389 * @return {boolean} | 1389 * @return {boolean} |
| 1390 */ | 1390 */ |
| 1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() | 1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() |
| 1392 { | 1392 { |
| 1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou
rcesPanel.WrapperView._instance.isShowing(); | 1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou
rcesPanel.WrapperView._instance.isShowing(); |
| 1394 } | 1394 } |
| OLD | NEW |