From bbe08d6b686456297ad4ab8c0923c3126e02e2b3 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 3 Oct 2018 09:59:06 +0200 Subject: QCss: properly parse functions which contains additional spaces When there were additional spaces between the function definition and the first parameter, the parser failed to parse it when it contained another function (e.g. 'qlineargradient(... rgb() ...)'). The reason for this was that ::until() needs the function at index-1 so it can correctly count the opening parenthesis. Fixes: QTBUG-61795 Change-Id: I992f556e7f8cd45550f83bc90aa8de2b4e905574 Reviewed-by: Richard Moe Gustavsen --- src/gui/text/qcssparser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 70623939e1..325fd26a31 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -2707,8 +2707,10 @@ bool Parser::parseFunction(QString *name, QString *args) { *name = lexem(); name->chop(1); + // until(RPAREN) needs FUNCTION token at index-1 to work properly + int start = index; skipSpace(); - const int start = index; + std::swap(start, index); if (!until(RPAREN)) return false; for (int i = start; i < index - 1; ++i) args->append(symbols.at(i).lexem()); -- cgit v1.2.3