changeset 1730:2c90a2e90866

call layout->setBgColor() from web.cc
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 24 Sep 2010 23:44:47 +0200
parents 44b04d308585
children 9b95f6d31e13
files dw/layout.cc src/css.cc src/html.cc src/plain.cc src/uicmd.cc src/web.cc
diffstat 6 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/dw/layout.cc	Fri Sep 24 23:08:24 2010 +0200
+++ b/dw/layout.cc	Fri Sep 24 23:44:47 2010 +0200
@@ -611,7 +611,8 @@
 void Layout::setBgColor (style::Color *color)
 {
    bgColor = color;
-   view->setBgColor (bgColor);
+   if (view)
+      view->setBgColor (bgColor);
 }
 
 void Layout::resizeIdle ()
--- a/src/css.cc	Fri Sep 24 23:08:24 2010 +0200
+++ b/src/css.cc	Fri Sep 24 23:44:47 2010 +0200
@@ -566,7 +566,6 @@
      ":link {color: blue; text-decoration: underline; cursor: pointer}"
      ":visited {color: #800080; text-decoration: underline; cursor: pointer}"
      "h1, h2, h3, h4, h5, h6, b, strong {font-weight: bolder}"
-     "html  {font-family: sans-serif; color: black}"
      "i, em, cite, address, var {font-style: italic}"
      ":link img, :visited img {border: 1px solid}"
      "frameset, ul, ol, dir {margin-left: 40px}"
--- a/src/html.cc	Fri Sep 24 23:08:24 2010 +0200
+++ b/src/html.cc	Fri Sep 24 23:44:47 2010 +0200
@@ -1785,10 +1785,9 @@
     */
    if (!bgColor)
       bgColor = html->styleEngine->style ()->backgroundColor;
-   if (!bgColor)
-      bgColor = style::Color::create (HT2LT(html), prefs.bg_color);
-
-   HT2LT(html)->setBgColor(bgColor);  
+
+   if (bgColor)
+      HT2LT(html)->setBgColor(bgColor);  
 
    /* Determine a color for visited links.
     * This color is computed once per page and used for immediate feedback
--- a/src/plain.cc	Fri Sep 24 23:08:24 2010 +0200
+++ b/src/plain.cc	Fri Sep 24 23:44:47 2010 +0200
@@ -85,8 +85,6 @@
  */
 DilloPlain::DilloPlain(BrowserWindow *p_bw)
 {
-   style::Color *bgColor;
-
    /* Init event receiver */
    plainReceiver.plain = this;
 
@@ -97,8 +95,6 @@
    state = ST_SeekingEol;
 
    Layout *layout = (Layout*) bw->render_layout;
-   bgColor = style::Color::create (layout, prefs.bg_color);
-   layout->setBgColor(bgColor);
    StyleEngine styleEngine (layout);
 
    styleEngine.startElement ("body");
--- a/src/uicmd.cc	Fri Sep 24 23:08:24 2010 +0200
+++ b/src/uicmd.cc	Fri Sep 24 23:44:47 2010 +0200
@@ -449,6 +449,8 @@
    // Now create the Dw render layout and viewport
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
+   style::Color *bgColor = style::Color::create (layout, prefs.bg_color);
+   layout->setBgColor (bgColor);
 
    FltkViewport *viewport = new FltkViewport (0, 0, 1, 1);
    if (prefs.buffered_drawing == 1)
@@ -507,6 +509,8 @@
    // Now create the Dw render layout and viewport
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
+   style::Color *bgColor = style::Color::create (layout, prefs.bg_color);
+   layout->setBgColor (bgColor);
 
    FltkViewport *viewport = new FltkViewport (0, 0, 1, 1);
 
--- a/src/web.cc	Fri Sep 24 23:08:24 2010 +0200
+++ b/src/web.cc	Fri Sep 24 23:44:47 2010 +0200
@@ -61,10 +61,13 @@
    if (Web->flags & WEB_RootUrl) {
       /* We have RootUrl! */
 
+      style::Color *bgColor = style::Color::create (layout, prefs.bg_color);
+      Web->bgColor = bgColor->getColor ();
+      layout->setBgColor (bgColor);
+
       /* Set a style for the widget */
       StyleEngine styleEngine (layout);
       styleEngine.startElement ("body");
-      Web->bgColor= styleEngine.backgroundStyle()->backgroundColor->getColor();
 
       dw = (Widget*) a_Mime_set_viewer(Type, Web, Call, Data);
       if (dw == NULL)