diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/css.cc | 3 | ||||
-rw-r--r-- | src/html.cc | 28 | ||||
-rw-r--r-- | src/prefs.c | 1 | ||||
-rw-r--r-- | src/prefs.h | 1 | ||||
-rw-r--r-- | src/prefsparser.cc | 7 | ||||
-rw-r--r-- | src/uicmd.cc | 4 | ||||
-rw-r--r-- | src/web.cc | 5 |
7 files changed, 46 insertions, 3 deletions
@@ -558,8 +558,7 @@ void CssContext::addRule (CssSelector *sel, CssPropertyList *props, */ void CssContext::buildUserAgentStyle () { const char *cssBuf = - "body {background-color: #e0e0a3; font-family: sans-serif; color: black;" - " margin: 5px}" + "body {margin: 5px}" "big {font-size: 1.17em}" "blockquote, dd {margin-left: 40px; margin-right: 40px}" "center {text-align: center}" diff --git a/src/html.cc b/src/html.cc index 778d0b6b..9b53a082 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1715,6 +1715,9 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) Textblock *textblock; int32_t color; int tag_index_a = a_Html_tag_index ("a"); + int tag_index_body = a_Html_tag_index ("body"); + int tag_index_html = a_Html_tag_index ("html"); + style::Color *bgColor; if (!(html->InFlags & IN_BODY)) html->InFlags |= IN_BODY; @@ -1729,6 +1732,22 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) BUG_MSG("unclosed HEAD element\n"); } + html->styleEngine->endElement(tag_index_body); + html->styleEngine->endElement(tag_index_html); + html->styleEngine->startElement(tag_index_html); + bgColor = html->styleEngine->style ()->backgroundColor; + html->styleEngine->startElement(tag_index_body); + + if ((attrbuf = Html_get_attr2(html, tag, tagsize, "id", + HTML_LeftTrim | HTML_RightTrim))) + html->styleEngine->setId(attrbuf); + if ((attrbuf = Html_get_attr2(html, tag, tagsize, "class", + HTML_LeftTrim | HTML_RightTrim))) + html->styleEngine->setClass(attrbuf); + if ((attrbuf = Html_get_attr2(html, tag, tagsize, "style", + HTML_LeftTrim | HTML_RightTrim))) + html->styleEngine->setStyle(attrbuf); + textblock = HT2TB(html); if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) { @@ -1753,6 +1772,14 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) html->dw->setStyle (html->styleEngine->style ()); + /* Set canvas color if not already set from Html_open_html(). + */ + if (!bgColor) + bgColor = html->styleEngine->style ()->backgroundColor; + + if (bgColor) + HT2LT(html)->setBgColor(bgColor); + /* Determine a color for visited links. * This color is computed once per page and used for immediate feedback * when clicking a link. @@ -1777,6 +1804,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; } diff --git a/src/prefs.c b/src/prefs.c index 5514c01a..f968710a 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -36,6 +36,7 @@ DilloPrefs prefs; void a_Prefs_init(void) { prefs.allow_white_bg = TRUE; + prefs.bg_color = 0xdcd1ba; prefs.buffered_drawing = 1; prefs.contrast_visited_color = TRUE; prefs.enterpress_forces_submit = FALSE; diff --git a/src/prefs.h b/src/prefs.h index 684262ed..4009925c 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -46,6 +46,7 @@ struct _DilloPrefs { DilloUrl *start_page; DilloUrl *home; bool_t allow_white_bg; + int32_t bg_color; bool_t contrast_visited_color; bool_t show_tooltip; int panel_size; diff --git a/src/prefsparser.cc b/src/prefsparser.cc index 78cade0b..95f98c16 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -16,11 +16,13 @@ #include "prefs.h" #include "misc.h" #include "msg.h" +#include "colors.h" #include "prefsparser.hh" typedef enum { PREFS_BOOL, + PREFS_COLOR, PREFS_STRING, PREFS_URL, PREFS_INT32, @@ -43,10 +45,12 @@ int PrefsParser::parseOption(char *name, char *value) { const SymNode_t *node; uint_t i; + int st; /* Symbol array, sorted alphabetically */ const SymNode_t symbols[] = { { "allow_white_bg", &prefs.allow_white_bg, PREFS_BOOL }, + { "bg_color", &prefs.bg_color, PREFS_COLOR }, { "buffered_drawing", &prefs.buffered_drawing, PREFS_INT32 }, { "contrast_visited_color", &prefs.contrast_visited_color, PREFS_BOOL }, { "enterpress_forces_submit", &prefs.enterpress_forces_submit, @@ -122,6 +126,9 @@ int PrefsParser::parseOption(char *name, char *value) *(bool_t *)node->pref = (!dStrcasecmp(value, "yes") || !dStrcasecmp(value, "true")); break; + case PREFS_COLOR: + *(int32_t *)node->pref = a_Color_parse(value, *(int32_t*)node->pref,&st); + break; case PREFS_STRING: dFree(*(char **)node->pref); *(char **)node->pref = dStrdup(value); diff --git a/src/uicmd.cc b/src/uicmd.cc index 93836735..001165d6 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -449,6 +449,8 @@ BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, // 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 @@ static BrowserWindow *UIcmd_tab_new(const void *vbw) // 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); @@ -61,10 +61,13 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, 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) |