summaryrefslogtreecommitdiff
path: root/css
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-04-02 23:12:26 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-04-02 23:12:26 +0000
commita260f648f8fd215cf5f33bb280f689df3f848cd0 (patch)
tree9bd8ed171af215a205131ec891a4faafaa29d7aa /css
parent095d17b8ad1238c0f55d2ef650145e0deca90d39 (diff)
downloadnetsurf-a260f648f8fd215cf5f33bb280f689df3f848cd0.tar.gz
netsurf-a260f648f8fd215cf5f33bb280f689df3f848cd0.tar.bz2
[project @ 2004-04-02 23:12:26 by jmb]
Implement CSS cursor property svn path=/import/netsurf/; revision=705
Diffstat (limited to 'css')
-rw-r--r--css/css.c8
-rw-r--r--css/css.h1
-rw-r--r--css/css_enums1
-rw-r--r--css/ruleset.c20
4 files changed, 30 insertions, 0 deletions
diff --git a/css/css.c b/css/css.c
index 3b8dbeee9..6b83291fe 100644
--- a/css/css.c
+++ b/css/css.c
@@ -49,6 +49,7 @@ const struct css_style css_base_style = {
{ 2, CSS_UNIT_PX } }, CSS_BORDER_STYLE_NONE } },
CSS_CLEAR_NONE,
0x000000,
+ CSS_CURSOR_AUTO,
CSS_DISPLAY_BLOCK,
CSS_FLOAT_NONE,
{ CSS_FONT_SIZE_LENGTH, { { 10, CSS_UNIT_PT } } },
@@ -87,6 +88,7 @@ const struct css_style css_empty_style = {
{ 0, CSS_UNIT_PX } }, CSS_BORDER_STYLE_INHERIT } },
CSS_CLEAR_INHERIT,
CSS_COLOR_INHERIT,
+ CSS_CURSOR_INHERIT,
CSS_DISPLAY_INHERIT,
CSS_FLOAT_INHERIT,
{ CSS_FONT_SIZE_INHERIT, { { 1, CSS_UNIT_EM } } },
@@ -125,6 +127,7 @@ const struct css_style css_blank_style = {
{ 2, CSS_UNIT_PX } }, CSS_BORDER_STYLE_NONE } },
CSS_CLEAR_NONE,
CSS_COLOR_INHERIT,
+ CSS_CURSOR_INHERIT,
CSS_DISPLAY_INLINE,
CSS_FLOAT_NONE,
{ CSS_FONT_SIZE_INHERIT, { { 1, CSS_UNIT_EM } } },
@@ -681,6 +684,7 @@ void css_dump_style(const struct css_style * const style)
fprintf(stderr, "background-color: #%lx; ", style->background_color);
fprintf(stderr, "clear: %s; ", css_clear_name[style->clear]);
fprintf(stderr, "color: #%lx; ", style->color);
+ fprintf(stderr, "cursor: %s", css_cursor_name[style->cursor]);
fprintf(stderr, "display: %s; ", css_display_name[style->display]);
fprintf(stderr, "float: %s; ", css_float_name[style->float_]);
fprintf(stderr, "font: %s %s ", css_font_style_name[style->font_style],
@@ -826,6 +830,8 @@ void css_cascade(struct css_style * const style, const struct css_style * const
style->clear = apply->clear;
if (apply->color != CSS_COLOR_INHERIT)
style->color = apply->color;
+ if (apply->cursor != CSS_CURSOR_INHERIT)
+ style->cursor = apply->cursor;
if (apply->display != CSS_DISPLAY_INHERIT)
style->display = apply->display;
if (apply->float_ != CSS_FLOAT_INHERIT)
@@ -920,6 +926,8 @@ void css_merge(struct css_style * const style, const struct css_style * const ap
style->clear = apply->clear;
if (apply->color != CSS_COLOR_INHERIT)
style->color = apply->color;
+ if (apply->cursor != CSS_CURSOR_INHERIT)
+ style->cursor = apply->cursor;
if (apply->display != CSS_DISPLAY_INHERIT)
style->display = apply->display;
if (apply->float_ != CSS_FLOAT_INHERIT)
diff --git a/css/css.h b/css/css.h
index 0c1f65e6f..a756ea316 100644
--- a/css/css.h
+++ b/css/css.h
@@ -72,6 +72,7 @@ struct css_style {
css_clear clear;
colour color;
+ css_cursor cursor;
css_display display;
css_float float_;
diff --git a/css/css_enums b/css/css_enums
index e8d85ae5e..2cccda18a 100644
--- a/css/css_enums
+++ b/css/css_enums
@@ -4,6 +4,7 @@ css_background_position inherit top center bottom left right length percent
css_background_repeat inherit repeat repeat_x repeat_y no_repeat
css_border_style inherit none hidden dotted dashed solid double groove ridge inset outset
css_clear inherit none both left right
+css_cursor inherit auto crosshair default pointer move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help
css_display inherit inline block list-item run-in inline-block table inline-table table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption none
css_float inherit none left right
css_font_family inherit sans-serif serif monospace cursive fantasy
diff --git a/css/ruleset.c b/css/ruleset.c
index 7ae15bd02..381e1fea3 100644
--- a/css/ruleset.c
+++ b/css/ruleset.c
@@ -70,6 +70,7 @@ static void parse_border_width_side(struct css_style * const s,
const struct css_node * const v, unsigned int i);
static void parse_clear(struct css_style * const s, const struct css_node * const v);
static void parse_color(struct css_style * const s, const struct css_node * const v);
+static void parse_cursor(struct css_style * const s, const struct css_node * v);
static void parse_display(struct css_style * const s, const struct css_node * const v);
static void parse_float(struct css_style * const s, const struct css_node * const v);
static void parse_font(struct css_style * const s, const struct css_node * v);
@@ -130,6 +131,7 @@ static const struct property_entry property_table[] = {
{ "border-width", parse_border_width },
{ "clear", parse_clear },
{ "color", parse_color },
+ { "cursor", parse_cursor },
{ "display", parse_display },
{ "float", parse_float },
{ "font", parse_font },
@@ -735,6 +737,24 @@ void parse_color(struct css_style * const s, const struct css_node * const v)
s->color = c;
}
+void parse_cursor(struct css_style * const s, const struct css_node * v)
+{
+ css_cursor z;
+ for (; v; v = v->next) {
+ switch (v->type) {
+ case CSS_NODE_IDENT:
+ z = css_cursor_parse(v->data);
+ if (z != CSS_CURSOR_UNKNOWN) {
+ s->cursor = z;
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
void parse_display(struct css_style * const s, const struct css_node * const v)
{
css_display z;