summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2002-12-27 20:35:32 +0000
committerJames Bursa <james@netsurf-browser.org>2002-12-27 20:35:32 +0000
commit8d1cbc0d050432763bddbb81c9ebcbc1cc8dc1c2 (patch)
tree8f5c5ce75502d4e57093e591e23818b7ce9516ee
parentc15de8c5853961e867cb727d63dbe859d75e4152 (diff)
downloadnetsurf-8d1cbc0d050432763bddbb81c9ebcbc1cc8dc1c2.tar.gz
netsurf-8d1cbc0d050432763bddbb81c9ebcbc1cc8dc1c2.tar.bz2
[project @ 2002-12-27 20:35:32 by bursa]
Implement color property. svn path=/import/netsurf/; revision=65
-rw-r--r--render/box.c14
-rw-r--r--riscos/gui.c11
2 files changed, 22 insertions, 3 deletions
diff --git a/render/box.c b/render/box.c
index 147818d55..59a32016f 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1,5 +1,5 @@
/**
- * $Id: box.c,v 1.21 2002/12/27 17:28:19 bursa Exp $
+ * $Id: box.c,v 1.22 2002/12/27 20:35:32 bursa Exp $
*/
#include <assert.h>
@@ -305,12 +305,24 @@ struct css_style * box_get_style(struct css_stylesheet * stylesheet, struct css_
free(s);
}
+ if ((s = (char *) xmlGetProp(n, (xmlChar *) "bgcolor"))) {
+ unsigned int r, g, b;
+ if (s[0] == '#' && sscanf(s + 1, "%2x%2x%2x", &r, &g, &b) == 3)
+ style->background_color = (b << 16) | (g << 8) | r;
+ }
+
if ((s = (char *) xmlGetProp(n, (xmlChar *) "clear"))) {
if (strcmp(s, "all") == 0) style->clear = CSS_CLEAR_BOTH;
else if (strcmp(s, "left") == 0) style->clear = CSS_CLEAR_LEFT;
else if (strcmp(s, "right") == 0) style->clear = CSS_CLEAR_RIGHT;
}
+ if ((s = (char *) xmlGetProp(n, (xmlChar *) "color"))) {
+ unsigned int r, g, b;
+ if (s[0] == '#' && sscanf(s + 1, "%2x%2x%2x", &r, &g, &b) == 3)
+ style->color = (b << 16) | (g << 8) | r;
+ }
+
if ((s = (char *) xmlGetProp(n, (xmlChar *) "width"))) {
if (strrchr(s, '%')) {
style->width.width = CSS_WIDTH_PERCENT;
diff --git a/riscos/gui.c b/riscos/gui.c
index 6e4599264..94b6de013 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -1,5 +1,5 @@
/**
- * $Id: gui.c,v 1.6 2002/12/27 20:08:18 bursa Exp $
+ * $Id: gui.c,v 1.7 2002/12/27 20:35:32 bursa Exp $
*/
#include "netsurf/riscos/font.h"
@@ -495,6 +495,13 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x, si
}
#endif
+ if (box->style->background_color != TRANSPARENT)
+ {
+ colourtrans_set_gcol(box->style->background_color << 8, 0, os_ACTION_OVERWRITE, 0);
+ os_plot(os_MOVE_TO, x + box->x * 2, y - box->y * 2);
+ os_plot(os_PLOT_RECTANGLE | os_PLOT_BY, box->width * 2, -box->height * 2);
+ }
+
if (box->type == BOX_INLINE)
{
@@ -556,7 +563,7 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1)
}
}
- xcolourtrans_set_font_colours(box->font->handle, 0xffffff, box->style->color << 8,
+ colourtrans_set_font_colours(box->font->handle, 0xffffff, box->style->color << 8,
14, 0, 0, 0);
font_paint(box->font->handle, box->text,