summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2017-02-14 12:34:52 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2017-02-14 13:56:56 +0000
commit7cc50e972b7fa546f7cedff2ef19db20af9e36ab (patch)
tree60afaab4d57253f9db153f7625eec896e6c6d0a3
parent914e25bf01e6264dd80b6f27e50b45a578a7fe89 (diff)
downloadqtsvg-7cc50e972b7fa546f7cedff2ef19db20af9e36ab.tar.gz
Fix radial gradient brushes in svg generator
The code would generate radial gradiants named with an "xml:id" attribute, in contrast to linear gradients which is named by an "id" attribute. Those two forms should be equivalent according to the spec, but in practice most browsers and viewers only accept the latter. Change-Id: I798387bdbd3a6ea831af8ce103683141b567e940 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/svg/qsvggenerator.cpp2
-rw-r--r--tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp
index de6e8d4..3f4e545 100644
--- a/src/svg/qsvggenerator.cpp
+++ b/src/svg/qsvggenerator.cpp
@@ -282,7 +282,7 @@ public:
<< QLatin1String("fx=\"") <<grad->focalPoint().x() << QLatin1String("\" ")
<< QLatin1String("fy=\"") <<grad->focalPoint().y() << QLatin1String("\" ");
}
- str << QLatin1String("xml:id=\"") <<d_func()->generateGradientName()<< QLatin1String("\">\n");
+ str << QLatin1String("id=\"") <<d_func()->generateGradientName()<< QLatin1String("\">\n");
saveGradientStops(str, g);
str << QLatin1String("</radialGradient>") << endl;
}
diff --git a/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg b/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg
index a56674c..13fc6f1 100644
--- a/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg
+++ b/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg
@@ -4,11 +4,11 @@
<title>Qt SVG Document</title>
<desc>Generated with Qt</desc>
<defs>
-<radialGradient gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.5" fy="0.5" xml:id="gradient1">
+<radialGradient gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.5" fy="0.5" id="gradient1">
<stop offset="0" stop-color="#ff0000" stop-opacity="1" />
<stop offset="1" stop-color="#0000ff" stop-opacity="1" />
</radialGradient>
-<radialGradient gradientUnits="userSpaceOnUse" cx="150" cy="50" r="50" fx="150" fy="50" xml:id="gradient2">
+<radialGradient gradientUnits="userSpaceOnUse" cx="150" cy="50" r="50" fx="150" fy="50" id="gradient2">
<stop offset="0" stop-color="#ff0000" stop-opacity="1" />
<stop offset="1" stop-color="#0000ff" stop-opacity="1" />
</radialGradient>