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 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @param {!WebInspector.LayerViewHost} layerViewHost | 33 * @param {!WebInspector.LayerViewHost} layerViewHost |
34 * @extends {WebInspector.View} | 34 * @extends {WebInspector.Widget} |
35 * @implements {WebInspector.LayerView} | 35 * @implements {WebInspector.LayerView} |
36 */ | 36 */ |
37 WebInspector.LayerDetailsView = function(layerViewHost) | 37 WebInspector.LayerDetailsView = function(layerViewHost) |
38 { | 38 { |
39 WebInspector.View.call(this); | 39 WebInspector.Widget.call(this); |
40 this.element.classList.add("layer-details-view"); | 40 this.element.classList.add("layer-details-view"); |
41 this._layerViewHost = layerViewHost; | 41 this._layerViewHost = layerViewHost; |
42 this._layerViewHost.registerView(this); | 42 this._layerViewHost.registerView(this); |
43 this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("Select a
layer to see its details")); | 43 this._emptyWidget = new WebInspector.EmptyWidget(WebInspector.UIString("Sele
ct a layer to see its details")); |
44 this._buildContent(); | 44 this._buildContent(); |
45 } | 45 } |
46 | 46 |
47 /** | 47 /** |
48 * @enum {string} | 48 * @enum {string} |
49 */ | 49 */ |
50 WebInspector.LayerDetailsView.Events = { | 50 WebInspector.LayerDetailsView.Events = { |
51 PaintProfilerRequested: "PaintProfilerRequested" | 51 PaintProfilerRequested: "PaintProfilerRequested" |
52 } | 52 } |
53 | 53 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 }, | 110 }, |
111 | 111 |
112 /** | 112 /** |
113 * @param {?WebInspector.LayerTreeBase} layerTree | 113 * @param {?WebInspector.LayerTreeBase} layerTree |
114 * @override | 114 * @override |
115 */ | 115 */ |
116 setLayerTree: function(layerTree) { }, | 116 setLayerTree: function(layerTree) { }, |
117 | 117 |
118 wasShown: function() | 118 wasShown: function() |
119 { | 119 { |
120 WebInspector.View.prototype.wasShown.call(this); | 120 WebInspector.Widget.prototype.wasShown.call(this); |
121 this.update(); | 121 this.update(); |
122 }, | 122 }, |
123 | 123 |
124 /** | 124 /** |
125 * @param {number} index | 125 * @param {number} index |
126 * @param {!Event} event | 126 * @param {!Event} event |
127 */ | 127 */ |
128 _onScrollRectClicked: function(index, event) | 128 _onScrollRectClicked: function(index, event) |
129 { | 129 { |
130 if (event.which !== 1) | 130 if (event.which !== 1) |
(...skipping 22 matching lines...) Expand all Loading... |
153 ", " + scrollRect.rect.width + ", " + scrollRect.rect.height + ")"; | 153 ", " + scrollRect.rect.width + ", " + scrollRect.rect.height + ")"; |
154 element.addEventListener("click", this._onScrollRectClicked.bind(this, i
ndex), false); | 154 element.addEventListener("click", this._onScrollRectClicked.bind(this, i
ndex), false); |
155 }, | 155 }, |
156 | 156 |
157 update: function() | 157 update: function() |
158 { | 158 { |
159 var layer = this._selection && this._selection.layer(); | 159 var layer = this._selection && this._selection.layer(); |
160 if (!layer) { | 160 if (!layer) { |
161 this._tableElement.remove(); | 161 this._tableElement.remove(); |
162 this._paintProfilerButton.remove(); | 162 this._paintProfilerButton.remove(); |
163 this._emptyView.show(this.element); | 163 this._emptyWidget.show(this.element); |
164 return; | 164 return; |
165 } | 165 } |
166 this._emptyView.detach(); | 166 this._emptyWidget.detach(); |
167 this.element.appendChild(this._tableElement); | 167 this.element.appendChild(this._tableElement); |
168 this.element.appendChild(this._paintProfilerButton); | 168 this.element.appendChild(this._paintProfilerButton); |
169 this._sizeCell.textContent = WebInspector.UIString("%d × %d (at %d,%d)",
layer.width(), layer.height(), layer.offsetX(), layer.offsetY()); | 169 this._sizeCell.textContent = WebInspector.UIString("%d × %d (at %d,%d)",
layer.width(), layer.height(), layer.offsetX(), layer.offsetY()); |
170 this._paintCountCell.parentElement.classList.toggle("hidden", !layer.pai
ntCount()); | 170 this._paintCountCell.parentElement.classList.toggle("hidden", !layer.pai
ntCount()); |
171 this._paintCountCell.textContent = layer.paintCount(); | 171 this._paintCountCell.textContent = layer.paintCount(); |
172 this._memoryEstimateCell.textContent = Number.bytesToString(layer.gpuMem
oryUsage()); | 172 this._memoryEstimateCell.textContent = Number.bytesToString(layer.gpuMem
oryUsage()); |
173 layer.requestCompositingReasons(this._updateCompositingReasons.bind(this
)); | 173 layer.requestCompositingReasons(this._updateCompositingReasons.bind(this
)); |
174 this._scrollRectsCell.removeChildren(); | 174 this._scrollRectsCell.removeChildren(); |
175 layer.scrollRects().forEach(this._createScrollRectElement.bind(this)); | 175 layer.scrollRects().forEach(this._createScrollRectElement.bind(this)); |
176 var traceEvent = this._selection.type() === WebInspector.LayerView.Selec
tion.Type.Tile ? /** @type {!WebInspector.LayerView.TileSelection} */ (this._sel
ection).traceEvent() : null; | 176 var traceEvent = this._selection.type() === WebInspector.LayerView.Selec
tion.Type.Tile ? /** @type {!WebInspector.LayerView.TileSelection} */ (this._sel
ection).traceEvent() : null; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 var list = this._compositingReasonsCell.createChild("ul"); | 215 var list = this._compositingReasonsCell.createChild("ul"); |
216 for (var i = 0; i < compositingReasons.length; ++i) { | 216 for (var i = 0; i < compositingReasons.length; ++i) { |
217 var text = WebInspector.LayerDetailsView.CompositingReasonDetail[com
positingReasons[i]] || compositingReasons[i]; | 217 var text = WebInspector.LayerDetailsView.CompositingReasonDetail[com
positingReasons[i]] || compositingReasons[i]; |
218 // If the text is more than one word but does not terminate with per
iod, add the period. | 218 // If the text is more than one word but does not terminate with per
iod, add the period. |
219 if (/\s.*[^.]$/.test(text)) | 219 if (/\s.*[^.]$/.test(text)) |
220 text += "."; | 220 text += "."; |
221 list.createChild("li").textContent = text; | 221 list.createChild("li").textContent = text; |
222 } | 222 } |
223 }, | 223 }, |
224 | 224 |
225 __proto__: WebInspector.View.prototype | 225 __proto__: WebInspector.Widget.prototype |
226 } | 226 } |
OLD | NEW |