From 111eaf464eafbc1130e405373067b70fed089622 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 10 Sep 2009 12:11:56 +0200 Subject: Fixed white-space handling in the SVG module. When parsing lists, only space characters were treated as white-space. Now, carrige returns, line feeds and tabs are also treated as white- space as described in the SVG Tiny 1.2 specification. Task-number: 260799 Reviewed-by: Tor Arne --- src/svg/qsvghandler.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 98fa26f..f287d5e 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -670,7 +670,7 @@ static QVector parseNumbersList(const QChar *&str) return points; points.reserve(32); - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; while (isDigit(str->unicode()) || *str == QLatin1Char('-') || *str == QLatin1Char('+') || @@ -678,13 +678,13 @@ static QVector parseNumbersList(const QChar *&str) points.append(toDouble(str)); - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; if (*str == QLatin1Char(',')) ++str; //eat the rest of space - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; } @@ -693,7 +693,7 @@ static QVector parseNumbersList(const QChar *&str) static inline void parseNumbersArray(const QChar *&str, QVarLengthArray &points) { - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; while (isDigit(str->unicode()) || *str == QLatin1Char('-') || *str == QLatin1Char('+') || @@ -701,13 +701,13 @@ static inline void parseNumbersArray(const QChar *&str, QVarLengthArrayisSpace()) ++str; if (*str == QLatin1Char(',')) ++str; //eat the rest of space - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; } } @@ -726,17 +726,17 @@ static QVector parsePercentageList(const QChar *&str) points.append(toDouble(str)); - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; if (*str == QLatin1Char('%')) ++str; - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; if (*str == QLatin1Char(',')) ++str; //eat the rest of space - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; } @@ -1518,7 +1518,7 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) const QChar *end = str + dataStr.size(); while (str != end) { - while (*str == QLatin1Char(' ')) + while (str->isSpace()) ++str; QChar pathElem = *str; ++str; @@ -3167,6 +3167,9 @@ static QSvgNode *createSvgNode(QSvgNode *parent, QStringList viewBoxValues; if (!viewBoxStr.isEmpty()) { viewBoxStr = viewBoxStr.replace(QLatin1Char(' '), QLatin1Char(',')); + viewBoxStr = viewBoxStr.replace(QLatin1Char('\r'), QLatin1Char(',')); + viewBoxStr = viewBoxStr.replace(QLatin1Char('\n'), QLatin1Char(',')); + viewBoxStr = viewBoxStr.replace(QLatin1Char('\t'), QLatin1Char(',')); viewBoxValues = viewBoxStr.split(QLatin1Char(','), QString::SkipEmptyParts); } if (viewBoxValues.count() == 4) { -- cgit v0.12