Bug 736791 - translate transforms are not serialised correctly. r=jwatt

This commit is contained in:
Robert Longson 2012-03-18 18:24:35 +00:00
parent 218dc8bcda
commit 8934f3b783
2 changed files with 12 additions and 1 deletions

View File

@ -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);

View File

@ -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);