From 6f6546613774a48fe12f13f796ed7115dfe49a27 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 9 Oct 2013 20:59:45 +0200 Subject: Ensure CSS rules are inherited from the parent tags When CSS was set in the head tag then it was not being inherited by the child tags. This ensures that the inhertiance happens and that the deeper the CSS is set then it will ensure that it has precedence over the ones set on the parent. A test is added that shows the standard inheritance from the head tag and the precedence from child tags in effect too. Task-number: QTBUG-28770 Change-Id: I30be3ec141b2cd8d6e0db8a92669aed34da93b33 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Simon Hausmann --- src/gui/text/qtexthtmlparser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 952cebcc1b..5292ba20a2 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1896,7 +1896,11 @@ QVector 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; } -- cgit v1.2.3