diff options
-rw-r--r-- | dw/layout.hh | 2 | ||||
-rw-r--r-- | dw/widget.cc | 4 | ||||
-rw-r--r-- | src/html.cc | 12 |
3 files changed, 16 insertions, 2 deletions
diff --git a/dw/layout.hh b/dw/layout.hh index a02cd101..dc9bf227 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -363,6 +363,8 @@ public: inline void resetSearch () { findtextState.resetSearch (); } void setBgColor (style::Color *color); + + inline style::Color* getBgColor () { return bgColor; } }; } // namespace dw diff --git a/dw/widget.cc b/dw/widget.cc index 7476e246..ded963fc 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -397,7 +397,9 @@ void Widget::drawWidgetBox (View *view, Rectangle *area, bool inverse) * widget->style->background_color is NULL (shining through). */ /** \todo Background images? */ - if (parent && style->backgroundColor) + + if (style->backgroundColor && + (parent || layout->getBgColor () != style->backgroundColor)) style::drawBackground (view, &viewArea, allocation.x, allocation.y, allocation.width, getHeight (), style, inverse); } diff --git a/src/html.cc b/src/html.cc index 3f39095a..9649b42e 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1569,10 +1569,16 @@ static void Html_parse_doctype(DilloHtml *html, const char *tag, int tagsize) */ static void Html_tag_open_html(DilloHtml *html, const char *tag, int tagsize) { + Style *style; + if (!(html->InFlags & IN_HTML)) html->InFlags |= IN_HTML; ++html->Num_HTML; + style = html->styleEngine->style (); + if (style->backgroundColor) + HT2LT(html)->setBgColor(style->backgroundColor); + if (html->Num_HTML > 1) { BUG_MSG("HTML element was already open\n"); } @@ -1761,7 +1767,11 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) html->styleEngine->setNonCssHints (&props); html->dw->setStyle (html->styleEngine->style ()); - HT2LT(html)->setBgColor(html->styleEngine->style ()->backgroundColor); + + /* Set canvas color if not already set from Html_open_html(). + */ + if (! HT2LT(html)->getBgColor()) + HT2LT(html)->setBgColor(html->styleEngine->style ()->backgroundColor); /* Determine a color for visited links. * This color is computed once per page and used for immediate feedback |