From f94b0e1dd999a6bb8dfa4471fd63c395fc8e2302 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 3 May 2021 12:21:23 +0200 Subject: Allow background inheritance between non-body block elements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most nested block elements are merged together, so while we shouldn't do real inheritance we need to do it when block elements are combined. Pick-to: 6.1 Fixes: QTBUG-91236 Change-Id: I9e37b15f705db92c79a620d0d772f25d0ee72b8d Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtexthtmlparser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 3ad0938268..77299f7f9c 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1032,8 +1032,11 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent // we don't paint per-row background colors, yet. so as an // exception inherit the background color here // we also inherit the background between inline elements + // we also inherit from non-body block elements since we merge them together if ((parent->id != Html_tr || !isTableCell()) - && (displayMode != QTextHtmlElement::DisplayInline || parent->displayMode != QTextHtmlElement::DisplayInline)) { + && (displayMode != QTextHtmlElement::DisplayInline || parent->displayMode != QTextHtmlElement::DisplayInline) + && (parent->id == Html_body || displayMode != QTextHtmlElement::DisplayBlock || parent->displayMode != QTextHtmlElement::DisplayBlock) + ) { charFormat.clearProperty(QTextFormat::BackgroundBrush); } -- cgit v1.2.3