| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 */ | 154 */ |
| 155 setLayers(payload, callback) { | 155 setLayers(payload, callback) { |
| 156 if (!payload) { | 156 if (!payload) { |
| 157 onBackendNodeIdsResolved.call(this); | 157 onBackendNodeIdsResolved.call(this); |
| 158 return; | 158 return; |
| 159 } | 159 } |
| 160 | 160 |
| 161 var idsToResolve = new Set(); | 161 var idsToResolve = new Set(); |
| 162 for (var i = 0; i < payload.length; ++i) { | 162 for (var i = 0; i < payload.length; ++i) { |
| 163 var backendNodeId = payload[i].backendNodeId; | 163 var backendNodeId = payload[i].backendNodeId; |
| 164 if (!backendNodeId || this._backendNodeIdToNode.has(backendNodeId)) | 164 if (!backendNodeId || this.backendNodeIdToNode().has(backendNodeId)) |
| 165 continue; | 165 continue; |
| 166 idsToResolve.add(backendNodeId); | 166 idsToResolve.add(backendNodeId); |
| 167 } | 167 } |
| 168 this._resolveBackendNodeIds(idsToResolve, onBackendNodeIdsResolved.bind(this
)); | 168 this.resolveBackendNodeIds(idsToResolve, onBackendNodeIdsResolved.bind(this)
); |
| 169 | 169 |
| 170 /** | 170 /** |
| 171 * @this {Layers.AgentLayerTree} | 171 * @this {Layers.AgentLayerTree} |
| 172 */ | 172 */ |
| 173 function onBackendNodeIdsResolved() { | 173 function onBackendNodeIdsResolved() { |
| 174 this._innerSetLayers(payload); | 174 this._innerSetLayers(payload); |
| 175 callback(); | 175 callback(); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 191 for (var i = 0; i < layers.length; ++i) { | 191 for (var i = 0; i < layers.length; ++i) { |
| 192 var layerId = layers[i].layerId; | 192 var layerId = layers[i].layerId; |
| 193 var layer = oldLayersById[layerId]; | 193 var layer = oldLayersById[layerId]; |
| 194 if (layer) | 194 if (layer) |
| 195 layer._reset(layers[i]); | 195 layer._reset(layers[i]); |
| 196 else | 196 else |
| 197 layer = new Layers.AgentLayer(this._target, layers[i]); | 197 layer = new Layers.AgentLayer(this._target, layers[i]); |
| 198 this._layersById[layerId] = layer; | 198 this._layersById[layerId] = layer; |
| 199 var backendNodeId = layers[i].backendNodeId; | 199 var backendNodeId = layers[i].backendNodeId; |
| 200 if (backendNodeId) | 200 if (backendNodeId) |
| 201 layer._setNode(this._backendNodeIdToNode.get(backendNodeId)); | 201 layer._setNode(this.backendNodeIdToNode().get(backendNodeId)); |
| 202 if (!this.contentRoot() && layer.drawsContent()) | 202 if (!this.contentRoot() && layer.drawsContent()) |
| 203 this.setContentRoot(layer); | 203 this.setContentRoot(layer); |
| 204 var parentId = layer.parentId(); | 204 var parentId = layer.parentId(); |
| 205 if (parentId) { | 205 if (parentId) { |
| 206 var parent = this._layersById[parentId]; | 206 var parent = this._layersById[parentId]; |
| 207 if (!parent) | 207 if (!parent) |
| 208 console.assert(parent, 'missing parent ' + parentId + ' for layer ' +
layerId); | 208 console.assert(parent, 'missing parent ' + parentId + ' for layer ' +
layerId); |
| 209 parent.addChild(layer); | 209 parent.addChild(layer); |
| 210 } else { | 210 } else { |
| 211 if (root) | 211 if (root) |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 560 |
| 561 /** | 561 /** |
| 562 * @override | 562 * @override |
| 563 * @param {!Protocol.LayerTree.LayerId} layerId | 563 * @param {!Protocol.LayerTree.LayerId} layerId |
| 564 * @param {!Protocol.DOM.Rect} clipRect | 564 * @param {!Protocol.DOM.Rect} clipRect |
| 565 */ | 565 */ |
| 566 layerPainted(layerId, clipRect) { | 566 layerPainted(layerId, clipRect) { |
| 567 this._layerTreeModel._layerPainted(layerId, clipRect); | 567 this._layerTreeModel._layerPainted(layerId, clipRect); |
| 568 } | 568 } |
| 569 }; | 569 }; |
| OLD | NEW |