diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-09-17 21:42:31 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-09-17 21:42:31 +0200 |
commit | 4fc467bb9112d4e49cc9ecbde03aa72bd805fc6d (patch) | |
tree | 522588524950ab2501a94449145806bfd54b75cc | |
parent | 6dc060d999d0c76175b535db2f81b7bc4e64c3f5 (diff) |
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.
-rw-r--r-- | dw/layout.cc | 12 | ||||
-rw-r--r-- | dw/layout.hh | 3 | ||||
-rw-r--r-- | dw/widget.cc | 2 | ||||
-rw-r--r-- | src/html.cc | 2 |
4 files changed, 6 insertions, 13 deletions
diff --git a/dw/layout.cc b/dw/layout.cc index b30831c7..f3ff896e 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -246,7 +246,6 @@ void Layout::addWidget (Widget *widget) canvasHeightGreater = false; setSizeHints (); - updateBgColor (); queueResize (); } @@ -609,16 +608,9 @@ void Layout::updateCursor () 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); } diff --git a/dw/layout.hh b/dw/layout.hh index 304cf166..a02cd101 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -202,7 +202,6 @@ private: 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 @@ public: /** \brief See dw::core::FindtextState::resetSearch. */ inline void resetSearch () { findtextState.resetSearch (); } + + void setBgColor (style::Color *color); }; } // namespace dw diff --git a/dw/widget.cc b/dw/widget.cc index fb0d29e0..7476e246 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -302,8 +302,6 @@ void Widget::setStyle (style::Style *style) this->style = style; if (layout != NULL) { - if (parent == NULL) - layout->updateBgColor (); layout->updateCursor (); } diff --git a/src/html.cc b/src/html.cc index d728713e..3f39095a 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1761,6 +1761,7 @@ 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); /* Determine a color for visited links. * This color is computed once per page and used for immediate feedback @@ -1788,6 +1789,7 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) html->styleEngine->backgroundStyle()->backgroundColor->getColor()); } + S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_BODY; } |