Chromium Code Reviews| Index: Source/devtools/front_end/LayerTreeModel.js |
| diff --git a/Source/devtools/front_end/LayerTreeModel.js b/Source/devtools/front_end/LayerTreeModel.js |
| index 2753e10a1493172ccae296afcab68f86c5819a4f..2fddb2e2485cd77e38c50948522303bb435ff329 100644 |
| --- a/Source/devtools/front_end/LayerTreeModel.js |
| +++ b/Source/devtools/front_end/LayerTreeModel.js |
| @@ -97,7 +97,7 @@ WebInspector.LayerTreeModel.prototype = { |
| /** |
| * @param {function(!WebInspector.Layer)} callback |
| - * @param {?WebInspector.Layer} root |
| + * @param {?WebInspector.Layer=} root |
| * @return {boolean} |
| */ |
| forEachLayer: function(callback, root) |
| @@ -120,19 +120,19 @@ WebInspector.LayerTreeModel.prototype = { |
| }, |
| /** |
| - * @param {!Array.<!LayerTreeAgent.Layer>} payload |
| + * @param {!Array.<!LayerTreeAgent.Layer>} layers |
| */ |
| - _repopulate: function(payload) |
| + _repopulate: function(layers) |
| { |
| var oldLayersById = this._layersById; |
| this._layersById = {}; |
| - for (var i = 0; i < payload.length; ++i) { |
| - var layerId = payload[i].layerId; |
| + for (var i = 0; i < layers.length; ++i) { |
| + var layerId = layers[i].layerId; |
| var layer = oldLayersById[layerId]; |
| if (layer) |
| - layer._reset(payload[i]); |
| + layer._reset(layers[i]); |
| else |
| - layer = new WebInspector.Layer(payload[i]); |
| + layer = new WebInspector.Layer(layers[i]); |
| this._layersById[layerId] = layer; |
| var parentId = layer.parentId(); |
| if (!this._contentRoot && layer.nodeId()) |
| @@ -155,15 +155,15 @@ WebInspector.LayerTreeModel.prototype = { |
| }, |
| /** |
| - * @param {!Array.<!LayerTreeAgent.Layer>=} payload |
| + * @param {!Array.<!LayerTreeAgent.Layer>=} layers |
| */ |
| - _layerTreeChanged: function(payload) |
| + _layerTreeChanged: function(layers) |
| { |
| this._root = null; |
| this._contentRoot = null; |
| // Payload will be null when not in the composited mode. |
| - if (payload) |
| - this._repopulate(payload); |
| + if (layers) |
| + this._repopulate(layers); |
| this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerTreeChanged); |
| }, |
| @@ -197,6 +197,7 @@ WebInspector.LayerTreeModel.prototype = { |
| */ |
| WebInspector.Layer = function(layerPayload) |
| { |
| + this._scrollRects = []; |
| this._reset(layerPayload); |
| } |
| @@ -350,6 +351,14 @@ WebInspector.Layer.prototype = { |
| }, |
| /** |
| + * @return {!Array.<!LayerTreeAgent.ScrollRect>} |
| + */ |
| + scrollRects: function() |
| + { |
| + return this._scrollRects; |
| + }, |
| + |
| + /** |
| * @param {function(!Array.<string>)} callback |
| */ |
| requestCompositingReasons: function(callback) |
| @@ -387,6 +396,12 @@ WebInspector.Layer.prototype = { |
| this._paintCount = 0; |
| this._layerPayload = layerPayload; |
| this._image = null; |
| + this._updateScrollRects(); |
| + }, |
| + |
| + _updateScrollRects: function() |
| + { |
| + this._scrollRects = this._layerPayload.scrollRects || []; |
|
caseq
2014/03/11 13:40:32
Looks like this is not worth extracting.
malch
2014/03/11 13:48:56
Done.
|
| } |
| } |
| @@ -402,11 +417,11 @@ WebInspector.LayerTreeDispatcher = function(layerTreeModel) |
| WebInspector.LayerTreeDispatcher.prototype = { |
| /** |
| - * @param {!Array.<!LayerTreeAgent.Layer>=} payload |
| + * @param {!Array.<!LayerTreeAgent.Layer>=} layers |
| */ |
| - layerTreeDidChange: function(payload) |
| + layerTreeDidChange: function(layers) |
| { |
| - this._layerTreeModel._layerTreeChanged(payload); |
| + this._layerTreeModel._layerTreeChanged(layers); |
| }, |
| /** |