OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * @constructor | 8 * @constructor |
9 * @extends {WebInspector.VBox} | 9 * @extends {WebInspector.SplitView} |
10 */ | 10 */ |
11 WebInspector.TimelineLayersView = function() | 11 WebInspector.TimelineLayersView = function() |
12 { | 12 { |
13 WebInspector.VBox.call(this); | 13 WebInspector.SplitView.call(this, true, false, "timelineLayersView"); |
14 | 14 |
15 this._paintTiles = []; | 15 this._paintTiles = []; |
| 16 |
| 17 this.sidebarElement().classList.add("outline-disclosure", "layer-tree"); |
| 18 var sidebarTreeElement = this.sidebarElement().createChild("ol"); |
| 19 var treeOutline = new TreeOutline(sidebarTreeElement); |
| 20 this._layerTreeOutline = new WebInspector.LayerTreeOutline(treeOutline); |
| 21 this._layerTreeOutline.addEventListener(WebInspector.LayerTreeOutline.Events
.LayerSelected, this._onObjectSelected, this); |
| 22 this._layerTreeOutline.addEventListener(WebInspector.LayerTreeOutline.Events
.LayerHovered, this._onObjectHovered, this); |
| 23 |
16 this._layers3DView = new WebInspector.Layers3DView(); | 24 this._layers3DView = new WebInspector.Layers3DView(); |
17 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectS
elected, this._onObjectSelected, this); | 25 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectS
elected, this._onObjectSelected, this); |
18 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectH
overed, this._onObjectHovered, this); | 26 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectH
overed, this._onObjectHovered, this); |
19 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.JumpToP
aintEventRequested, this._jumpToPaintEvent, this); | 27 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.JumpToP
aintEventRequested, this._jumpToPaintEvent, this); |
20 this._layers3DView.show(this.element); | 28 this._layers3DView.show(this.mainElement()); |
21 } | 29 } |
22 | 30 |
23 WebInspector.TimelineLayersView.prototype = { | 31 WebInspector.TimelineLayersView.prototype = { |
24 /** | 32 /** |
25 * @param {!WebInspector.DeferredLayerTree} deferredLayerTree | 33 * @param {!WebInspector.DeferredLayerTree} deferredLayerTree |
26 * @param {?Array.<!WebInspector.LayerPaintEvent>} paints | 34 * @param {?Array.<!WebInspector.LayerPaintEvent>} paints |
27 */ | 35 */ |
28 showLayerTree: function(deferredLayerTree, paints) | 36 showLayerTree: function(deferredLayerTree, paints) |
29 { | 37 { |
30 this._disposeTiles(); | 38 this._disposeTiles(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return; | 126 return; |
119 } | 127 } |
120 this._paintTiles.push({layerId: paintEvent.layerId(), rect: rect, sn
apshot: snapshot, traceEvent: paintEvent.event()}); | 128 this._paintTiles.push({layerId: paintEvent.layerId(), rect: rect, sn
apshot: snapshot, traceEvent: paintEvent.event()}); |
121 } | 129 } |
122 | 130 |
123 /** | 131 /** |
124 * @this {WebInspector.TimelineLayersView} | 132 * @this {WebInspector.TimelineLayersView} |
125 */ | 133 */ |
126 function onLayersAndTilesReady() | 134 function onLayersAndTilesReady() |
127 { | 135 { |
| 136 this._layerTreeOutline.update(layerTree); |
128 this._layers3DView.setLayerTree(layerTree); | 137 this._layers3DView.setLayerTree(layerTree); |
129 this._layers3DView.setTiles(this._paintTiles); | 138 this._layers3DView.setTiles(this._paintTiles); |
130 } | 139 } |
131 }, | 140 }, |
132 | 141 |
133 /** | 142 /** |
134 * @param {?WebInspector.Layers3DView.ActiveObject} activeObject | 143 * @param {?WebInspector.Layers3DView.ActiveObject} activeObject |
135 */ | 144 */ |
136 _selectObject: function(activeObject) | 145 _selectObject: function(activeObject) |
137 { | 146 { |
138 var layer = activeObject && activeObject.layer; | 147 var layer = activeObject && activeObject.layer; |
139 if (this._currentlySelectedLayer === activeObject) | 148 if (this._currentlySelectedLayer === activeObject) |
140 return; | 149 return; |
141 this._currentlySelectedLayer = activeObject; | 150 this._currentlySelectedLayer = activeObject; |
142 this._toggleNodeHighlight(layer ? layer.nodeForSelfOrAncestor() : null); | 151 this._toggleNodeHighlight(layer ? layer.nodeForSelfOrAncestor() : null); |
| 152 this._layerTreeOutline.selectLayer(layer); |
143 this._layers3DView.selectObject(activeObject); | 153 this._layers3DView.selectObject(activeObject); |
144 }, | 154 }, |
145 | 155 |
146 /** | 156 /** |
147 * @param {?WebInspector.Layers3DView.ActiveObject} activeObject | 157 * @param {?WebInspector.Layers3DView.ActiveObject} activeObject |
148 */ | 158 */ |
149 _hoverObject: function(activeObject) | 159 _hoverObject: function(activeObject) |
150 { | 160 { |
151 var layer = activeObject && activeObject.layer; | 161 var layer = activeObject && activeObject.layer; |
152 if (this._currentlyHoveredLayer === activeObject) | 162 if (this._currentlyHoveredLayer === activeObject) |
153 return; | 163 return; |
154 this._currentlyHoveredLayer = activeObject; | 164 this._currentlyHoveredLayer = activeObject; |
155 this._toggleNodeHighlight(layer ? layer.nodeForSelfOrAncestor() : null); | 165 this._toggleNodeHighlight(layer ? layer.nodeForSelfOrAncestor() : null); |
| 166 this._layerTreeOutline.hoverLayer(layer); |
156 this._layers3DView.hoverObject(activeObject); | 167 this._layers3DView.hoverObject(activeObject); |
157 }, | 168 }, |
158 | 169 |
159 /** | 170 /** |
160 * @param {?WebInspector.DOMNode} node | 171 * @param {?WebInspector.DOMNode} node |
161 */ | 172 */ |
162 _toggleNodeHighlight: function(node) | 173 _toggleNodeHighlight: function(node) |
163 { | 174 { |
164 if (node) { | 175 if (node) { |
165 node.highlightForTwoSeconds(); | 176 node.highlightForTwoSeconds(); |
(...skipping 22 matching lines...) Expand all Loading... |
188 this._hoverObject(activeObject); | 199 this._hoverObject(activeObject); |
189 }, | 200 }, |
190 | 201 |
191 _disposeTiles: function() | 202 _disposeTiles: function() |
192 { | 203 { |
193 for (var i = 0; i < this._paintTiles.length; ++i) | 204 for (var i = 0; i < this._paintTiles.length; ++i) |
194 this._paintTiles[i].snapshot.dispose(); | 205 this._paintTiles[i].snapshot.dispose(); |
195 this._paintTiles = []; | 206 this._paintTiles = []; |
196 }, | 207 }, |
197 | 208 |
198 __proto__: WebInspector.VBox.prototype | 209 __proto__: WebInspector.SplitView.prototype |
199 } | 210 } |
OLD | NEW |