changeset 1725:f86d7aa97e94

draw topLevel background if it differs from canvas background
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 17 Sep 2010 22:05:15 +0200
parents 653b44cc23fa
children 548d4f2bc61d
files dw/layout.hh dw/widget.cc src/html.cc
diffstat 3 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dw/layout.hh	Fri Sep 17 21:42:31 2010 +0200
+++ b/dw/layout.hh	Fri Sep 17 22:05:15 2010 +0200
@@ -363,6 +363,8 @@
    inline void resetSearch () { findtextState.resetSearch (); }
 
    void setBgColor (style::Color *color);
+
+   inline style::Color* getBgColor () { return bgColor; }
 };
 
 } // namespace dw
--- a/dw/widget.cc	Fri Sep 17 21:42:31 2010 +0200
+++ b/dw/widget.cc	Fri Sep 17 22:05:15 2010 +0200
@@ -397,7 +397,9 @@
     *   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);
 }
--- a/src/html.cc	Fri Sep 17 21:42:31 2010 +0200
+++ b/src/html.cc	Fri Sep 17 22:05:15 2010 +0200
@@ -1569,10 +1569,16 @@
  */
 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 @@
 
    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