diff options
Diffstat (limited to 'src/gui/text/qtextdocumentfragment.cpp')
-rw-r--r-- | src/gui/text/qtextdocumentfragment.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 079b2e01f7..ea37695f4e 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -408,6 +408,8 @@ QTextDocumentFragment QTextDocumentFragment::fromPlainText(const QString &plainT return res; } +#ifndef QT_NO_TEXTHTMLPARSER + static QTextListFormat::Style nextListStyle(QTextListFormat::Style style) { if (style == QTextListFormat::ListDisc) @@ -417,8 +419,6 @@ static QTextListFormat::Style nextListStyle(QTextListFormat::Style style) return style; } -#ifndef QT_NO_TEXTHTMLPARSER - QTextHtmlImporter::QTextHtmlImporter(QTextDocument *_doc, const QString &_html, ImportMode mode, const QTextDocument *resourceProvider) : indent(0), compressNextWhitespace(PreserveWhiteSpace), doc(_doc), importMode(mode) { @@ -825,9 +825,13 @@ bool QTextHtmlImporter::closeTag() break; case Html_div: - if (closedNode->children.isEmpty()) - break; - Q_FALLTHROUGH(); + if (cursor.position() > 0) { + const QChar curChar = cursor.document()->characterAt(cursor.position() - 1); + if (!closedNode->children.isEmpty() && curChar != QChar::LineSeparator) { + blockTagClosed = true; + } + } + break; default: if (closedNode->isBlock()) blockTagClosed = true; |