Revert "Ensure CSS rules are inherited from the parent tags"

Since the original change caused a problem with the CSS
rules being always inherited where in some cases this should
not be happening.

This reverts commit 6f65466137.

Change-Id: I6e9cf163d752b1869b5e967a7ab59963d655ba87
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Andy Shaw 2013-11-05 20:18:49 +01:00 committed by The Qt Project
parent 0c9a5698a1
commit 0cdf2a8023
2 changed files with 1 additions and 36 deletions

View File

@ -1896,11 +1896,7 @@ QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
if (nodes.at(node).id == Html_a && nodes.at(node).hasHref)
extraPseudo = "link";
decls = selector.declarationsForNode(n, extraPseudo);
n = selector.parentNode(n);
while (!selector.isNullNode(n)) {
decls = selector.declarationsForNode(n, extraPseudo) + decls;
n = selector.parentNode(n);
}
return decls;
}

View File

@ -187,8 +187,6 @@ private slots:
void htmlExportImportBlockCount();
void QTBUG27354_spaceAndSoftSpace();
void cssInheritance();
void QTBUG28998_linkColor();
private:
@ -2949,35 +2947,6 @@ void tst_QTextDocument::QTBUG27354_spaceAndSoftSpace()
}
}
void tst_QTextDocument::cssInheritance()
{
{
QTextDocument td;
td.setHtml("<html><head><style type=\"text/css\">body { line-height: 200% }</style></head><body>"
"<p>Foo</p><p>Bar</p><p>Baz</p></body></html>");
QTextBlock block = td.begin();
while (block.isValid()) {
QTextBlockFormat fmt = block.blockFormat();
QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight);
QVERIFY(fmt.lineHeight() == 200);
block = block.next();
}
}
{
QTextDocument td;
td.setHtml("<html><head><style type=\"text/css\">body { line-height: 200% } p { line-height: 300% }</style></head><body>"
"<p style=\"line-height: 40px\">Foo</p><p>Bar</p><p>Baz</p></body></html>");
QTextBlock block = td.begin();
QTextBlockFormat fmt = block.blockFormat();
QVERIFY(fmt.lineHeightType() == QTextBlockFormat::FixedHeight);
QVERIFY(fmt.lineHeight() == 40);
block = block.next();
fmt = block.blockFormat();
QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight);
QVERIFY(fmt.lineHeight() == 300);
}
}
void tst_QTextDocument::QTBUG28998_linkColor()
{
QPalette pal;