| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The Chromium Authors. All rights reserved. | 2 * Copyright 2015 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 * @interface | 8 * @interface |
| 9 */ | 9 */ |
| 10 WebInspector.LayerView = function() | 10 WebInspector.LayerView = function() |
| 11 { | 11 { |
| 12 } | 12 }; |
| 13 | 13 |
| 14 WebInspector.LayerView.prototype = { | 14 WebInspector.LayerView.prototype = { |
| 15 /** | 15 /** |
| 16 * @param {?WebInspector.LayerView.Selection} selection | 16 * @param {?WebInspector.LayerView.Selection} selection |
| 17 */ | 17 */ |
| 18 hoverObject: function(selection) { }, | 18 hoverObject: function(selection) { }, |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * @param {?WebInspector.LayerView.Selection} selection | 21 * @param {?WebInspector.LayerView.Selection} selection |
| 22 */ | 22 */ |
| 23 selectObject: function(selection) { }, | 23 selectObject: function(selection) { }, |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * @param {?WebInspector.LayerTreeBase} layerTree | 26 * @param {?WebInspector.LayerTreeBase} layerTree |
| 27 */ | 27 */ |
| 28 setLayerTree: function(layerTree) { } | 28 setLayerTree: function(layerTree) { } |
| 29 } | 29 }; |
| 30 | 30 |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * @constructor | 33 * @constructor |
| 34 * @param {!WebInspector.LayerView.Selection.Type} type | 34 * @param {!WebInspector.LayerView.Selection.Type} type |
| 35 * @param {!WebInspector.Layer} layer | 35 * @param {!WebInspector.Layer} layer |
| 36 */ | 36 */ |
| 37 WebInspector.LayerView.Selection = function(type, layer) | 37 WebInspector.LayerView.Selection = function(type, layer) |
| 38 { | 38 { |
| 39 this._type = type; | 39 this._type = type; |
| 40 this._layer = layer; | 40 this._layer = layer; |
| 41 } | 41 }; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * @enum {string} | 44 * @enum {string} |
| 45 */ | 45 */ |
| 46 WebInspector.LayerView.Selection.Type = { | 46 WebInspector.LayerView.Selection.Type = { |
| 47 Layer: "Layer", | 47 Layer: "Layer", |
| 48 ScrollRect: "ScrollRect", | 48 ScrollRect: "ScrollRect", |
| 49 Tile: "Tile", | 49 Tile: "Tile", |
| 50 } | 50 }; |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * @param {?WebInspector.LayerView.Selection} a | 53 * @param {?WebInspector.LayerView.Selection} a |
| 54 * @param {?WebInspector.LayerView.Selection} b | 54 * @param {?WebInspector.LayerView.Selection} b |
| 55 * @return {boolean} | 55 * @return {boolean} |
| 56 */ | 56 */ |
| 57 WebInspector.LayerView.Selection.isEqual = function(a, b) | 57 WebInspector.LayerView.Selection.isEqual = function(a, b) |
| 58 { | 58 { |
| 59 return a && b ? a._isEqual(b) : a === b; | 59 return a && b ? a._isEqual(b) : a === b; |
| 60 } | 60 }; |
| 61 | 61 |
| 62 WebInspector.LayerView.Selection.prototype = { | 62 WebInspector.LayerView.Selection.prototype = { |
| 63 /** | 63 /** |
| 64 * @return {!WebInspector.LayerView.Selection.Type} | 64 * @return {!WebInspector.LayerView.Selection.Type} |
| 65 */ | 65 */ |
| 66 type: function() | 66 type: function() |
| 67 { | 67 { |
| 68 return this._type; | 68 return this._type; |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * @return {!WebInspector.Layer} | 72 * @return {!WebInspector.Layer} |
| 73 */ | 73 */ |
| 74 layer: function() | 74 layer: function() |
| 75 { | 75 { |
| 76 return this._layer; | 76 return this._layer; |
| 77 }, | 77 }, |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * @param {!WebInspector.LayerView.Selection} other | 80 * @param {!WebInspector.LayerView.Selection} other |
| 81 * @return {boolean} | 81 * @return {boolean} |
| 82 */ | 82 */ |
| 83 _isEqual: function(other) | 83 _isEqual: function(other) |
| 84 { | 84 { |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 } | 87 }; |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * @constructor | 90 * @constructor |
| 91 * @extends {WebInspector.LayerView.Selection} | 91 * @extends {WebInspector.LayerView.Selection} |
| 92 * @param {!WebInspector.Layer} layer | 92 * @param {!WebInspector.Layer} layer |
| 93 */ | 93 */ |
| 94 WebInspector.LayerView.LayerSelection = function(layer) | 94 WebInspector.LayerView.LayerSelection = function(layer) |
| 95 { | 95 { |
| 96 console.assert(layer, "LayerSelection with empty layer"); | 96 console.assert(layer, "LayerSelection with empty layer"); |
| 97 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Layer, layer); | 97 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Layer, layer); |
| 98 } | 98 }; |
| 99 | 99 |
| 100 WebInspector.LayerView.LayerSelection.prototype = { | 100 WebInspector.LayerView.LayerSelection.prototype = { |
| 101 /** | 101 /** |
| 102 * @override | 102 * @override |
| 103 * @param {!WebInspector.LayerView.Selection} other | 103 * @param {!WebInspector.LayerView.Selection} other |
| 104 * @return {boolean} | 104 * @return {boolean} |
| 105 */ | 105 */ |
| 106 _isEqual: function(other) | 106 _isEqual: function(other) |
| 107 { | 107 { |
| 108 return other._type === WebInspector.LayerView.Selection.Type.Layer && ot
her.layer().id() === this.layer().id(); | 108 return other._type === WebInspector.LayerView.Selection.Type.Layer && ot
her.layer().id() === this.layer().id(); |
| 109 }, | 109 }, |
| 110 | 110 |
| 111 __proto__: WebInspector.LayerView.Selection.prototype | 111 __proto__: WebInspector.LayerView.Selection.prototype |
| 112 } | 112 }; |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * @constructor | 115 * @constructor |
| 116 * @extends {WebInspector.LayerView.Selection} | 116 * @extends {WebInspector.LayerView.Selection} |
| 117 * @param {!WebInspector.Layer} layer | 117 * @param {!WebInspector.Layer} layer |
| 118 * @param {number} scrollRectIndex | 118 * @param {number} scrollRectIndex |
| 119 */ | 119 */ |
| 120 WebInspector.LayerView.ScrollRectSelection = function(layer, scrollRectIndex) | 120 WebInspector.LayerView.ScrollRectSelection = function(layer, scrollRectIndex) |
| 121 { | 121 { |
| 122 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.ScrollRect, layer); | 122 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.ScrollRect, layer); |
| 123 this.scrollRectIndex = scrollRectIndex; | 123 this.scrollRectIndex = scrollRectIndex; |
| 124 } | 124 }; |
| 125 | 125 |
| 126 WebInspector.LayerView.ScrollRectSelection.prototype = { | 126 WebInspector.LayerView.ScrollRectSelection.prototype = { |
| 127 /** | 127 /** |
| 128 * @override | 128 * @override |
| 129 * @param {!WebInspector.LayerView.Selection} other | 129 * @param {!WebInspector.LayerView.Selection} other |
| 130 * @return {boolean} | 130 * @return {boolean} |
| 131 */ | 131 */ |
| 132 _isEqual: function(other) | 132 _isEqual: function(other) |
| 133 { | 133 { |
| 134 return other._type === WebInspector.LayerView.Selection.Type.ScrollRect
&& | 134 return other._type === WebInspector.LayerView.Selection.Type.ScrollRect
&& |
| 135 this.layer().id() === other.layer().id() && this.scrollRectIndex ===
other.scrollRectIndex; | 135 this.layer().id() === other.layer().id() && this.scrollRectIndex ===
other.scrollRectIndex; |
| 136 }, | 136 }, |
| 137 | 137 |
| 138 __proto__: WebInspector.LayerView.Selection.prototype | 138 __proto__: WebInspector.LayerView.Selection.prototype |
| 139 } | 139 }; |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * @constructor | 142 * @constructor |
| 143 * @extends {WebInspector.LayerView.Selection} | 143 * @extends {WebInspector.LayerView.Selection} |
| 144 * @param {!WebInspector.Layer} layer | 144 * @param {!WebInspector.Layer} layer |
| 145 * @param {!WebInspector.TracingModel.Event} traceEvent | 145 * @param {!WebInspector.TracingModel.Event} traceEvent |
| 146 */ | 146 */ |
| 147 WebInspector.LayerView.TileSelection = function(layer, traceEvent) | 147 WebInspector.LayerView.TileSelection = function(layer, traceEvent) |
| 148 { | 148 { |
| 149 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Tile, layer); | 149 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Tile, layer); |
| 150 this._traceEvent = traceEvent; | 150 this._traceEvent = traceEvent; |
| 151 } | 151 }; |
| 152 | 152 |
| 153 WebInspector.LayerView.TileSelection.prototype = { | 153 WebInspector.LayerView.TileSelection.prototype = { |
| 154 /** | 154 /** |
| 155 * @override | 155 * @override |
| 156 * @param {!WebInspector.LayerView.Selection} other | 156 * @param {!WebInspector.LayerView.Selection} other |
| 157 * @return {boolean} | 157 * @return {boolean} |
| 158 */ | 158 */ |
| 159 _isEqual: function(other) | 159 _isEqual: function(other) |
| 160 { | 160 { |
| 161 return other._type === WebInspector.LayerView.Selection.Type.Tile | 161 return other._type === WebInspector.LayerView.Selection.Type.Tile |
| 162 && this.layer().id() === other.layer().id() && this.traceEvent === o
ther.traceEvent; | 162 && this.layer().id() === other.layer().id() && this.traceEvent === o
ther.traceEvent; |
| 163 }, | 163 }, |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * @return {!WebInspector.TracingModel.Event} | 166 * @return {!WebInspector.TracingModel.Event} |
| 167 */ | 167 */ |
| 168 traceEvent: function() | 168 traceEvent: function() |
| 169 { | 169 { |
| 170 return this._traceEvent; | 170 return this._traceEvent; |
| 171 }, | 171 }, |
| 172 | 172 |
| 173 __proto__: WebInspector.LayerView.Selection.prototype | 173 __proto__: WebInspector.LayerView.Selection.prototype |
| 174 } | 174 }; |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * @constructor | 177 * @constructor |
| 178 */ | 178 */ |
| 179 WebInspector.LayerViewHost = function() | 179 WebInspector.LayerViewHost = function() |
| 180 { | 180 { |
| 181 /** @type {!Array.<!WebInspector.LayerView>} */ | 181 /** @type {!Array.<!WebInspector.LayerView>} */ |
| 182 this._views = []; | 182 this._views = []; |
| 183 this._selectedObject = null; | 183 this._selectedObject = null; |
| 184 this._hoveredObject = null; | 184 this._hoveredObject = null; |
| 185 this._showInternalLayersSetting = WebInspector.settings.createSetting("layer
sShowInternalLayers", false); | 185 this._showInternalLayersSetting = WebInspector.settings.createSetting("layer
sShowInternalLayers", false); |
| 186 } | 186 }; |
| 187 | 187 |
| 188 WebInspector.LayerViewHost.prototype = { | 188 WebInspector.LayerViewHost.prototype = { |
| 189 /** | 189 /** |
| 190 * @param {!WebInspector.LayerView} layerView | 190 * @param {!WebInspector.LayerView} layerView |
| 191 */ | 191 */ |
| 192 registerView: function(layerView) | 192 registerView: function(layerView) |
| 193 { | 193 { |
| 194 this._views.push(layerView); | 194 this._views.push(layerView); |
| 195 }, | 195 }, |
| 196 | 196 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 * @param {?WebInspector.DOMNode} node | 274 * @param {?WebInspector.DOMNode} node |
| 275 */ | 275 */ |
| 276 _toggleNodeHighlight: function(node) | 276 _toggleNodeHighlight: function(node) |
| 277 { | 277 { |
| 278 if (node) { | 278 if (node) { |
| 279 node.highlightForTwoSeconds(); | 279 node.highlightForTwoSeconds(); |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 WebInspector.DOMModel.hideDOMNodeHighlight(); | 282 WebInspector.DOMModel.hideDOMNodeHighlight(); |
| 283 } | 283 } |
| 284 } | 284 }; |
| 285 | 285 |
| OLD | NEW |