Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/layers/LayerTreeModel.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 WebInspector.LayerTreeModel = class extends WebInspector.SDKModel { 34 Layers.LayerTreeModel = class extends SDK.SDKModel {
35 constructor(target) { 35 constructor(target) {
36 super(WebInspector.LayerTreeModel, target); 36 super(Layers.LayerTreeModel, target);
37 target.registerLayerTreeDispatcher(new WebInspector.LayerTreeDispatcher(this )); 37 target.registerLayerTreeDispatcher(new Layers.LayerTreeDispatcher(this));
38 WebInspector.targetManager.addEventListener( 38 SDK.targetManager.addEventListener(
39 WebInspector.TargetManager.Events.MainFrameNavigated, this._onMainFrameN avigated, this); 39 SDK.TargetManager.Events.MainFrameNavigated, this._onMainFrameNavigated, this);
40 /** @type {?WebInspector.LayerTreeBase} */ 40 /** @type {?SDK.LayerTreeBase} */
41 this._layerTree = null; 41 this._layerTree = null;
42 } 42 }
43 43
44 /** 44 /**
45 * @param {!WebInspector.Target} target 45 * @param {!SDK.Target} target
46 * @return {?WebInspector.LayerTreeModel} 46 * @return {?Layers.LayerTreeModel}
47 */ 47 */
48 static fromTarget(target) { 48 static fromTarget(target) {
49 if (!target.hasDOMCapability()) 49 if (!target.hasDOMCapability())
50 return null; 50 return null;
51 51
52 var model = /** @type {?WebInspector.LayerTreeModel} */ (target.model(WebIns pector.LayerTreeModel)); 52 var model = /** @type {?Layers.LayerTreeModel} */ (target.model(Layers.Layer TreeModel));
53 if (!model) 53 if (!model)
54 model = new WebInspector.LayerTreeModel(target); 54 model = new Layers.LayerTreeModel(target);
55 return model; 55 return model;
56 } 56 }
57 57
58 disable() { 58 disable() {
59 if (!this._enabled) 59 if (!this._enabled)
60 return; 60 return;
61 this._enabled = false; 61 this._enabled = false;
62 this.target().layerTreeAgent().disable(); 62 this.target().layerTreeAgent().disable();
63 } 63 }
64 64
65 enable() { 65 enable() {
66 if (this._enabled) 66 if (this._enabled)
67 return; 67 return;
68 this._enabled = true; 68 this._enabled = true;
69 this._forceEnable(); 69 this._forceEnable();
70 } 70 }
71 71
72 _forceEnable() { 72 _forceEnable() {
73 this._lastPaintRectByLayerId = {}; 73 this._lastPaintRectByLayerId = {};
74 if (!this._layerTree) 74 if (!this._layerTree)
75 this._layerTree = new WebInspector.AgentLayerTree(this.target()); 75 this._layerTree = new Layers.AgentLayerTree(this.target());
76 this.target().layerTreeAgent().enable(); 76 this.target().layerTreeAgent().enable();
77 } 77 }
78 78
79 /** 79 /**
80 * @return {?WebInspector.LayerTreeBase} 80 * @return {?SDK.LayerTreeBase}
81 */ 81 */
82 layerTree() { 82 layerTree() {
83 return this._layerTree; 83 return this._layerTree;
84 } 84 }
85 85
86 /** 86 /**
87 * @param {?Array.<!Protocol.LayerTree.Layer>} layers 87 * @param {?Array.<!Protocol.LayerTree.Layer>} layers
88 */ 88 */
89 _layerTreeChanged(layers) { 89 _layerTreeChanged(layers) {
90 if (!this._enabled) 90 if (!this._enabled)
91 return; 91 return;
92 var layerTree = /** @type {!WebInspector.AgentLayerTree} */ (this._layerTree ); 92 var layerTree = /** @type {!Layers.AgentLayerTree} */ (this._layerTree);
93 layerTree.setLayers(layers, onLayersSet.bind(this)); 93 layerTree.setLayers(layers, onLayersSet.bind(this));
94 94
95 /** 95 /**
96 * @this {WebInspector.LayerTreeModel} 96 * @this {Layers.LayerTreeModel}
97 */ 97 */
98 function onLayersSet() { 98 function onLayersSet() {
99 for (var layerId in this._lastPaintRectByLayerId) { 99 for (var layerId in this._lastPaintRectByLayerId) {
100 var lastPaintRect = this._lastPaintRectByLayerId[layerId]; 100 var lastPaintRect = this._lastPaintRectByLayerId[layerId];
101 var layer = layerTree.layerById(layerId); 101 var layer = layerTree.layerById(layerId);
102 if (layer) 102 if (layer)
103 layer._lastPaintRect = lastPaintRect; 103 layer._lastPaintRect = lastPaintRect;
104 } 104 }
105 this._lastPaintRectByLayerId = {}; 105 this._lastPaintRectByLayerId = {};
106 106
107 this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerTree Changed); 107 this.dispatchEventToListeners(Layers.LayerTreeModel.Events.LayerTreeChange d);
108 } 108 }
109 } 109 }
110 110
111 /** 111 /**
112 * @param {!Protocol.LayerTree.LayerId} layerId 112 * @param {!Protocol.LayerTree.LayerId} layerId
113 * @param {!Protocol.DOM.Rect} clipRect 113 * @param {!Protocol.DOM.Rect} clipRect
114 */ 114 */
115 _layerPainted(layerId, clipRect) { 115 _layerPainted(layerId, clipRect) {
116 if (!this._enabled) 116 if (!this._enabled)
117 return; 117 return;
118 var layerTree = /** @type {!WebInspector.AgentLayerTree} */ (this._layerTree ); 118 var layerTree = /** @type {!Layers.AgentLayerTree} */ (this._layerTree);
119 var layer = layerTree.layerById(layerId); 119 var layer = layerTree.layerById(layerId);
120 if (!layer) { 120 if (!layer) {
121 this._lastPaintRectByLayerId[layerId] = clipRect; 121 this._lastPaintRectByLayerId[layerId] = clipRect;
122 return; 122 return;
123 } 123 }
124 layer._didPaint(clipRect); 124 layer._didPaint(clipRect);
125 this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerPainte d, layer); 125 this.dispatchEventToListeners(Layers.LayerTreeModel.Events.LayerPainted, lay er);
126 } 126 }
127 127
128 _onMainFrameNavigated() { 128 _onMainFrameNavigated() {
129 this._layerTree = null; 129 this._layerTree = null;
130 if (this._enabled) 130 if (this._enabled)
131 this._forceEnable(); 131 this._forceEnable();
132 } 132 }
133 }; 133 };
134 134
135 /** @enum {symbol} */ 135 /** @enum {symbol} */
136 WebInspector.LayerTreeModel.Events = { 136 Layers.LayerTreeModel.Events = {
137 LayerTreeChanged: Symbol('LayerTreeChanged'), 137 LayerTreeChanged: Symbol('LayerTreeChanged'),
138 LayerPainted: Symbol('LayerPainted'), 138 LayerPainted: Symbol('LayerPainted'),
139 }; 139 };
140 140
141 /** 141 /**
142 * @unrestricted 142 * @unrestricted
143 */ 143 */
144 WebInspector.AgentLayerTree = class extends WebInspector.LayerTreeBase { 144 Layers.AgentLayerTree = class extends SDK.LayerTreeBase {
145 /** 145 /**
146 * @param {?WebInspector.Target} target 146 * @param {?SDK.Target} target
147 */ 147 */
148 constructor(target) { 148 constructor(target) {
149 super(target); 149 super(target);
150 } 150 }
151 151
152 /** 152 /**
153 * @param {?Array.<!Protocol.LayerTree.Layer>} payload 153 * @param {?Array.<!Protocol.LayerTree.Layer>} payload
154 * @param {function()} callback 154 * @param {function()} callback
155 */ 155 */
156 setLayers(payload, callback) { 156 setLayers(payload, callback) {
157 if (!payload) { 157 if (!payload) {
158 onBackendNodeIdsResolved.call(this); 158 onBackendNodeIdsResolved.call(this);
159 return; 159 return;
160 } 160 }
161 161
162 var idsToResolve = new Set(); 162 var idsToResolve = new Set();
163 for (var i = 0; i < payload.length; ++i) { 163 for (var i = 0; i < payload.length; ++i) {
164 var backendNodeId = payload[i].backendNodeId; 164 var backendNodeId = payload[i].backendNodeId;
165 if (!backendNodeId || this._backendNodeIdToNode.has(backendNodeId)) 165 if (!backendNodeId || this._backendNodeIdToNode.has(backendNodeId))
166 continue; 166 continue;
167 idsToResolve.add(backendNodeId); 167 idsToResolve.add(backendNodeId);
168 } 168 }
169 this._resolveBackendNodeIds(idsToResolve, onBackendNodeIdsResolved.bind(this )); 169 this._resolveBackendNodeIds(idsToResolve, onBackendNodeIdsResolved.bind(this ));
170 170
171 /** 171 /**
172 * @this {WebInspector.AgentLayerTree} 172 * @this {Layers.AgentLayerTree}
173 */ 173 */
174 function onBackendNodeIdsResolved() { 174 function onBackendNodeIdsResolved() {
175 this._innerSetLayers(payload); 175 this._innerSetLayers(payload);
176 callback(); 176 callback();
177 } 177 }
178 } 178 }
179 179
180 /** 180 /**
181 * @param {?Array.<!Protocol.LayerTree.Layer>} layers 181 * @param {?Array.<!Protocol.LayerTree.Layer>} layers
182 */ 182 */
183 _innerSetLayers(layers) { 183 _innerSetLayers(layers) {
184 this.setRoot(null); 184 this.setRoot(null);
185 this.setContentRoot(null); 185 this.setContentRoot(null);
186 // Payload will be null when not in the composited mode. 186 // Payload will be null when not in the composited mode.
187 if (!layers) 187 if (!layers)
188 return; 188 return;
189 var root; 189 var root;
190 var oldLayersById = this._layersById; 190 var oldLayersById = this._layersById;
191 this._layersById = {}; 191 this._layersById = {};
192 for (var i = 0; i < layers.length; ++i) { 192 for (var i = 0; i < layers.length; ++i) {
193 var layerId = layers[i].layerId; 193 var layerId = layers[i].layerId;
194 var layer = oldLayersById[layerId]; 194 var layer = oldLayersById[layerId];
195 if (layer) 195 if (layer)
196 layer._reset(layers[i]); 196 layer._reset(layers[i]);
197 else 197 else
198 layer = new WebInspector.AgentLayer(this._target, layers[i]); 198 layer = new Layers.AgentLayer(this._target, layers[i]);
199 this._layersById[layerId] = layer; 199 this._layersById[layerId] = layer;
200 var backendNodeId = layers[i].backendNodeId; 200 var backendNodeId = layers[i].backendNodeId;
201 if (backendNodeId) 201 if (backendNodeId)
202 layer._setNode(this._backendNodeIdToNode.get(backendNodeId)); 202 layer._setNode(this._backendNodeIdToNode.get(backendNodeId));
203 if (!this.contentRoot() && layer.drawsContent()) 203 if (!this.contentRoot() && layer.drawsContent())
204 this.setContentRoot(layer); 204 this.setContentRoot(layer);
205 var parentId = layer.parentId(); 205 var parentId = layer.parentId();
206 if (parentId) { 206 if (parentId) {
207 var parent = this._layersById[parentId]; 207 var parent = this._layersById[parentId];
208 if (!parent) 208 if (!parent)
209 console.assert(parent, 'missing parent ' + parentId + ' for layer ' + layerId); 209 console.assert(parent, 'missing parent ' + parentId + ' for layer ' + layerId);
210 parent.addChild(layer); 210 parent.addChild(layer);
211 } else { 211 } else {
212 if (root) 212 if (root)
213 console.assert(false, 'Multiple root layers'); 213 console.assert(false, 'Multiple root layers');
214 root = layer; 214 root = layer;
215 } 215 }
216 } 216 }
217 if (root) { 217 if (root) {
218 this.setRoot(root); 218 this.setRoot(root);
219 root._calculateQuad(new WebKitCSSMatrix()); 219 root._calculateQuad(new WebKitCSSMatrix());
220 } 220 }
221 } 221 }
222 }; 222 };
223 223
224 /** 224 /**
225 * @implements {WebInspector.Layer} 225 * @implements {SDK.Layer}
226 * @unrestricted 226 * @unrestricted
227 */ 227 */
228 WebInspector.AgentLayer = class { 228 Layers.AgentLayer = class {
229 /** 229 /**
230 * @param {?WebInspector.Target} target 230 * @param {?SDK.Target} target
231 * @param {!Protocol.LayerTree.Layer} layerPayload 231 * @param {!Protocol.LayerTree.Layer} layerPayload
232 */ 232 */
233 constructor(target, layerPayload) { 233 constructor(target, layerPayload) {
234 this._target = target; 234 this._target = target;
235 this._reset(layerPayload); 235 this._reset(layerPayload);
236 } 236 }
237 237
238 /** 238 /**
239 * @override 239 * @override
240 * @return {string} 240 * @return {string}
241 */ 241 */
242 id() { 242 id() {
243 return this._layerPayload.layerId; 243 return this._layerPayload.layerId;
244 } 244 }
245 245
246 /** 246 /**
247 * @override 247 * @override
248 * @return {?string} 248 * @return {?string}
249 */ 249 */
250 parentId() { 250 parentId() {
251 return this._layerPayload.parentLayerId; 251 return this._layerPayload.parentLayerId;
252 } 252 }
253 253
254 /** 254 /**
255 * @override 255 * @override
256 * @return {?WebInspector.Layer} 256 * @return {?SDK.Layer}
257 */ 257 */
258 parent() { 258 parent() {
259 return this._parent; 259 return this._parent;
260 } 260 }
261 261
262 /** 262 /**
263 * @override 263 * @override
264 * @return {boolean} 264 * @return {boolean}
265 */ 265 */
266 isRoot() { 266 isRoot() {
267 return !this.parentId(); 267 return !this.parentId();
268 } 268 }
269 269
270 /** 270 /**
271 * @override 271 * @override
272 * @return {!Array.<!WebInspector.Layer>} 272 * @return {!Array.<!SDK.Layer>}
273 */ 273 */
274 children() { 274 children() {
275 return this._children; 275 return this._children;
276 } 276 }
277 277
278 /** 278 /**
279 * @override 279 * @override
280 * @param {!WebInspector.Layer} child 280 * @param {!SDK.Layer} child
281 */ 281 */
282 addChild(child) { 282 addChild(child) {
283 if (child._parent) 283 if (child._parent)
284 console.assert(false, 'Child already has a parent'); 284 console.assert(false, 'Child already has a parent');
285 this._children.push(child); 285 this._children.push(child);
286 child._parent = this; 286 child._parent = this;
287 } 287 }
288 288
289 /** 289 /**
290 * @param {?WebInspector.DOMNode} node 290 * @param {?SDK.DOMNode} node
291 */ 291 */
292 _setNode(node) { 292 _setNode(node) {
293 this._node = node; 293 this._node = node;
294 } 294 }
295 295
296 /** 296 /**
297 * @override 297 * @override
298 * @return {?WebInspector.DOMNode} 298 * @return {?SDK.DOMNode}
299 */ 299 */
300 node() { 300 node() {
301 return this._node; 301 return this._node;
302 } 302 }
303 303
304 /** 304 /**
305 * @override 305 * @override
306 * @return {?WebInspector.DOMNode} 306 * @return {?SDK.DOMNode}
307 */ 307 */
308 nodeForSelfOrAncestor() { 308 nodeForSelfOrAncestor() {
309 for (var layer = this; layer; layer = layer._parent) { 309 for (var layer = this; layer; layer = layer._parent) {
310 if (layer._node) 310 if (layer._node)
311 return layer._node; 311 return layer._node;
312 } 312 }
313 return null; 313 return null;
314 } 314 }
315 315
316 /** 316 /**
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 gpuMemoryUsage() { 435 gpuMemoryUsage() {
436 /** 436 /**
437 * @const 437 * @const
438 */ 438 */
439 var bytesPerPixel = 4; 439 var bytesPerPixel = 4;
440 return this.drawsContent() ? this.width() * this.height() * bytesPerPixel : 0; 440 return this.drawsContent() ? this.width() * this.height() * bytesPerPixel : 0;
441 } 441 }
442 442
443 /** 443 /**
444 * @override 444 * @override
445 * @return {!Array<!Promise<?WebInspector.SnapshotWithRect>>} 445 * @return {!Array<!Promise<?SDK.SnapshotWithRect>>}
446 */ 446 */
447 snapshots() { 447 snapshots() {
448 var rect = {x: 0, y: 0, width: this.width(), height: this.height()}; 448 var rect = {x: 0, y: 0, width: this.width(), height: this.height()};
449 var promise = this._target.layerTreeAgent().makeSnapshot( 449 var promise = this._target.layerTreeAgent().makeSnapshot(
450 this.id(), (error, snapshotId) => error || !this._target ? 450 this.id(), (error, snapshotId) => error || !this._target ?
451 null : 451 null :
452 {rect: rect, snapshot: new WebInspector.PaintProfilerSnapshot(this._ target, snapshotId)}); 452 {rect: rect, snapshot: new SDK.PaintProfilerSnapshot(this._target, s napshotId)});
453 return [promise]; 453 return [promise];
454 } 454 }
455 455
456 /** 456 /**
457 * @param {!Protocol.DOM.Rect} rect 457 * @param {!Protocol.DOM.Rect} rect
458 */ 458 */
459 _didPaint(rect) { 459 _didPaint(rect) {
460 this._lastPaintRect = rect; 460 this._lastPaintRect = rect;
461 this._paintCount = this.paintCount() + 1; 461 this._paintCount = this.paintCount() + 1;
462 this._image = null; 462 this._image = null;
463 } 463 }
464 464
465 /** 465 /**
466 * @param {!Protocol.LayerTree.Layer} layerPayload 466 * @param {!Protocol.LayerTree.Layer} layerPayload
467 */ 467 */
468 _reset(layerPayload) { 468 _reset(layerPayload) {
469 /** @type {?WebInspector.DOMNode} */ 469 /** @type {?SDK.DOMNode} */
470 this._node = null; 470 this._node = null;
471 this._children = []; 471 this._children = [];
472 this._parent = null; 472 this._parent = null;
473 this._paintCount = 0; 473 this._paintCount = 0;
474 this._layerPayload = layerPayload; 474 this._layerPayload = layerPayload;
475 this._image = null; 475 this._image = null;
476 this._scrollRects = this._layerPayload.scrollRects || []; 476 this._scrollRects = this._layerPayload.scrollRects || [];
477 } 477 }
478 478
479 /** 479 /**
(...skipping 10 matching lines...) Expand all
490 /** 490 /**
491 * @param {!CSSMatrix} parentTransform 491 * @param {!CSSMatrix} parentTransform
492 * @return {!CSSMatrix} 492 * @return {!CSSMatrix}
493 */ 493 */
494 _calculateTransformToViewport(parentTransform) { 494 _calculateTransformToViewport(parentTransform) {
495 var offsetMatrix = new WebKitCSSMatrix().translate(this._layerPayload.offset X, this._layerPayload.offsetY); 495 var offsetMatrix = new WebKitCSSMatrix().translate(this._layerPayload.offset X, this._layerPayload.offsetY);
496 var matrix = offsetMatrix; 496 var matrix = offsetMatrix;
497 497
498 if (this._layerPayload.transform) { 498 if (this._layerPayload.transform) {
499 var transformMatrix = this._matrixFromArray(this._layerPayload.transform); 499 var transformMatrix = this._matrixFromArray(this._layerPayload.transform);
500 var anchorVector = new WebInspector.Geometry.Vector( 500 var anchorVector = new Common.Geometry.Vector(
501 this._layerPayload.width * this.anchorPoint()[0], this._layerPayload.h eight * this.anchorPoint()[1], 501 this._layerPayload.width * this.anchorPoint()[0], this._layerPayload.h eight * this.anchorPoint()[1],
502 this.anchorPoint()[2]); 502 this.anchorPoint()[2]);
503 var anchorPoint = WebInspector.Geometry.multiplyVectorByMatrixAndNormalize (anchorVector, matrix); 503 var anchorPoint = Common.Geometry.multiplyVectorByMatrixAndNormalize(ancho rVector, matrix);
504 var anchorMatrix = new WebKitCSSMatrix().translate(-anchorPoint.x, -anchor Point.y, -anchorPoint.z); 504 var anchorMatrix = new WebKitCSSMatrix().translate(-anchorPoint.x, -anchor Point.y, -anchorPoint.z);
505 matrix = anchorMatrix.inverse().multiply(transformMatrix.multiply(anchorMa trix.multiply(matrix))); 505 matrix = anchorMatrix.inverse().multiply(transformMatrix.multiply(anchorMa trix.multiply(matrix)));
506 } 506 }
507 507
508 matrix = parentTransform.multiply(matrix); 508 matrix = parentTransform.multiply(matrix);
509 return matrix; 509 return matrix;
510 } 510 }
511 511
512 /** 512 /**
513 * @param {number} width 513 * @param {number} width
514 * @param {number} height 514 * @param {number} height
515 * @return {!Array.<number>} 515 * @return {!Array.<number>}
516 */ 516 */
517 _createVertexArrayForRect(width, height) { 517 _createVertexArrayForRect(width, height) {
518 return [0, 0, 0, width, 0, 0, width, height, 0, 0, height, 0]; 518 return [0, 0, 0, width, 0, 0, width, height, 0, 0, height, 0];
519 } 519 }
520 520
521 /** 521 /**
522 * @param {!CSSMatrix} parentTransform 522 * @param {!CSSMatrix} parentTransform
523 */ 523 */
524 _calculateQuad(parentTransform) { 524 _calculateQuad(parentTransform) {
525 var matrix = this._calculateTransformToViewport(parentTransform); 525 var matrix = this._calculateTransformToViewport(parentTransform);
526 this._quad = []; 526 this._quad = [];
527 var vertices = this._createVertexArrayForRect(this._layerPayload.width, this ._layerPayload.height); 527 var vertices = this._createVertexArrayForRect(this._layerPayload.width, this ._layerPayload.height);
528 for (var i = 0; i < 4; ++i) { 528 for (var i = 0; i < 4; ++i) {
529 var point = WebInspector.Geometry.multiplyVectorByMatrixAndNormalize( 529 var point = Common.Geometry.multiplyVectorByMatrixAndNormalize(
530 new WebInspector.Geometry.Vector(vertices[i * 3], vertices[i * 3 + 1], vertices[i * 3 + 2]), matrix); 530 new Common.Geometry.Vector(vertices[i * 3], vertices[i * 3 + 1], verti ces[i * 3 + 2]), matrix);
531 this._quad.push(point.x, point.y); 531 this._quad.push(point.x, point.y);
532 } 532 }
533 533
534 function calculateQuadForLayer(layer) { 534 function calculateQuadForLayer(layer) {
535 layer._calculateQuad(matrix); 535 layer._calculateQuad(matrix);
536 } 536 }
537 537
538 this._children.forEach(calculateQuadForLayer); 538 this._children.forEach(calculateQuadForLayer);
539 } 539 }
540 }; 540 };
541 541
542 /** 542 /**
543 * @implements {Protocol.LayerTreeDispatcher} 543 * @implements {Protocol.LayerTreeDispatcher}
544 * @unrestricted 544 * @unrestricted
545 */ 545 */
546 WebInspector.LayerTreeDispatcher = class { 546 Layers.LayerTreeDispatcher = class {
547 /** 547 /**
548 * @param {!WebInspector.LayerTreeModel} layerTreeModel 548 * @param {!Layers.LayerTreeModel} layerTreeModel
549 */ 549 */
550 constructor(layerTreeModel) { 550 constructor(layerTreeModel) {
551 this._layerTreeModel = layerTreeModel; 551 this._layerTreeModel = layerTreeModel;
552 } 552 }
553 553
554 /** 554 /**
555 * @override 555 * @override
556 * @param {!Array.<!Protocol.LayerTree.Layer>=} layers 556 * @param {!Array.<!Protocol.LayerTree.Layer>=} layers
557 */ 557 */
558 layerTreeDidChange(layers) { 558 layerTreeDidChange(layers) {
559 this._layerTreeModel._layerTreeChanged(layers || null); 559 this._layerTreeModel._layerTreeChanged(layers || null);
560 } 560 }
561 561
562 /** 562 /**
563 * @override 563 * @override
564 * @param {!Protocol.LayerTree.LayerId} layerId 564 * @param {!Protocol.LayerTree.LayerId} layerId
565 * @param {!Protocol.DOM.Rect} clipRect 565 * @param {!Protocol.DOM.Rect} clipRect
566 */ 566 */
567 layerPainted(layerId, clipRect) { 567 layerPainted(layerId, clipRect) {
568 this._layerTreeModel._layerPainted(layerId, clipRect); 568 this._layerTreeModel._layerPainted(layerId, clipRect);
569 } 569 }
570 }; 570 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698