changeset 1724:653b44cc23fa

directly set background color As defined in http://www.w3.org/TR/CSS2/colors.html, the background color of the canvas can either be defined by the <html> or the <body> tag. To be able to deal with this in src/html.cc we now explicitely set the canvas color instead of infering it from the root widget.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 17 Sep 2010 21:42:31 +0200
parents d91812cc9d4b
children f86d7aa97e94
files dw/layout.cc dw/layout.hh dw/widget.cc src/html.cc
diffstat 4 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dw/layout.cc	Mon Sep 06 22:36:04 2010 +0200
+++ b/dw/layout.cc	Fri Sep 17 21:42:31 2010 +0200
@@ -246,7 +246,6 @@
 
    canvasHeightGreater = false;
    setSizeHints ();
-   updateBgColor ();
    queueResize ();
 }
 
@@ -609,16 +608,9 @@
       setCursor (style::CURSOR_DEFAULT);
 }
 
-void Layout::updateBgColor ()
+void Layout::setBgColor (style::Color *color)
 {
-   /* The toplevel widget should always have a defined background color,
-    * except at the beginning. Searching a defined background is not
-    * necessary. */
-   if (topLevel && topLevel->getStyle() &&
-       topLevel->getStyle()->backgroundColor)
-      bgColor = topLevel->getStyle()->backgroundColor;
-   else
-      bgColor = NULL;
+   bgColor = color;
    view->setBgColor (bgColor);
 }
 
--- a/dw/layout.hh	Mon Sep 06 22:36:04 2010 +0200
+++ b/dw/layout.hh	Fri Sep 17 21:42:31 2010 +0200
@@ -202,7 +202,6 @@
    void removeAnchor (Widget *widget, char* name);
    void setCursor (style::Cursor cursor);
    void updateCursor ();
-   void updateBgColor ();
    void queueDraw (int x, int y, int width, int height);
    void queueDrawExcept (int x, int y, int width, int height,
       int ex, int ey, int ewidth, int eheight);
@@ -362,6 +361,8 @@
 
    /** \brief See dw::core::FindtextState::resetSearch. */
    inline void resetSearch () { findtextState.resetSearch (); }
+
+   void setBgColor (style::Color *color);
 };
 
 } // namespace dw
--- a/dw/widget.cc	Mon Sep 06 22:36:04 2010 +0200
+++ b/dw/widget.cc	Fri Sep 17 21:42:31 2010 +0200
@@ -302,8 +302,6 @@
    this->style = style;
 
    if (layout != NULL) {
-      if (parent == NULL)
-         layout->updateBgColor ();
       layout->updateCursor ();
    }
 
--- a/src/html.cc	Mon Sep 06 22:36:04 2010 +0200
+++ b/src/html.cc	Fri Sep 17 21:42:31 2010 +0200
@@ -1761,6 +1761,7 @@
 
    html->styleEngine->setNonCssHints (&props);
    html->dw->setStyle (html->styleEngine->style ());
+   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
@@ -1788,6 +1789,7 @@
             html->styleEngine->backgroundStyle()->backgroundColor->getColor());
    }
 
+
    S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_BODY;
 }