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

Side by Side Diff: Source/devtools/front_end/InspectorView.js

Issue 71633003: DevTools: added "overlayContents" mode, where DevTools content is placed around and underneath inse… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No-op if no overlayContents Created 7 years 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) 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 21 matching lines...) Expand all
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.View} 33 * @extends {WebInspector.View}
34 */ 34 */
35 WebInspector.InspectorView = function() 35 WebInspector.InspectorView = function()
36 { 36 {
37 WebInspector.View.call(this); 37 WebInspector.View.call(this);
38 this.markAsRoot(); 38 this.markAsRoot();
39 this.element.classList.add("fill", "vbox", "inspector-view"); 39 this.element.classList.add("fill", "vbox", "inspector-view");
40 this.element.setAttribute("spellcheck", false); 40 this.element.setAttribute("spellcheck", false);
41 41
42 this._splitView = new WebInspector.SplitView(false, "InspectorViewContentsSi ze", 300, 300);
pfeldman 2013/12/05 15:44:06 "InspectorView.splitView"
dgozman 2013/12/06 16:17:13 Done.
43 this._splitView.setSecondIsSidebar(true);
44 this._splitView.setSidebarElementConstraints(150, 50);
45 this._splitView.setMainElementConstraints(50, 50);
46 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._updateSplitView.bind(this));
47 this._splitView.addEventListener(WebInspector.SplitView.Events.LayoutChanged , this._onSplitViewLayout.bind(this));
pfeldman 2013/12/05 15:44:06 var overlayView = new WebInspector.ViewWithResizeC
dgozman 2013/12/06 16:17:13 Done.
48
49 this._splitView.element.id = "inspector-split-view";
50 this._splitView.show(this.element);
51
52 this._overlayElement = this._splitView.mainElement;
53 this._devtoolsElement = this._splitView.sidebarElement;
54 this._devtoolsElement.classList.add("vbox");
pfeldman 2013/12/05 15:44:06 we typically use addStyleClass there.
55
42 this._tabbedPane = new WebInspector.TabbedPane(); 56 this._tabbedPane = new WebInspector.TabbedPane();
43 this._tabbedPane.setRetainTabsOrder(true); 57 this._tabbedPane.setRetainTabsOrder(true);
44 this._tabbedPane.show(this.element); 58 this._tabbedPane.show(this._devtoolsElement);
45 59
46 var toolbarElement = document.createElement("div"); 60 this._toolbarElement = document.createElement("div");
47 toolbarElement.className = "toolbar toolbar-background"; 61 this._toolbarElement.className = "toolbar toolbar-background";
48 var headerElement = this._tabbedPane.headerElement(); 62 var headerElement = this._tabbedPane.headerElement();
49 headerElement.parentElement.insertBefore(toolbarElement, headerElement); 63 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement );
50 64
51 this._leftToolbarElement = toolbarElement.createChild("div", "toolbar-contro ls-left"); 65 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar- controls-left");
52 toolbarElement.appendChild(headerElement); 66 this._toolbarElement.appendChild(headerElement);
53 this._rightToolbarElement = toolbarElement.createChild("div", "toolbar-contr ols-right"); 67 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar -controls-right");
54 68
55 this._errorWarningCountElement = this._rightToolbarElement.createChild("div" , "hidden"); 69 this._errorWarningCountElement = this._rightToolbarElement.createChild("div" , "hidden");
56 this._errorWarningCountElement.id = "error-warning-count"; 70 this._errorWarningCountElement.id = "error-warning-count";
57 71
58 this._drawer = new WebInspector.Drawer(this); 72 this._drawer = new WebInspector.Drawer(this);
59 this.appendToRightToolbar(this._drawer.toggleButtonElement()); 73 this.appendToRightToolbar(this._drawer.toggleButtonElement());
60 74
61 this._history = []; 75 this._history = [];
62 this._historyIterator = -1; 76 this._historyIterator = -1;
63 document.addEventListener("keydown", this._keyDown.bind(this), false); 77 document.addEventListener("keydown", this._keyDown.bind(this), false);
64 document.addEventListener("keypress", this._keyPress.bind(this), false); 78 document.addEventListener("keypress", this._keyPress.bind(this), false);
65 this._panelDescriptors = {}; 79 this._panelDescriptors = {};
66 80
67 // Windows and Mac have two different definitions of '[' and ']', so accept both of each. 81 // Windows and Mac have two different definitions of '[' and ']', so accept both of each.
68 this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet(); 82 this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet();
69 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); 83 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet();
70 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi vePanel", "elements"); 84 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi vePanel", "elements");
85
86 this._updateSplitView();
71 } 87 }
72 88
73 WebInspector.InspectorView.prototype = { 89 WebInspector.InspectorView.prototype = {
74 /** 90 /**
75 * @param {Element} element 91 * @param {Element} element
76 */ 92 */
77 appendToLeftToolbar: function(element) 93 appendToLeftToolbar: function(element)
78 { 94 {
79 this._leftToolbarElement.appendChild(element); 95 this._leftToolbarElement.appendChild(element);
80 }, 96 },
81 97
82 /** 98 /**
83 * @param {Element} element 99 * @param {Element} element
84 */ 100 */
85 appendToRightToolbar: function(element) 101 appendToRightToolbar: function(element)
86 { 102 {
87 this._rightToolbarElement.appendChild(element); 103 this._rightToolbarElement.appendChild(element);
88 }, 104 },
89 105
90 /** 106 /**
91 * @return {WebInspector.Drawer} 107 * @return {WebInspector.Drawer}
92 */ 108 */
93 drawer: function() 109 drawer: function()
94 { 110 {
95 return this._drawer; 111 return this._drawer;
96 }, 112 },
97 113
98 /** 114 /**
115 * @return {Element}
116 */
117 devtoolsElement: function()
118 {
119 return this._devtoolsElement;
120 },
121
122 /**
99 * @param {WebInspector.PanelDescriptor} panelDescriptor 123 * @param {WebInspector.PanelDescriptor} panelDescriptor
100 */ 124 */
101 addPanel: function(panelDescriptor) 125 addPanel: function(panelDescriptor)
102 { 126 {
103 var panelName = panelDescriptor.name(); 127 var panelName = panelDescriptor.name();
104 this._panelDescriptors[panelName] = panelDescriptor; 128 this._panelDescriptors[panelName] = panelDescriptor;
105 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn spector.View()); 129 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn spector.View());
106 if (this._lastActivePanelSetting.get() === panelName) 130 if (this._lastActivePanelSetting.get() === panelName)
107 this._tabbedPane.selectTab(panelName); 131 this._tabbedPane.selectTab(panelName);
108 }, 132 },
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 this._historyIterator = this._history.length - 1; 374 this._historyIterator = this._history.length - 1;
351 }, 375 },
352 376
353 onResize: function() 377 onResize: function()
354 { 378 {
355 // FIXME: make drawer a view. 379 // FIXME: make drawer a view.
356 this.doResize(); 380 this.doResize();
357 this._drawer.resize(); 381 this._drawer.resize();
358 }, 382 },
359 383
384 _updateSplitView: function()
385 {
386 if (WebInspector.useOverlayContentsLayout()) {
387 this._splitView.showBoth();
388 var vertical = WebInspector.dockController.dockSide() === WebInspect or.DockController.State.DockedToRight;
389 this._splitView.setVertical(vertical);
390 if (vertical) {
391 this._splitView.uninstallResizer(this._tabbedPane.headerElement( ));
392 this._splitView.installResizer(this._splitView.resizerElement()) ;
393 } else {
394 this._splitView.uninstallResizer(this._splitView.resizerElement( ));
395 this._splitView.installResizer(this._tabbedPane.headerElement()) ;
396 }
397 } else {
398 this._splitView.showOnlySecond();
399 }
400 },
401
402 _onSplitViewLayout: function()
403 {
404 if (WebInspector.useOverlayContentsLayout()) {
405 // Leave 3px room for resizer.
406 var bottom = this._splitView.isVertical() ? 0 : this._splitView.side barSize();
407 var right = this._splitView.isVertical() ? this._splitView.sidebarSi ze() + 3 : 0;
408 InspectorFrontendHost.setContentsOffsets(0, 0, right, bottom);
409 }
410
411 // FIXME: make drawer a view.
412 this._drawer.resize();
413 },
414
360 __proto__: WebInspector.View.prototype 415 __proto__: WebInspector.View.prototype
361 } 416 };
362 417
363 /** 418 /**
364 * @type {WebInspector.InspectorView} 419 * @type {WebInspector.InspectorView}
365 */ 420 */
366 WebInspector.inspectorView = null; 421 WebInspector.inspectorView = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698