mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1099148
- Implement Canvas2D resetTransform method. r=gw280,bz
This commit is contained in:
parent
74e49d7ff3
commit
a0b87c69e4
@ -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<JSObject*> result, ErrorResult& error)
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -19182,6 +19182,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- [[[ test_2d.transformation.transform.multiply.html ]]] -->
|
||||
@ -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() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: 2d.transformation.transform.identity</p>
|
||||
<!-- Testing: resetTransform() changes to the identity matrix -->
|
||||
<canvas id="c689" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
|
||||
function test_2d_transformation_reset_transform() {
|
||||
|
||||
var canvas = document.getElementById('c689');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.setTransform(0.1, 0.0, 0.0, 0.1, 80.0, 30.0);
|
||||
ctx.resetTransform();
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function asyncTestsDone() {
|
||||
@ -24844,6 +24873,11 @@ try {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_opaque");
|
||||
}
|
||||
try {
|
||||
test_2d_transformation_reset_transform();
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_transformation_reset_transform");
|
||||
}
|
||||
try {
|
||||
// run this test last since it replaces the getContext method
|
||||
test_type_replace();
|
||||
|
@ -47,7 +47,8 @@ interface CanvasRenderingContext2D {
|
||||
void transform(double a, double b, double c, double d, double e, double f);
|
||||
[Throws, LenientFloat]
|
||||
void setTransform(double a, double b, double c, double d, double e, double f);
|
||||
// NOT IMPLEMENTED void resetTransform();
|
||||
[Throws]
|
||||
void resetTransform();
|
||||
|
||||
// compositing
|
||||
attribute unrestricted double globalAlpha; // (default 1.0)
|
||||
|
@ -2214,9 +2214,6 @@
|
||||
[CanvasRenderingContext2D interface: attribute currentTransform]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: operation resetTransform()]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: attribute imageSmoothingEnabled]
|
||||
expected: FAIL
|
||||
|
||||
@ -2295,9 +2292,6 @@
|
||||
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "currentTransform" with the proper type (6)]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "resetTransform" with the proper type (12)]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "imageSmoothingEnabled" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user