is_visible = false;
}
else {
- is_transparent = true;
+ if (tag->block->has_display() && tag->block->display == css::css_display_value::DISPLAY_HIDDEN) {
+ is_visible = false;
+ }
+ else {
+ is_transparent = true;
+ }
}
}
- else if (tag->block->has_display()) {
+ else {
if (tag->block->display == css::css_display_value::DISPLAY_BLOCK) {
is_block = true;
}
}
/* Propagate styles */
- hc->traverse_block_tags([&hc](const html_tag *tag) -> bool {
+ hc->traverse_block_tags([&hc, &pool](const html_tag *tag) -> bool {
if (hc->css_style) {
auto *css_block = hc->css_style->check_tag_block(tag);
tag->block->set_display(css::css_display_value::DISPLAY_HIDDEN);
}
else if (tag->flags & (CM_BLOCK | CM_TABLE)) {
- tag->block->set_display(css::css_display_value::DISPLAY_BLOCK);
+ tag->block->set_display_implicit(css::css_display_value::DISPLAY_BLOCK);
}
else if (tag->flags & CM_ROW) {
- tag->block->set_display(css::css_display_value::DISPLAY_TABLE_ROW);
+ tag->block->set_display_implicit(css::css_display_value::DISPLAY_TABLE_ROW);
}
else {
- tag->block->set_display(css::css_display_value::DISPLAY_INLINE);
+ tag->block->set_display_implicit(css::css_display_value::DISPLAY_INLINE);
}
}
cld_tag->block->propagate_block(*tag->block);
}
else {
- cld_tag->block = tag->block;
+ cld_tag->block = rspamd_mempool_alloc0_type(pool, html_block);
+ *cld_tag->block = *tag->block;
}
}
}
display = v;
mask |= display_mask;
}
+ /* Set display, do not set mask */
+ auto set_display_implicit(rspamd::css::css_display_value v) -> void {
+ display = v;
+ }
auto set_font_size(float fs, bool is_percent = false) -> void {
fs = is_percent ? (-fs) : fs;
if (fs < INT8_MIN) {
simple_prop(fg_color_mask, fg_color, other.fg_color);
simple_prop(bg_color_mask, bg_color, other.bg_color);
- if (other.has_display() && !other.is_visible()) {
+ if (other.has_display()) {
simple_prop(display_mask, display, other.display);
- mask |= other.mask&(transparent_flag|invisible_flag);
+ if (!other.is_visible()) {
+ mask |= other.mask & (transparent_flag | invisible_flag);
+ }
}
/* Sizes are very different
" </P>\n"
" <b>stuff</p>?\n"
" </body>\n"
- "</html>", "Hello, world! test \ndata<>\nstuff?"},
+ "</html>", "Hello, world! test \ndata<>\nstuff\n?"},
{"<p><!--comment-->test</br></hr><br>", "test\n"},
/* Tables */
{"<table>\n"