mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1392722: Allow zero in rotateFromVector r=bzbarsky
Aligns to the spec. Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f7c12c831fb8a6ce0d5ec6b31fcf1f708464deaf Differential Revision: https://phabricator.services.mozilla.com/D36748 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c9de23aa09
commit
95687d2f8d
@ -848,11 +848,7 @@ DOMMatrix* DOMMatrix::Scale3dSelf(double aScale, double aOriginX,
|
||||
}
|
||||
|
||||
DOMMatrix* DOMMatrix::RotateFromVectorSelf(double aX, double aY) {
|
||||
if (aX == 0.0 || aY == 0.0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
const double angle = atan2(aY, aX);
|
||||
const double angle = (aX == 0.0 && aY == 0.0) ? 0 : atan2(aY, aX);
|
||||
|
||||
if (fmod(angle, 2 * M_PI) == 0) {
|
||||
return this;
|
||||
|
@ -99,8 +99,8 @@ interface DOMMatrixReadOnly {
|
||||
LegacyWindowAlias=WebKitCSSMatrix]
|
||||
interface DOMMatrix : DOMMatrixReadOnly {
|
||||
[NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {});
|
||||
[NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
|
||||
[NewObject, Throws] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64);
|
||||
[NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32);
|
||||
[NewObject, Throws] static DOMMatrix fromFloat64Array(Float64Array array64);
|
||||
|
||||
|
||||
// These attributes are simple aliases for certain elements of the 4x4 matrix
|
||||
|
@ -203,6 +203,24 @@
|
||||
checkDOMMatrix(result, expected);
|
||||
},"test rotateFromVector()");
|
||||
|
||||
test(function() {
|
||||
var result = initialDOMMatrix().rotateFromVector(0, 1);
|
||||
var expected = initialDOMMatrix().rotate(90);
|
||||
checkDOMMatrix(result, expected);
|
||||
},"test rotateFromVector() with x being zero");
|
||||
|
||||
test(function() {
|
||||
var result = initialDOMMatrix().rotateFromVector(1, 0);
|
||||
var expected = initialDOMMatrix()
|
||||
checkDOMMatrix(result, expected);
|
||||
},"test rotateFromVector() with y being zero");
|
||||
|
||||
test(function() {
|
||||
var result = initialDOMMatrix().rotateFromVector(0, 0);
|
||||
var expected = initialDOMMatrix()
|
||||
checkDOMMatrix(result, expected);
|
||||
},"test rotateFromVector() with two zeros");
|
||||
|
||||
test(function() {
|
||||
var result = initialDOMMatrix().rotateAxisAngle(3, 3, 3, 120);
|
||||
var expected = initialDOMMatrix().multiply(getRotationMatrix(3, 3, 3, 120));
|
||||
|
Loading…
Reference in New Issue
Block a user