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>
This commit is contained in:
parent
083d8caee1
commit
1753d69607
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user