diff options
author | Martin T. H. Sandsmark <martin.sandsmark@remarkable.no> | 2016-10-15 14:14:00 +0200 |
---|---|---|
committer | Martin Sandsmark <martin.sandsmark@kde.org> | 2016-11-15 17:17:08 +0000 |
commit | 1753d696070895f309c46ba5aee662b0f3a18bde (patch) | |
tree | 5d9ee037b13144aeec6761787f6223cb25e52a2d /src/gui/text | |
parent | 083d8caee10892d2f3d9597609315231b6f8493a (diff) |
QCss: Fix parsing of charset
When including a CSS file in a HTML file sent to QTextDocument, and the
CSS file starts with «@charset "UTF-8";», which is the correct way of
declaring that, the parsing fails.
If you omit the space, like «@charset"UTF-8";» the parsing succeeds,
which is wrong.
Fix this by expecting and swallowing whitespace after the @charset
tokens.
Task-number: QTBUG-54829
Change-Id: I32044e8d24bda70c1eb06bf74af50d4cabe2211d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qcssparser.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index e96aecdf68..3d6acccdb8 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -2175,6 +2175,7 @@ void Parser::init(const QString &css, bool isFile) bool Parser::parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity) { if (testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("charset"))) { + while (test(S) || test(CDO) || test(CDC)) {} if (!next(STRING)) return false; if (!next(SEMICOLON)) return false; } |