Bug 1391014 - take in account the ancestor's transformation too for the current matrix; r=gl draft
authorZER0 <zer0.kaos@gmail.com>
Fri, 08 Sep 2017 17:18:21 +0200
changeset 661499 9c2417b870017ae8e6e1b86cce36ee3cc7d97edd
parent 659873 c959327c6b75cd4930a6ea087583c38b805e7524
child 730595 fc124d8488fd8811c07a28f0d3d3c5800c60db2c
push id78786
push userbmo:zer0@mozilla.com
push dateFri, 08 Sep 2017 15:21:32 +0000
reviewersgl
bugs1391014
milestone57.0a1
Bug 1391014 - take in account the ancestor's transformation too for the current matrix; r=gl MozReview-Commit-ID: Dc4DU3wPzU8
devtools/shared/layout/dom-matrix-2d.js
--- a/devtools/shared/layout/dom-matrix-2d.js
+++ b/devtools/shared/layout/dom-matrix-2d.js
@@ -115,29 +115,30 @@ exports.apply = apply;
 const isIdentity = (M) =>
   M[0] === 1 && M[1] === 0 && M[2] === 0 &&
   M[3] === 0 && M[4] === 1 && M[5] === 0 &&
   M[6] === 0 && M[7] === 0 && M[8] === 1;
 exports.isIdentity = isIdentity;
 
 /**
  * Returns the transformation matrix for the given node, relative to the ancestor passed
- * as second argument.
+ * as second argument; considering the ancestor transformation too.
  * If no ancestor is specified, it will returns the transformation matrix relative to the
  * node's parent element.
  *
  * @param {DOMNode} node
  *        The node.
  * @param {DOMNode} ancestor
  *        The ancestor of the node given.
  ** @return {Array}
  *        The transformation matrix.
  */
 function getNodeTransformationMatrix(node, ancestor = node.parentElement) {
-  let { a, b, c, d, e, f } = node.getTransformToAncestor(ancestor);
+  let { a, b, c, d, e, f } = ancestor.getTransformToParent()
+                                     .multiply(node.getTransformToAncestor(ancestor));
 
   return [
     a, c, e,
     b, d, f,
     0, 0, 1
   ];
 }
 exports.getNodeTransformationMatrix = getNodeTransformationMatrix;