From 8934f3b78387cb2693a0e4cf7ef3a20b4f268525 Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Sun, 18 Mar 2012 18:24:35 +0000 Subject: [PATCH] Bug 736791 - translate transforms are not serialised correctly. r=jwatt --- content/svg/content/src/SVGTransform.cpp | 3 ++- content/svg/content/test/test_transform.xhtml | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/content/svg/content/src/SVGTransform.cpp b/content/svg/content/src/SVGTransform.cpp index 90292046f42d..c597841860fe 100644 --- a/content/svg/content/src/SVGTransform.cpp +++ b/content/svg/content/src/SVGTransform.cpp @@ -53,7 +53,8 @@ SVGTransform::GetValueAsString(nsAString& aValue) const switch (mType) { case nsIDOMSVGTransform::SVG_TRANSFORM_TRANSLATE: - if (mMatrix.x0 != mMatrix.y0) + // The spec say that if Y is not provided, it is assumed to be zero. + if (mMatrix.y0 != 0) nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), NS_LITERAL_STRING("translate(%g, %g)").get(), mMatrix.x0, mMatrix.y0); diff --git a/content/svg/content/test/test_transform.xhtml b/content/svg/content/test/test_transform.xhtml index 819ebe0f5c33..c0ce473f5828 100644 --- a/content/svg/content/test/test_transform.xhtml +++ b/content/svg/content/test/test_transform.xhtml @@ -80,6 +80,16 @@ function run() 0, 1, 0, 10, 0, "matrix"); + + // If ty is not supplied it is assumed to be zero + g.setAttribute("transform", "translate(5)"); + + // test that the SVGTransform now reflects the matrix value + checkTransform(t, SVGTransform.SVG_TRANSFORM_TRANSLATE, + 1, 0, + 0, 1, + 5, 0, + 0, "transform"); // set the SVGTransform to be a rotate() t.setRotate(90, 0, 0);