diff options
Diffstat (limited to 'src/html.cc')
-rw-r--r-- | src/html.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/html.cc b/src/html.cc index 75d1820f..9c2d9493 100644 --- a/src/html.cc +++ b/src/html.cc @@ -364,12 +364,21 @@ static void Html_add_textblock(DilloHtml *html, bool addBreaks, int breakSpace, bool addBreakOpt) { Textblock *textblock = new Textblock (prefs.limit_text_width); + Style *style; + + if (addBreaks) { + StyleAttrs attrs = *(html->style ()); + attrs.display = DISPLAY_BLOCK; + style = Style::create (&attrs); + } else { + style = html->style (); + style->ref (); + } if (addBreaks) HT2TB(html)->addParbreak (breakSpace, html->wordStyle ()); - HT2TB(html)->addWidget (textblock, html->style ()); /* Works also for floats - etc. */ + HT2TB(html)->addWidget (textblock, style); /* Works also for floats etc. */ if (addBreakOpt) HT2TB(html)->addBreakOption (html->style (), false); @@ -378,11 +387,13 @@ static void Html_add_textblock(DilloHtml *html, bool addBreaks, int breakSpace, S_TOP(html)->textblock = html->dw = textblock; if (addBreaks) S_TOP(html)->hand_over_break = true; + + style->unref (); } -static bool Html_will_textblock_be_out_of_flow(DilloHtml *html) +static bool Html_must_add_breaks(DilloHtml *html) { - return HT2TB(html)->isStyleOutOfFlow (html->style ()); + return HT2TB(html)->mustAddBreaks (html->style ()); } /* @@ -3913,7 +3924,7 @@ static void Html_check_html5_obsolete(DilloHtml *html, int ni) static void Html_display_block(DilloHtml *html) { - Html_add_textblock(html, !Html_will_textblock_be_out_of_flow (html), 0, + Html_add_textblock(html, Html_must_add_breaks (html), 0, false /* Perhaps true for widgets oof? */); } |