From cdf0601420e087afd14aabca4b00224b59f0660a Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sat, 30 Aug 2003 21:45:03 +0000 Subject: [project @ 2003-08-30 21:45:03 by bursa] Make page background colour work properly. svn path=/import/netsurf/; revision=263 --- content/content.h | 1 + render/box.c | 13 +++++++++++++ render/html.c | 1 + riscos/gui.c | 19 +++++++++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/content/content.h b/content/content.h index 0f2087b8e..77031f077 100644 --- a/content/content.h +++ b/content/content.h @@ -103,6 +103,7 @@ struct content char* source; int length; struct box* layout; + colour background_colour; unsigned int stylesheet_count; struct content **stylesheet_content; struct css_style* style; diff --git a/render/box.c b/render/box.c index 27a017930..256b5c0bf 100644 --- a/render/box.c +++ b/render/box.c @@ -56,6 +56,8 @@ static struct css_style * box_get_style(struct content ** stylesheet, xmlNode * n, struct css_selector * selector, unsigned int depth); static struct result box_a(xmlNode *n, struct status *status, struct css_style *style); +static struct result box_body(xmlNode *n, struct status *status, + struct css_style *style); static struct result box_image(xmlNode *n, struct status *status, struct css_style *style); static struct result box_form(xmlNode *n, struct status *status, @@ -99,6 +101,7 @@ struct element_entry { static const struct element_entry element_table[] = { {"a", box_a}, {"applet", box_applet}, + {"body", box_body}, {"embed", box_embed}, {"form", box_form}, {"iframe", box_iframe}, @@ -573,6 +576,15 @@ struct result box_a(xmlNode *n, struct status *status, return (struct result) {box, 1}; } +struct result box_body(xmlNode *n, struct status *status, + struct css_style *style) +{ + struct box *box; + status->content->data.html.background_colour = style->background_color; + box = box_create(style, status->href, status->title); + return (struct result) {box, 1}; +} + struct result box_image(xmlNode *n, struct status *status, struct css_style *style) { @@ -1347,6 +1359,7 @@ void box_free_box(struct box *box) free(box->text); xmlFree(box->title); + free(box->col); /* only free href if we're the top most user */ /*if (box->href != 0) diff --git a/render/html.c b/render/html.c index e41a61633..f54939456 100644 --- a/render/html.c +++ b/render/html.c @@ -37,6 +37,7 @@ void html_create(struct content *c) c->data.html.fonts = NULL; c->data.html.length = 0; c->data.html.source = xcalloc(0, 1); + c->data.html.background_colour = TRANSPARENT; } diff --git a/riscos/gui.c b/riscos/gui.c index cd7067a37..d79dbbfdc 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -326,9 +326,24 @@ void html_redraw(struct content *c, long x, long y, unsigned long width, unsigned long height) { bool select_on = false; + unsigned long background_colour = 0xffffff; + struct box *box; + assert(c->data.html.layout != NULL); - ro_gui_window_redraw_box(c, c->data.html.layout->children, - x, y, clip, 0xffffff, x, y, &select_on); + box = c->data.html.layout->children; + assert(box); + + /* clear to background colour */ + if (c->data.html.background_colour != TRANSPARENT) { + colourtrans_set_gcol(c->data.html.background_colour << 8, + colourtrans_SET_BG | colourtrans_USE_ECFS, + os_ACTION_OVERWRITE, 0); + os_clg(); + background_colour = c->data.html.background_colour; + } + + ro_gui_window_redraw_box(c, box, x, y, clip, background_colour, x, y, + &select_on); } -- cgit v1.2.3