Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._updateSplitView.bind(this)); | 47 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._updateSplitView.bind(this)); |
| 48 | 48 |
| 49 this._splitView.element.id = "inspector-split-view"; | 49 this._splitView.element.id = "inspector-split-view"; |
| 50 this._splitView.show(this.element); | 50 this._splitView.show(this.element); |
| 51 | 51 |
| 52 this._overlayView = new WebInspector.ViewWithResizeCallback(this._onOverlayR esized.bind(this)); | 52 this._overlayView = new WebInspector.ViewWithResizeCallback(this._onOverlayR esized.bind(this)); |
| 53 this._splitView.setMainView(this._overlayView); | 53 this._splitView.setMainView(this._overlayView); |
| 54 this._zoomFactor = WebInspector.zoomFactor(); | 54 this._zoomFactor = WebInspector.zoomFactor(); |
| 55 WebInspector.settings.zoomLevel.addChangeListener(this._onZoomChanged, this) ; | 55 WebInspector.settings.zoomLevel.addChangeListener(this._onZoomChanged, this) ; |
| 56 | 56 |
| 57 this._devtoolsElement = this._splitView.sidebarElement(); | 57 this._devtoolsView = new WebInspector.View(); |
|
pfeldman
2014/01/24 13:22:57
I've seen this too many times. Lets extract WebIns
dgozman
2014/01/24 14:03:49
Do you mean we should switch current usages to Web
| |
| 58 this._devtoolsElement.classList.add("vbox"); | 58 this._devtoolsView.element.classList.add("vbox", "fill"); |
|
pfeldman
2014/01/24 13:22:57
.className = "fill vbox";
dgozman
2014/01/24 14:03:49
Done.
| |
| 59 this._splitView.setSidebarView(this._devtoolsView); | |
| 59 | 60 |
| 60 this._tabbedPane = new WebInspector.TabbedPane(); | 61 this._tabbedPane = new WebInspector.TabbedPane(); |
| 61 this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderCom parator(WebInspector.Panel, "name", "order")); | 62 this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderCom parator(WebInspector.Panel, "name", "order")); |
| 62 this._splitView.setSidebarView(this._tabbedPane); | 63 this._tabbedPane.show(this._devtoolsView.element); |
| 63 | 64 |
| 64 this._toolbarElement = document.createElement("div"); | 65 this._toolbarElement = document.createElement("div"); |
| 65 this._toolbarElement.className = "toolbar toolbar-background"; | 66 this._toolbarElement.className = "toolbar toolbar-background"; |
| 66 var headerElement = this._tabbedPane.headerElement(); | 67 var headerElement = this._tabbedPane.headerElement(); |
| 67 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement ); | 68 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement ); |
| 68 | 69 |
| 69 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar- controls-left"); | 70 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar- controls-left"); |
| 70 this._toolbarElement.appendChild(headerElement); | 71 this._toolbarElement.appendChild(headerElement); |
| 71 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar -controls-right"); | 72 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar -controls-right"); |
| 72 | 73 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 drawer: function() | 143 drawer: function() |
| 143 { | 144 { |
| 144 return this._drawer; | 145 return this._drawer; |
| 145 }, | 146 }, |
| 146 | 147 |
| 147 /** | 148 /** |
| 148 * @return {!Element} | 149 * @return {!Element} |
| 149 */ | 150 */ |
| 150 devtoolsElement: function() | 151 devtoolsElement: function() |
| 151 { | 152 { |
| 152 return this._devtoolsElement; | 153 return this._devtoolsView.element; |
| 153 }, | 154 }, |
| 154 | 155 |
| 155 /** | 156 /** |
| 156 * @param {!WebInspector.PanelDescriptor} panelDescriptor | 157 * @param {!WebInspector.PanelDescriptor} panelDescriptor |
| 157 */ | 158 */ |
| 158 addPanel: function(panelDescriptor) | 159 addPanel: function(panelDescriptor) |
| 159 { | 160 { |
| 160 var panelName = panelDescriptor.name(); | 161 var panelName = panelDescriptor.name(); |
| 161 this._panelDescriptors[panelName] = panelDescriptor; | 162 this._panelDescriptors[panelName] = panelDescriptor; |
| 162 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn spector.View()); | 163 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn spector.View()); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 { | 402 { |
| 402 // FIXME: make drawer a view. | 403 // FIXME: make drawer a view. |
| 403 this.doResize(); | 404 this.doResize(); |
| 404 this._drawer.resize(); | 405 this._drawer.resize(); |
| 405 }, | 406 }, |
| 406 | 407 |
| 407 _updateSplitView: function() | 408 _updateSplitView: function() |
| 408 { | 409 { |
| 409 var dockSide = WebInspector.dockController.dockSide(); | 410 var dockSide = WebInspector.dockController.dockSide(); |
| 410 if (dockSide !== WebInspector.DockController.State.Undocked) { | 411 if (dockSide !== WebInspector.DockController.State.Undocked) { |
| 411 this._splitView.showBoth(); | 412 var vertical = WebInspector.dockController.isVertical(); |
| 412 var vertical = dockSide === WebInspector.DockController.State.Docked ToRight; | |
| 413 this._splitView.setVertical(vertical); | 413 this._splitView.setVertical(vertical); |
| 414 if (vertical) { | 414 if (vertical) { |
| 415 this._splitView.setSecondIsSidebar(dockSide === WebInspector.Doc kController.State.DockedToRight); | |
| 415 this._splitView.uninstallResizer(this._tabbedPane.headerElement( )); | 416 this._splitView.uninstallResizer(this._tabbedPane.headerElement( )); |
| 416 this._splitView.installResizer(this._splitView.resizerElement()) ; | 417 this._splitView.installResizer(this._splitView.resizerElement()) ; |
| 417 } else { | 418 } else { |
| 419 this._splitView.setSecondIsSidebar(true); | |
| 418 this._splitView.uninstallResizer(this._splitView.resizerElement( )); | 420 this._splitView.uninstallResizer(this._splitView.resizerElement( )); |
| 419 this._splitView.installResizer(this._tabbedPane.headerElement()) ; | 421 this._splitView.installResizer(this._tabbedPane.headerElement()) ; |
| 420 } | 422 } |
| 423 this._splitView.setMainView(this._overlayView); | |
| 424 this._splitView.setSidebarView(this._devtoolsView); | |
| 425 this._splitView.showBoth(); | |
| 421 } else { | 426 } else { |
| 427 this._splitView.setSecondIsSidebar(true); | |
| 428 this._splitView.setMainView(this._overlayView); | |
| 429 this._splitView.setSidebarView(this._devtoolsView); | |
| 422 this._splitView.showOnlySecond(); | 430 this._splitView.showOnlySecond(); |
| 423 } | 431 } |
| 424 }, | 432 }, |
| 425 | 433 |
| 426 _onOverlayResized: function() | 434 _onOverlayResized: function() |
| 427 { | 435 { |
| 428 var dockSide = WebInspector.dockController.dockSide(); | 436 var dockSide = WebInspector.dockController.dockSide(); |
| 429 if (dockSide !== WebInspector.DockController.State.Undocked) { | 437 if (dockSide !== WebInspector.DockController.State.Undocked) { |
| 430 if (this._setContentsInsetsId) | 438 if (this._setContentsInsetsId) |
| 431 window.cancelAnimationFrame(this._setContentsInsetsId); | 439 window.cancelAnimationFrame(this._setContentsInsetsId); |
| 432 this._setContentsInsetsId = window.requestAnimationFrame(this._setCo ntentsInsets.bind(this)); | 440 this._setContentsInsetsId = window.requestAnimationFrame(this._setCo ntentsInsets.bind(this)); |
| 433 } | 441 } |
| 434 | 442 |
| 435 // FIXME: make drawer a view. | 443 // FIXME: make drawer a view. |
| 436 this._drawer.resize(); | 444 this._drawer.resize(); |
| 437 }, | 445 }, |
| 438 | 446 |
| 439 _setContentsInsets: function() | 447 _setContentsInsets: function() |
| 440 { | 448 { |
| 441 delete this._setContentsInsetsId; | 449 delete this._setContentsInsetsId; |
| 442 // Leave 3px room for resizer. | |
| 443 var sidebarSize = Math.ceil(this._splitView.sidebarSize() * WebInspector .zoomFactor()); | 450 var sidebarSize = Math.ceil(this._splitView.sidebarSize() * WebInspector .zoomFactor()); |
| 444 var bottom = this._splitView.isVertical() ? 0 : sidebarSize; | 451 var bottom = this._splitView.isVertical() ? 0 : sidebarSize; |
| 445 var right = this._splitView.isVertical() ? sidebarSize + 3 : 0; | 452 // Leave 3px room for resizer. |
| 446 InspectorFrontendHost.setContentsInsets(0, 0, bottom, right); | 453 var vertical = this._splitView.isVertical() ? sidebarSize + 3 : 0; |
| 454 var right = this._splitView.isSidebarSecond() ? vertical : 0; | |
| 455 var left = this._splitView.isSidebarSecond() ? 0 : vertical; | |
| 456 InspectorFrontendHost.setContentsInsets(0, left, bottom, right); | |
| 447 }, | 457 }, |
| 448 | 458 |
| 449 _onZoomChanged: function() | 459 _onZoomChanged: function() |
| 450 { | 460 { |
| 451 this._updateConstraints(); | 461 this._updateConstraints(); |
| 452 var zoomFactor = WebInspector.zoomFactor(); | 462 var zoomFactor = WebInspector.zoomFactor(); |
| 453 if (zoomFactor !== this._zoomFactor) | 463 if (zoomFactor !== this._zoomFactor) |
| 454 this._splitView.setSidebarSize(this._splitView.sidebarSize() * this. _zoomFactor / zoomFactor, true); | 464 this._splitView.setSidebarSize(this._splitView.sidebarSize() * this. _zoomFactor / zoomFactor, true); |
| 455 this._zoomFactor = zoomFactor; | 465 this._zoomFactor = zoomFactor; |
| 456 }, | 466 }, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 this._tabbedPane.headerResized(); | 545 this._tabbedPane.headerResized(); |
| 536 }, | 546 }, |
| 537 | 547 |
| 538 __proto__: WebInspector.View.prototype | 548 __proto__: WebInspector.View.prototype |
| 539 }; | 549 }; |
| 540 | 550 |
| 541 /** | 551 /** |
| 542 * @type {!WebInspector.InspectorView} | 552 * @type {!WebInspector.InspectorView} |
| 543 */ | 553 */ |
| 544 WebInspector.inspectorView; | 554 WebInspector.inspectorView; |
| OLD | NEW |