Bug 1391014 - take in account the ancestor's transformation too for the current matrix; r=gl
MozReview-Commit-ID: Dc4DU3wPzU8
--- 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;