]> source.dussan.org Git - rspamd.git/commitdiff
[Project] Html/CSS: Link html and css styles
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Jun 2021 14:24:21 +0000 (15:24 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Jun 2021 14:24:21 +0000 (15:24 +0100)
src/libserver/html/html.cxx

index f47fc272ef186bc9cb6f326674dc8013c581305f..139c59bd2fa51a848ab36ae209fe563eb1f72644 100644 (file)
@@ -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();