commit fb89c35: [Project] Html/CSS: Link html and css styles

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jun 15 14:28:09 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-06-15 15:24:21 +0100
URL: https://github.com/rspamd/rspamd/commit/fb89c3582ea56872dc5fae3a3a9ffc426861c163 (HEAD -> master)

[Project] Html/CSS: Link html and css styles

---
 src/libserver/html/html.cxx | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index f47fc272e..139c59bd2 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -1658,7 +1658,19 @@ html_process_input(rspamd_mempool_t *pool,
 	}, html_content::traverse_type::POST_ORDER);
 
 	/* Propagate styles */
-	hc->traverse_block_tags([](const html_tag *tag) -> bool {
+	hc->traverse_block_tags([&hc](const html_tag *tag) -> bool {
+		if (hc->css_style) {
+			auto *css_block = hc->css_style->check_tag_block(tag);
+
+			if (css_block) {
+				if (tag->block) {
+					tag->block->propagate_block(*css_block);
+				}
+				else {
+					tag->block = css_block;
+				}
+			}
+		}
 		if (tag->block) {
 			tag->block->compute_visibility();
 


More information about the Commits mailing list