summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--src/svg/qsvghandler.cpp2
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp22
3 files changed, 24 insertions, 2 deletions
diff --git a/.qmake.conf b/.qmake.conf
index b9d358f..0f49ddb 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -3,4 +3,4 @@ load(qt_build_config)
CONFIG += warning_clean
DEFINES += QT_NO_FOREACH
-MODULE_VERSION = 5.12.1
+MODULE_VERSION = 5.12.2
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index e935649..0468bbe 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -3214,7 +3214,7 @@ static bool parseStyleNode(QSvgNode *parent,
Q_UNUSED(handler)
#else
const QStringRef type = attributes.value(QLatin1String("type"));
- if (type.compare(QLatin1String("text/css"), Qt::CaseInsensitive) == 0)
+ if (type.compare(QLatin1String("text/css"), Qt::CaseInsensitive) == 0 || type.isNull())
handler->setInStyle(true);
#endif
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index 5e13bee..553838e 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -76,6 +76,7 @@ private slots:
void testStopOffsetOpacity();
void testUseElement();
void smallFont();
+ void styleSheet();
#ifndef QT_NO_COMPRESS
void testGzLoading();
@@ -1437,5 +1438,26 @@ void tst_QSvgRenderer::smallFont()
QVERIFY(images[0] != images[1]);
}
+void tst_QSvgRenderer::styleSheet()
+{
+ static const char *svgs[] = { "<svg><style type=\"text/css\">.cls {fill:#ff0000;}</style><rect class=\"cls\" x = \"10\" y = \"10\" width = \"30\" height = \"30\"/></svg>",
+ "<svg><style>.cls {fill:#ff0000;}</style><rect class=\"cls\" x = \"10\" y = \"10\" width = \"30\" height = \"30\"/></svg>",
+ };
+ const int COUNT = sizeof(svgs) / sizeof(svgs[0]);
+ QImage images[COUNT];
+ QPainter p;
+
+ for (int i = 0; i < COUNT; ++i) {
+ QByteArray data(svgs[i]);
+ QSvgRenderer renderer(data);
+ images[i] = QImage(50, 50, QImage::Format_ARGB32_Premultiplied);
+ images[i].fill(-1);
+ p.begin(&images[i]);
+ renderer.render(&p);
+ p.end();
+ }
+ QCOMPARE(images[0], images[1]);
+}
+
QTEST_MAIN(tst_QSvgRenderer)
#include "tst_qsvgrenderer.moc"