| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 importScript("LayerTreeOutline.js"); | 31 importScript("LayerTreeOutline.js"); |
| 32 importScript("LayerDetailsView.js"); | 32 importScript("LayerDetailsView.js"); |
| 33 importScript("PaintProfilerView.js"); | 33 importScript("PaintProfilerView.js"); |
| 34 importScript("LayerPaintProfilerView.js"); |
| 34 | 35 |
| 35 /** | 36 /** |
| 36 * @constructor | 37 * @constructor |
| 37 * @extends {WebInspector.PanelWithSidebarTree} | 38 * @extends {WebInspector.PanelWithSidebarTree} |
| 38 */ | 39 */ |
| 39 WebInspector.LayersPanel = function() | 40 WebInspector.LayersPanel = function() |
| 40 { | 41 { |
| 41 WebInspector.PanelWithSidebarTree.call(this, "layers", 225); | 42 WebInspector.PanelWithSidebarTree.call(this, "layers", 225); |
| 42 this.registerRequiredCSS("layersPanel.css"); | 43 this.registerRequiredCSS("layersPanel.css"); |
| 43 | 44 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 64 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectH
overed, this._onObjectHovered, this); | 65 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectH
overed, this._onObjectHovered, this); |
| 65 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.LayerSn
apshotRequested, this._onSnapshotRequested, this); | 66 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.LayerSn
apshotRequested, this._onSnapshotRequested, this); |
| 66 this._layers3DView.registerShortcuts(this.registerShortcuts.bind(this)); | 67 this._layers3DView.registerShortcuts(this.registerShortcuts.bind(this)); |
| 67 | 68 |
| 68 this._tabbedPane = new WebInspector.TabbedPane(); | 69 this._tabbedPane = new WebInspector.TabbedPane(); |
| 69 this._tabbedPane.show(this._rightSplitView.sidebarElement()); | 70 this._tabbedPane.show(this._rightSplitView.sidebarElement()); |
| 70 | 71 |
| 71 this._layerDetailsView = new WebInspector.LayerDetailsView(); | 72 this._layerDetailsView = new WebInspector.LayerDetailsView(); |
| 72 this._layerDetailsView.addEventListener(WebInspector.LayerDetailsView.Events
.ObjectSelected, this._onObjectSelected, this); | 73 this._layerDetailsView.addEventListener(WebInspector.LayerDetailsView.Events
.ObjectSelected, this._onObjectSelected, this); |
| 73 this._tabbedPane.appendTab(WebInspector.LayersPanel.DetailsViewTabs.Details,
WebInspector.UIString("Details"), this._layerDetailsView); | 74 this._tabbedPane.appendTab(WebInspector.LayersPanel.DetailsViewTabs.Details,
WebInspector.UIString("Details"), this._layerDetailsView); |
| 74 this._paintProfilerView = new WebInspector.PaintProfilerView(this._model, th
is._layers3DView); | 75 |
| 76 this._paintProfilerView = new WebInspector.LayerPaintProfilerView(this._laye
rs3DView.showImageForLayer.bind(this._layers3DView)); |
| 75 this._tabbedPane.appendTab(WebInspector.LayersPanel.DetailsViewTabs.Profiler
, WebInspector.UIString("Profiler"), this._paintProfilerView); | 77 this._tabbedPane.appendTab(WebInspector.LayersPanel.DetailsViewTabs.Profiler
, WebInspector.UIString("Profiler"), this._paintProfilerView); |
| 76 } | 78 } |
| 77 | 79 |
| 78 WebInspector.LayersPanel.DetailsViewTabs = { | 80 WebInspector.LayersPanel.DetailsViewTabs = { |
| 79 Details: "details", | 81 Details: "details", |
| 80 Profiler: "profiler" | 82 Profiler: "profiler" |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 WebInspector.LayersPanel.prototype = { | 85 WebInspector.LayersPanel.prototype = { |
| 84 wasShown: function() | 86 wasShown: function() |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 this._hoverObject(activeObject); | 152 this._hoverObject(activeObject); |
| 151 }, | 153 }, |
| 152 | 154 |
| 153 /** | 155 /** |
| 154 * @param {!WebInspector.Event} event | 156 * @param {!WebInspector.Event} event |
| 155 */ | 157 */ |
| 156 _onSnapshotRequested: function(event) | 158 _onSnapshotRequested: function(event) |
| 157 { | 159 { |
| 158 var layer = /** @type {!WebInspector.Layer} */ (event.data); | 160 var layer = /** @type {!WebInspector.Layer} */ (event.data); |
| 159 this._tabbedPane.selectTab(WebInspector.LayersPanel.DetailsViewTabs.Prof
iler); | 161 this._tabbedPane.selectTab(WebInspector.LayersPanel.DetailsViewTabs.Prof
iler); |
| 160 this._paintProfilerView.profile(layer); | 162 this._paintProfilerView.profileLayer(layer); |
| 161 }, | 163 }, |
| 162 | 164 |
| 163 /** | 165 /** |
| 164 * @param {?WebInspector.Layers3DView.ActiveObject} activeObject | 166 * @param {?WebInspector.Layers3DView.ActiveObject} activeObject |
| 165 */ | 167 */ |
| 166 _selectObject: function(activeObject) | 168 _selectObject: function(activeObject) |
| 167 { | 169 { |
| 168 var layer = activeObject && activeObject.layer; | 170 var layer = activeObject && activeObject.layer; |
| 169 if (this._currentlySelectedLayer === activeObject) | 171 if (this._currentlySelectedLayer === activeObject) |
| 170 return; | 172 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 190 this._currentlyHoveredLayer = activeObject; | 192 this._currentlyHoveredLayer = activeObject; |
| 191 var node = layer ? layer.nodeForSelfOrAncestor() : null; | 193 var node = layer ? layer.nodeForSelfOrAncestor() : null; |
| 192 if (node) | 194 if (node) |
| 193 node.highlight(); | 195 node.highlight(); |
| 194 else | 196 else |
| 195 this._target.domModel.hideDOMNodeHighlight(); | 197 this._target.domModel.hideDOMNodeHighlight(); |
| 196 this._layerTreeOutline.hoverLayer(layer); | 198 this._layerTreeOutline.hoverLayer(layer); |
| 197 this._layers3DView.hoverObject(activeObject); | 199 this._layers3DView.hoverObject(activeObject); |
| 198 }, | 200 }, |
| 199 | 201 |
| 202 /** |
| 203 * @param {!WebInspector.Layer} layer |
| 204 * @param {string=} imageURL |
| 205 */ |
| 206 _showImageForLayer: function(layer, imageURL) |
| 207 { |
| 208 this._layers3DView.showImageForLayer(layer, imageURL); |
| 209 }, |
| 210 |
| 200 __proto__: WebInspector.PanelWithSidebarTree.prototype | 211 __proto__: WebInspector.PanelWithSidebarTree.prototype |
| 201 } | 212 } |
| 202 | 213 |
| 203 /** | 214 /** |
| 204 * @constructor | 215 * @constructor |
| 205 * @implements {WebInspector.Revealer} | 216 * @implements {WebInspector.Revealer} |
| 206 */ | 217 */ |
| 207 WebInspector.LayersPanel.LayerTreeRevealer = function() | 218 WebInspector.LayersPanel.LayerTreeRevealer = function() |
| 208 { | 219 { |
| 209 } | 220 } |
| 210 | 221 |
| 211 WebInspector.LayersPanel.LayerTreeRevealer.prototype = { | 222 WebInspector.LayersPanel.LayerTreeRevealer.prototype = { |
| 212 /** | 223 /** |
| 213 * @param {!Object} snapshotData | 224 * @param {!Object} snapshotData |
| 214 */ | 225 */ |
| 215 reveal: function(snapshotData) | 226 reveal: function(snapshotData) |
| 216 { | 227 { |
| 217 if (!(snapshotData instanceof WebInspector.DeferredLayerTree)) | 228 if (!(snapshotData instanceof WebInspector.DeferredLayerTree)) |
| 218 return; | 229 return; |
| 219 var panel = /** @type {!WebInspector.LayersPanel} */ (WebInspector.inspe
ctorView.showPanel("layers")); | 230 var panel = /** @type {!WebInspector.LayersPanel} */ (WebInspector.inspe
ctorView.showPanel("layers")); |
| 220 panel._showLayerTree(/** @type {!WebInspector.DeferredLayerTree} */ (sna
pshotData)); | 231 panel._showLayerTree(/** @type {!WebInspector.DeferredLayerTree} */ (sna
pshotData)); |
| 221 } | 232 } |
| 222 } | 233 } |
| OLD | NEW |