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

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

Issue 2626143004: DevTools: move from Common module - Geometry and CSSShadowModel (Closed)
Patch Set: minimize test diff Created 3 years, 11 months 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 /** 489 /**
490 * @param {!CSSMatrix} parentTransform 490 * @param {!CSSMatrix} parentTransform
491 * @return {!CSSMatrix} 491 * @return {!CSSMatrix}
492 */ 492 */
493 _calculateTransformToViewport(parentTransform) { 493 _calculateTransformToViewport(parentTransform) {
494 var offsetMatrix = new WebKitCSSMatrix().translate(this._layerPayload.offset X, this._layerPayload.offsetY); 494 var offsetMatrix = new WebKitCSSMatrix().translate(this._layerPayload.offset X, this._layerPayload.offsetY);
495 var matrix = offsetMatrix; 495 var matrix = offsetMatrix;
496 496
497 if (this._layerPayload.transform) { 497 if (this._layerPayload.transform) {
498 var transformMatrix = this._matrixFromArray(this._layerPayload.transform); 498 var transformMatrix = this._matrixFromArray(this._layerPayload.transform);
499 var anchorVector = new Common.Geometry.Vector( 499 var anchorVector = new UI.Geometry.Vector(
500 this._layerPayload.width * this.anchorPoint()[0], this._layerPayload.h eight * this.anchorPoint()[1], 500 this._layerPayload.width * this.anchorPoint()[0], this._layerPayload.h eight * this.anchorPoint()[1],
501 this.anchorPoint()[2]); 501 this.anchorPoint()[2]);
502 var anchorPoint = Common.Geometry.multiplyVectorByMatrixAndNormalize(ancho rVector, matrix); 502 var anchorPoint = UI.Geometry.multiplyVectorByMatrixAndNormalize(anchorVec tor, matrix);
503 var anchorMatrix = new WebKitCSSMatrix().translate(-anchorPoint.x, -anchor Point.y, -anchorPoint.z); 503 var anchorMatrix = new WebKitCSSMatrix().translate(-anchorPoint.x, -anchor Point.y, -anchorPoint.z);
504 matrix = anchorMatrix.inverse().multiply(transformMatrix.multiply(anchorMa trix.multiply(matrix))); 504 matrix = anchorMatrix.inverse().multiply(transformMatrix.multiply(anchorMa trix.multiply(matrix)));
505 } 505 }
506 506
507 matrix = parentTransform.multiply(matrix); 507 matrix = parentTransform.multiply(matrix);
508 return matrix; 508 return matrix;
509 } 509 }
510 510
511 /** 511 /**
512 * @param {number} width 512 * @param {number} width
513 * @param {number} height 513 * @param {number} height
514 * @return {!Array.<number>} 514 * @return {!Array.<number>}
515 */ 515 */
516 _createVertexArrayForRect(width, height) { 516 _createVertexArrayForRect(width, height) {
517 return [0, 0, 0, width, 0, 0, width, height, 0, 0, height, 0]; 517 return [0, 0, 0, width, 0, 0, width, height, 0, 0, height, 0];
518 } 518 }
519 519
520 /** 520 /**
521 * @param {!CSSMatrix} parentTransform 521 * @param {!CSSMatrix} parentTransform
522 */ 522 */
523 _calculateQuad(parentTransform) { 523 _calculateQuad(parentTransform) {
524 var matrix = this._calculateTransformToViewport(parentTransform); 524 var matrix = this._calculateTransformToViewport(parentTransform);
525 this._quad = []; 525 this._quad = [];
526 var vertices = this._createVertexArrayForRect(this._layerPayload.width, this ._layerPayload.height); 526 var vertices = this._createVertexArrayForRect(this._layerPayload.width, this ._layerPayload.height);
527 for (var i = 0; i < 4; ++i) { 527 for (var i = 0; i < 4; ++i) {
528 var point = Common.Geometry.multiplyVectorByMatrixAndNormalize( 528 var point = UI.Geometry.multiplyVectorByMatrixAndNormalize(
529 new Common.Geometry.Vector(vertices[i * 3], vertices[i * 3 + 1], verti ces[i * 3 + 2]), matrix); 529 new UI.Geometry.Vector(vertices[i * 3], vertices[i * 3 + 1], vertices[ i * 3 + 2]), matrix);
530 this._quad.push(point.x, point.y); 530 this._quad.push(point.x, point.y);
531 } 531 }
532 532
533 function calculateQuadForLayer(layer) { 533 function calculateQuadForLayer(layer) {
534 layer._calculateQuad(matrix); 534 layer._calculateQuad(matrix);
535 } 535 }
536 536
537 this._children.forEach(calculateQuadForLayer); 537 this._children.forEach(calculateQuadForLayer);
538 } 538 }
539 }; 539 };
(...skipping 20 matching lines...) Expand all
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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698