diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-09-10 10:11:56 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-09-10 11:18:24 (GMT) |
commit | 111eaf464eafbc1130e405373067b70fed089622 (patch) | |
tree | 8299db4a2e561c5fa717bb0f66eb12bc4c69986c /src/svg | |
parent | 774d17db636dcef03a69cfa9cfb5f5a1127d10e9 (diff) | |
download | Qt-111eaf464eafbc1130e405373067b70fed089622.zip Qt-111eaf464eafbc1130e405373067b70fed089622.tar.gz Qt-111eaf464eafbc1130e405373067b70fed089622.tar.bz2 |
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
Diffstat (limited to 'src/svg')
-rw-r--r-- | src/svg/qsvghandler.cpp | 23 |
1 files 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<qreal> 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<qreal> 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<qreal> parseNumbersList(const QChar *&str) static inline void parseNumbersArray(const QChar *&str, QVarLengthArray<qreal, 8> &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, QVarLengthArray<qreal, 8 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; } } @@ -726,17 +726,17 @@ static QVector<qreal> 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) { |