diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-12 07:31:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-12 08:33:08 +0200 |
commit | 990969655c5fb4d03682e96df9b12101f5ee9815 (patch) | |
tree | b8fb5c50285105c8bc5a938fb50f93ff9f24889d /src/gui/text/qtexthtmlparser.cpp | |
parent | a213011a53f12f101d08a04afc8fdacd2d54a232 (diff) | |
parent | e64b2234e829cc47872225debcf80d6c06db18f0 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
config_help.txt
configure
src/corelib/io/qprocess_wince.cpp
src/plugins/platforms/windows/qwindowstheme.cpp
src/plugins/platforms/xcb/qxcbbackingstore.cpp
tests/auto/corelib/tools/qtimezone/BLACKLIST
tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index d8e12f7024..576ff7d935 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -492,7 +492,7 @@ static QString quoteNewline(const QString &s) QTextHtmlParserNode::QTextHtmlParserNode() : parent(0), id(Html_unknown), - cssFloat(QTextFrameFormat::InFlow), hasOwnListStyle(false), + cssFloat(QTextFrameFormat::InFlow), hasOwnListStyle(false), hasOwnLineHeightType(false), hasCssListIndent(false), isEmptyParagraph(false), isTextFrame(false), isRootFrame(false), displayMode(QTextHtmlElement::DisplayInline), hasHref(false), listStyle(QTextListFormat::ListStyleUndefined), imageWidth(-1), imageHeight(-1), tableBorder(0), @@ -1198,20 +1198,48 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration> case QCss::QtBlockIndent: blockFormat.setIndent(decl.d->values.first().variant.toInt()); break; - case QCss::LineHeight: { + case QCss::QtLineHeightType: { + QString lineHeightTypeName = decl.d->values.first().variant.toString(); + QTextBlockFormat::LineHeightTypes lineHeightType; + if (lineHeightTypeName.compare(QLatin1String("proportional"), Qt::CaseInsensitive) == 0) + lineHeightType = QTextBlockFormat::ProportionalHeight; + else if (lineHeightTypeName.compare(QLatin1String("fixed"), Qt::CaseInsensitive) == 0) + lineHeightType = QTextBlockFormat::FixedHeight; + else if (lineHeightTypeName.compare(QLatin1String("minimum"), Qt::CaseInsensitive) == 0) + lineHeightType = QTextBlockFormat::MinimumHeight; + else if (lineHeightTypeName.compare(QLatin1String("line-distance"), Qt::CaseInsensitive) == 0) + lineHeightType = QTextBlockFormat::LineDistanceHeight; + else + lineHeightType = QTextBlockFormat::SingleHeight; + + blockFormat.setProperty(QTextBlockFormat::LineHeightType, lineHeightType); + hasOwnLineHeightType = true; + } + break; + case QCss::LineHeight: { qreal lineHeight; + QTextBlockFormat::LineHeightTypes lineHeightType; if (decl.realValue(&lineHeight, "px")) { - blockFormat.setLineHeight(lineHeight, QTextBlockFormat::FixedHeight); + lineHeightType = QTextBlockFormat::MinimumHeight; } else { bool ok; QString value = decl.d->values.first().toString(); lineHeight = value.toDouble(&ok); - if (ok) - blockFormat.setLineHeight(lineHeight, QTextBlockFormat::ProportionalHeight); - else - blockFormat.setLineHeight(0, QTextBlockFormat::SingleHeight); + if (ok) { + lineHeightType = QTextBlockFormat::ProportionalHeight; + } else { + lineHeight = 0.0; + lineHeightType = QTextBlockFormat::SingleHeight; + } } - break; } + + // Only override line height type if specified in same node + if (hasOwnLineHeightType) + lineHeightType = QTextBlockFormat::LineHeightTypes(blockFormat.lineHeightType()); + + blockFormat.setLineHeight(lineHeight, lineHeightType); + break; + } case QCss::TextIndent: { qreal indent = 0; if (decl.realValue(&indent, "px")) |