| 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() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 /** |
| 53 * @param {?WebInspector.LayerView.Selection} a |
| 54 * @param {?WebInspector.LayerView.Selection} b |
| 55 * @return {boolean} |
| 56 */ |
| 57 WebInspector.LayerView.Selection.isEqual = function(a, b) |
| 58 { |
| 59 return a && b ? a._isEqual(b) : a === b; |
| 60 } |
| 61 |
| 52 WebInspector.LayerView.Selection.prototype = { | 62 WebInspector.LayerView.Selection.prototype = { |
| 53 /** | 63 /** |
| 54 * @return {!WebInspector.LayerView.Selection.Type} | 64 * @return {!WebInspector.LayerView.Selection.Type} |
| 55 */ | 65 */ |
| 56 type: function() | 66 type: function() |
| 57 { | 67 { |
| 58 return this._type; | 68 return this._type; |
| 59 }, | 69 }, |
| 60 | 70 |
| 61 /** | 71 /** |
| 62 * @return {!WebInspector.Layer} | 72 * @return {!WebInspector.Layer} |
| 63 */ | 73 */ |
| 64 layer: function() | 74 layer: function() |
| 65 { | 75 { |
| 66 return this._layer; | 76 return this._layer; |
| 67 }, | 77 }, |
| 68 | 78 |
| 69 /** | 79 /** |
| 70 * @param {!WebInspector.LayerView.Selection} other | 80 * @param {!WebInspector.LayerView.Selection} other |
| 71 * @return {boolean} | 81 * @return {boolean} |
| 72 */ | 82 */ |
| 73 isEqual: function(other) | 83 _isEqual: function(other) |
| 74 { | 84 { |
| 75 return false; | 85 return false; |
| 76 } | 86 } |
| 77 } | 87 } |
| 78 | 88 |
| 79 /** | 89 /** |
| 80 * @constructor | 90 * @constructor |
| 81 * @extends {WebInspector.LayerView.Selection} | 91 * @extends {WebInspector.LayerView.Selection} |
| 82 * @param {!WebInspector.Layer} layer | 92 * @param {!WebInspector.Layer} layer |
| 83 */ | 93 */ |
| 84 WebInspector.LayerView.LayerSelection = function(layer) | 94 WebInspector.LayerView.LayerSelection = function(layer) |
| 85 { | 95 { |
| 86 console.assert(layer, "LayerSelection with empty layer"); | 96 console.assert(layer, "LayerSelection with empty layer"); |
| 87 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Layer, layer); | 97 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Layer, layer); |
| 88 } | 98 } |
| 89 | 99 |
| 90 WebInspector.LayerView.LayerSelection.prototype = { | 100 WebInspector.LayerView.LayerSelection.prototype = { |
| 91 /** | 101 /** |
| 92 * @override | 102 * @override |
| 93 * @param {!WebInspector.LayerView.Selection} other | 103 * @param {!WebInspector.LayerView.Selection} other |
| 94 * @return {boolean} | 104 * @return {boolean} |
| 95 */ | 105 */ |
| 96 isEqual: function(other) | 106 _isEqual: function(other) |
| 97 { | 107 { |
| 98 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(); |
| 99 }, | 109 }, |
| 100 | 110 |
| 101 __proto__: WebInspector.LayerView.Selection.prototype | 111 __proto__: WebInspector.LayerView.Selection.prototype |
| 102 } | 112 } |
| 103 | 113 |
| 104 /** | 114 /** |
| 105 * @constructor | 115 * @constructor |
| 106 * @extends {WebInspector.LayerView.Selection} | 116 * @extends {WebInspector.LayerView.Selection} |
| 107 * @param {!WebInspector.Layer} layer | 117 * @param {!WebInspector.Layer} layer |
| 108 * @param {number} scrollRectIndex | 118 * @param {number} scrollRectIndex |
| 109 */ | 119 */ |
| 110 WebInspector.LayerView.ScrollRectSelection = function(layer, scrollRectIndex) | 120 WebInspector.LayerView.ScrollRectSelection = function(layer, scrollRectIndex) |
| 111 { | 121 { |
| 112 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.ScrollRect, layer); | 122 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.ScrollRect, layer); |
| 113 this.scrollRectIndex = scrollRectIndex; | 123 this.scrollRectIndex = scrollRectIndex; |
| 114 } | 124 } |
| 115 | 125 |
| 116 WebInspector.LayerView.ScrollRectSelection.prototype = { | 126 WebInspector.LayerView.ScrollRectSelection.prototype = { |
| 117 /** | 127 /** |
| 118 * @override | 128 * @override |
| 119 * @param {!WebInspector.LayerView.Selection} other | 129 * @param {!WebInspector.LayerView.Selection} other |
| 120 * @return {boolean} | 130 * @return {boolean} |
| 121 */ | 131 */ |
| 122 isEqual: function(other) | 132 _isEqual: function(other) |
| 123 { | 133 { |
| 124 return other._type === WebInspector.LayerView.Selection.Type.ScrollRect
&& | 134 return other._type === WebInspector.LayerView.Selection.Type.ScrollRect
&& |
| 125 this.layer().id() === other.layer().id() && this.scrollRectIndex ===
other.scrollRectIndex; | 135 this.layer().id() === other.layer().id() && this.scrollRectIndex ===
other.scrollRectIndex; |
| 126 }, | 136 }, |
| 127 | 137 |
| 128 __proto__: WebInspector.LayerView.Selection.prototype | 138 __proto__: WebInspector.LayerView.Selection.prototype |
| 129 } | 139 } |
| 130 | 140 |
| 131 /** | 141 /** |
| 132 * @constructor | 142 * @constructor |
| 133 * @extends {WebInspector.LayerView.Selection} | 143 * @extends {WebInspector.LayerView.Selection} |
| 134 * @param {!WebInspector.Layer} layer | 144 * @param {!WebInspector.Layer} layer |
| 135 * @param {!WebInspector.TracingModel.Event} traceEvent | 145 * @param {!WebInspector.TracingModel.Event} traceEvent |
| 136 */ | 146 */ |
| 137 WebInspector.LayerView.TileSelection = function(layer, traceEvent) | 147 WebInspector.LayerView.TileSelection = function(layer, traceEvent) |
| 138 { | 148 { |
| 139 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Tile, layer); | 149 WebInspector.LayerView.Selection.call(this, WebInspector.LayerView.Selection
.Type.Tile, layer); |
| 140 this._traceEvent = traceEvent; | 150 this._traceEvent = traceEvent; |
| 141 } | 151 } |
| 142 | 152 |
| 143 WebInspector.LayerView.TileSelection.prototype = { | 153 WebInspector.LayerView.TileSelection.prototype = { |
| 144 /** | 154 /** |
| 145 * @override | 155 * @override |
| 146 * @param {!WebInspector.LayerView.Selection} other | 156 * @param {!WebInspector.LayerView.Selection} other |
| 147 * @return {boolean} | 157 * @return {boolean} |
| 148 */ | 158 */ |
| 149 isEqual: function(other) | 159 _isEqual: function(other) |
| 150 { | 160 { |
| 151 return other._type === WebInspector.LayerView.Selection.Type.Tile | 161 return other._type === WebInspector.LayerView.Selection.Type.Tile |
| 152 && this.layer().id() === other.layer().id() && this.traceEvent === o
ther.traceEvent; | 162 && this.layer().id() === other.layer().id() && this.traceEvent === o
ther.traceEvent; |
| 153 }, | 163 }, |
| 154 | 164 |
| 155 /** | 165 /** |
| 156 * @return {!WebInspector.TracingModel.Event} | 166 * @return {!WebInspector.TracingModel.Event} |
| 157 */ | 167 */ |
| 158 traceEvent: function() | 168 traceEvent: function() |
| 159 { | 169 { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 this.hoverObject(null); | 208 this.hoverObject(null); |
| 199 for (var view of this._views) | 209 for (var view of this._views) |
| 200 view.setLayerTree(layerTree); | 210 view.setLayerTree(layerTree); |
| 201 }, | 211 }, |
| 202 | 212 |
| 203 /** | 213 /** |
| 204 * @param {?WebInspector.LayerView.Selection} selection | 214 * @param {?WebInspector.LayerView.Selection} selection |
| 205 */ | 215 */ |
| 206 hoverObject: function(selection) | 216 hoverObject: function(selection) |
| 207 { | 217 { |
| 208 if (this._hoveredObject === selection) | 218 if (WebInspector.LayerView.Selection.isEqual(this._hoveredObject, select
ion)) |
| 209 return; | 219 return; |
| 210 this._hoveredObject = selection; | 220 this._hoveredObject = selection; |
| 211 var layer = selection && selection.layer(); | 221 var layer = selection && selection.layer(); |
| 212 this._toggleNodeHighlight(layer ? layer.nodeForSelfOrAncestor() : null); | 222 this._toggleNodeHighlight(layer ? layer.nodeForSelfOrAncestor() : null); |
| 213 for (var view of this._views) | 223 for (var view of this._views) |
| 214 view.hoverObject(selection); | 224 view.hoverObject(selection); |
| 215 }, | 225 }, |
| 216 | 226 |
| 217 /** | 227 /** |
| 218 * @param {?WebInspector.LayerView.Selection} selection | 228 * @param {?WebInspector.LayerView.Selection} selection |
| 219 */ | 229 */ |
| 220 selectObject: function(selection) | 230 selectObject: function(selection) |
| 221 { | 231 { |
| 222 if (this._selectedObject === selection) | 232 if (WebInspector.LayerView.Selection.isEqual(this._selectedObject, selec
tion)) |
| 223 return; | 233 return; |
| 224 this._selectedObject = selection; | 234 this._selectedObject = selection; |
| 225 for (var view of this._views) | 235 for (var view of this._views) |
| 226 view.selectObject(selection); | 236 view.selectObject(selection); |
| 227 }, | 237 }, |
| 228 | 238 |
| 229 /** | 239 /** |
| 230 * @return {?WebInspector.LayerView.Selection} | 240 * @return {?WebInspector.LayerView.Selection} |
| 231 */ | 241 */ |
| 232 selection: function() | 242 selection: function() |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 _toggleNodeHighlight: function(node) | 276 _toggleNodeHighlight: function(node) |
| 267 { | 277 { |
| 268 if (node) { | 278 if (node) { |
| 269 node.highlightForTwoSeconds(); | 279 node.highlightForTwoSeconds(); |
| 270 return; | 280 return; |
| 271 } | 281 } |
| 272 WebInspector.DOMModel.hideDOMNodeHighlight(); | 282 WebInspector.DOMModel.hideDOMNodeHighlight(); |
| 273 } | 283 } |
| 274 } | 284 } |
| 275 | 285 |
| OLD | NEW |