diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index d2872b28e328..3f0b2113ab75 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -1735,6 +1735,12 @@ CanvasRenderingContext2D::SetTransform(double m11, double m12, mTarget->SetTransform(matrix); } +void +CanvasRenderingContext2D::ResetTransform(ErrorResult& error) +{ + SetTransform(1.0, 0.0, 0.0, 1.0, 0.0, 0.0, error); +} + static void MatrixToJSObject(JSContext* cx, const Matrix& matrix, JS::MutableHandle result, ErrorResult& error) diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h index d4358a404074..8593502248dd 100644 --- a/dom/canvas/CanvasRenderingContext2D.h +++ b/dom/canvas/CanvasRenderingContext2D.h @@ -148,6 +148,7 @@ public: double dy, mozilla::ErrorResult& error); void SetTransform(double m11, double m12, double m21, double m22, double dx, double dy, mozilla::ErrorResult& error); + void ResetTransform(mozilla::ErrorResult& error); double GlobalAlpha() { diff --git a/dom/canvas/test/test_canvas.html b/dom/canvas/test/test_canvas.html index 6a241fcf756e..48f26e22a1a7 100644 --- a/dom/canvas/test/test_canvas.html +++ b/dom/canvas/test/test_canvas.html @@ -19182,6 +19182,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0); } + @@ -19558,6 +19559,9 @@ if (ctx.transform) { // (avoid spurious failures, since the aim here is not to t if (ctx.setTransform) { ok(ctx.setTransform(1, 0, 0, 1, 0, 0) === undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0) === undefined"); } +if (ctx.resetTransform) { + ok(ctx.resetTransform() === undefined, "ctx.resetTransform() === undefined"); +} ok(ctx.clearRect(0, 0, 0, 0) === undefined, "ctx.clearRect(0, 0, 0, 0) === undefined"); ok(ctx.fillRect(0, 0, 0, 0) === undefined, "ctx.fillRect(0, 0, 0, 0) === undefined"); ok(ctx.strokeRect(0, 0, 0, 0) === undefined, "ctx.strokeRect(0, 0, 0, 0) === undefined"); @@ -21552,6 +21556,31 @@ function test_opaque() { } +

Canvas test: 2d.transformation.transform.identity

+ +

FAIL (fallback content)

+ +