| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 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 10 matching lines...) Expand all Loading... |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * @extends {WebInspector.VBox} | 30 * @extends {WebInspector.VBox} |
| 31 * @param {string} name |
| 32 * @param {boolean=} iAmExtensionPanelCannotBeInShadow |
| 31 * @constructor | 33 * @constructor |
| 32 */ | 34 */ |
| 33 WebInspector.Panel = function(name) | 35 WebInspector.Panel = function(name, iAmExtensionPanelCannotBeInShadow) |
| 34 { | 36 { |
| 35 WebInspector.VBox.call(this); | 37 WebInspector.VBox.call(this, !iAmExtensionPanelCannotBeInShadow); |
| 36 | 38 |
| 37 this.element.classList.add("panel"); | 39 this.contentElement.classList.add("panel"); |
| 38 this.element.setAttribute("role", "tabpanel"); | 40 this.contentElement.setAttribute("role", "tabpanel"); |
| 39 this.element.setAttribute("aria-label", name); | 41 this.contentElement.setAttribute("aria-label", name); |
| 40 this.element.classList.add(name); | |
| 41 this._panelName = name; | 42 this._panelName = name; |
| 42 | 43 |
| 43 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({}); | 44 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({}); |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Should by in sync with style declarations. | 47 // Should by in sync with style declarations. |
| 47 WebInspector.Panel.counterRightMargin = 25; | 48 WebInspector.Panel.counterRightMargin = 25; |
| 48 | 49 |
| 49 WebInspector.Panel.prototype = { | 50 WebInspector.Panel.prototype = { |
| 50 get name() | 51 get name() |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 for (var i = 0; i < keys.length; ++i) | 94 for (var i = 0; i < keys.length; ++i) |
| 94 this._shortcuts[keys[i].key] = handler; | 95 this._shortcuts[keys[i].key] = handler; |
| 95 }, | 96 }, |
| 96 | 97 |
| 97 /** | 98 /** |
| 98 * @param {!WebInspector.Infobar} infobar | 99 * @param {!WebInspector.Infobar} infobar |
| 99 */ | 100 */ |
| 100 showInfobar: function(infobar) | 101 showInfobar: function(infobar) |
| 101 { | 102 { |
| 102 infobar.setCloseCallback(this._onInfobarClosed.bind(this, infobar)); | 103 infobar.setCloseCallback(this._onInfobarClosed.bind(this, infobar)); |
| 103 if (this.element.firstChild) | 104 if (this.contentElement.firstChild) |
| 104 this.element.insertBefore(infobar.element, this.element.firstChild); | 105 this.contentElement.insertBefore(infobar.element, this.contentElemen
t.firstChild); |
| 105 else | 106 else |
| 106 this.element.appendChild(infobar.element); | 107 this.contentElement.appendChild(infobar.element); |
| 107 infobar.setParentView(this); | 108 infobar.setParentView(this); |
| 108 this.doResize(); | 109 this.doResize(); |
| 109 }, | 110 }, |
| 110 | 111 |
| 111 /** | 112 /** |
| 112 * @param {!WebInspector.Infobar} infobar | 113 * @param {!WebInspector.Infobar} infobar |
| 113 */ | 114 */ |
| 114 _onInfobarClosed: function(infobar) | 115 _onInfobarClosed: function(infobar) |
| 115 { | 116 { |
| 116 infobar.element.remove(); | 117 infobar.element.remove(); |
| 117 this.doResize(); | 118 this.doResize(); |
| 118 }, | 119 }, |
| 119 | 120 |
| 120 __proto__: WebInspector.VBox.prototype | 121 __proto__: WebInspector.VBox.prototype |
| 121 } | 122 } |
| 122 | 123 |
| 123 /** | 124 /** |
| 124 * @extends {WebInspector.Panel} | 125 * @extends {WebInspector.Panel} |
| 125 * @param {string} name | 126 * @param {string} name |
| 126 * @param {number=} defaultWidth | 127 * @param {number=} defaultWidth |
| 127 * @constructor | 128 * @constructor |
| 128 */ | 129 */ |
| 129 WebInspector.PanelWithSidebar = function(name, defaultWidth) | 130 WebInspector.PanelWithSidebar = function(name, defaultWidth) |
| 130 { | 131 { |
| 131 WebInspector.Panel.call(this, name); | 132 WebInspector.Panel.call(this, name); |
| 132 | 133 |
| 133 this._panelSplitWidget = new WebInspector.SplitWidget(true, false, this._pan
elName + "PanelSplitViewState", defaultWidth || 200); | 134 this._panelSplitWidget = new WebInspector.SplitWidget(true, false, this._pan
elName + "PanelSplitViewState", defaultWidth || 200); |
| 134 this._panelSplitWidget.show(this.element); | 135 this._panelSplitWidget.show(this.contentElement); |
| 135 | 136 |
| 136 this._mainWidget = new WebInspector.VBox(); | 137 this._mainWidget = new WebInspector.VBox(); |
| 137 this._panelSplitWidget.setMainWidget(this._mainWidget); | 138 this._panelSplitWidget.setMainWidget(this._mainWidget); |
| 138 | 139 |
| 139 this._sidebarWidget = new WebInspector.VBox(); | 140 this._sidebarWidget = new WebInspector.VBox(); |
| 140 this._sidebarWidget.setMinimumSize(100, 25); | 141 this._sidebarWidget.setMinimumSize(100, 25); |
| 141 this._panelSplitWidget.setSidebarWidget(this._sidebarWidget); | 142 this._panelSplitWidget.setSidebarWidget(this._sidebarWidget); |
| 142 | 143 |
| 143 this._sidebarWidget.element.classList.add("panel-sidebar"); | 144 this._sidebarWidget.element.classList.add("panel-sidebar"); |
| 144 } | 145 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 229 |
| 229 /** | 230 /** |
| 230 * @override | 231 * @override |
| 231 * @return {!Promise.<!WebInspector.Panel>} | 232 * @return {!Promise.<!WebInspector.Panel>} |
| 232 */ | 233 */ |
| 233 panel: function() | 234 panel: function() |
| 234 { | 235 { |
| 235 return /** @type {!Promise<!WebInspector.Panel>} */(this._extension.ins
tance()); | 236 return /** @type {!Promise<!WebInspector.Panel>} */(this._extension.ins
tance()); |
| 236 } | 237 } |
| 237 } | 238 } |
| OLD | NEW |