summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvghandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/svg/qsvghandler.cpp')
-rw-r--r--src/svg/qsvghandler.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 5c0eda9..b2a2cb8 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -2788,19 +2788,16 @@ static QSvgNode *createSvgNode(QSvgNode *parent,
node->setHeight(int(height), type == QSvgHandler::LT_PERCENT);
}
+ QStringList viewBoxValues;
if (!viewBoxStr.isEmpty()) {
- QStringList lst = viewBoxStr.split(QLatin1Char(' '), QString::SkipEmptyParts);
- if (lst.count() != 4)
- lst = viewBoxStr.split(QLatin1Char(','), QString::SkipEmptyParts);
- int count = lst.count();
- while (count < 4) {
- lst.append(QLatin1String(""));
- count++;
- }
- QString xStr = lst.at(0).trimmed();
- QString yStr = lst.at(1).trimmed();
- QString widthStr = lst.at(2).trimmed();
- QString heightStr = lst.at(3).trimmed();
+ viewBoxStr = viewBoxStr.replace(QLatin1Char(' '), QLatin1Char(','));
+ viewBoxValues = viewBoxStr.split(QLatin1Char(','), QString::SkipEmptyParts);
+ }
+ if (viewBoxValues.count() == 4) {
+ QString xStr = viewBoxValues.at(0).trimmed();
+ QString yStr = viewBoxValues.at(1).trimmed();
+ QString widthStr = viewBoxValues.at(2).trimmed();
+ QString heightStr = viewBoxValues.at(3).trimmed();
QSvgHandler::LengthType lt;
qreal x = parseLength(xStr, lt, handler);