summaryrefslogtreecommitdiff
path: root/css
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2003-10-17 23:47:13 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2003-10-17 23:47:13 +0000
commitc97107af5cad3c96f75c566880ff139ce378ee62 (patch)
treef1d0c2dd4cca5cc8b008a31468fe4d41be30cf95 /css
parent13d6923b5e6edf727e00484ae05c22dbfa8e1c7c (diff)
downloadnetsurf-c97107af5cad3c96f75c566880ff139ce378ee62.tar.gz
netsurf-c97107af5cad3c96f75c566880ff139ce378ee62.tar.bz2
[project @ 2003-10-17 23:47:13 by jmb]
Add text-decoration support. Overline needs work. a:link defaults to being underlined. svn path=/import/netsurf/; revision=368
Diffstat (limited to 'css')
-rw-r--r--css/css.c7
-rw-r--r--css/css.h1
-rw-r--r--css/css_enums2
-rw-r--r--css/ruleset.c12
4 files changed, 21 insertions, 1 deletions
diff --git a/css/css.c b/css/css.c
index d2f4ef679..ec0084ec8 100644
--- a/css/css.c
+++ b/css/css.c
@@ -47,6 +47,7 @@ const struct css_style css_base_style = {
{ CSS_HEIGHT_AUTO, { 1, CSS_UNIT_EM } },
{ CSS_LINE_HEIGHT_ABSOLUTE, { 1.3 } },
CSS_TEXT_ALIGN_LEFT,
+ CSS_TEXT_DECORATION_NONE,
CSS_VISIBILITY_VISIBLE,
{ CSS_WIDTH_AUTO, { { 1, CSS_UNIT_EM } } },
CSS_WHITE_SPACE_NORMAL
@@ -64,6 +65,7 @@ const struct css_style css_empty_style = {
{ CSS_HEIGHT_INHERIT, { 1, CSS_UNIT_EM } },
{ CSS_LINE_HEIGHT_INHERIT, { 1.3 } },
CSS_TEXT_ALIGN_INHERIT,
+ CSS_TEXT_DECORATION_INHERIT,
CSS_VISIBILITY_INHERIT,
{ CSS_WIDTH_INHERIT, { { 1, CSS_UNIT_EM } } },
CSS_WHITE_SPACE_INHERIT
@@ -81,6 +83,7 @@ const struct css_style css_blank_style = {
{ CSS_HEIGHT_AUTO, { 1, CSS_UNIT_EM } },
{ CSS_LINE_HEIGHT_INHERIT, { 1.3 } },
CSS_TEXT_ALIGN_INHERIT,
+ CSS_TEXT_DECORATION_NONE,
CSS_VISIBILITY_INHERIT,
{ CSS_WIDTH_AUTO, { { 1, CSS_UNIT_EM } } },
CSS_WHITE_SPACE_INHERIT
@@ -709,6 +712,8 @@ void css_cascade(struct css_style * const style, const struct css_style * const
style->line_height = apply->line_height;
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
style->text_align = apply->text_align;
+ if (apply->text_decoration != CSS_TEXT_DECORATION_INHERIT)
+ style->text_decoration = apply->text_decoration;
if (apply->visibility != CSS_VISIBILITY_INHERIT)
style->visibility = apply->visibility;
if (apply->width.width != CSS_WIDTH_INHERIT)
@@ -780,6 +785,8 @@ void css_merge(struct css_style * const style, const struct css_style * const ap
style->line_height = apply->line_height;
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
style->text_align = apply->text_align;
+ if (apply->text_decoration != CSS_TEXT_DECORATION_INHERIT)
+ style->text_decoration = apply->text_decoration;
if (apply->visibility != CSS_VISIBILITY_INHERIT)
style->visibility = apply->visibility;
if (apply->width.width != CSS_WIDTH_INHERIT)
diff --git a/css/css.h b/css/css.h
index c58da6509..9bf843efe 100644
--- a/css/css.h
+++ b/css/css.h
@@ -68,6 +68,7 @@ struct css_style {
} line_height;
css_text_align text_align;
+ css_text_decoration text_decoration;
css_visibility visibility;
diff --git a/css/css_enums b/css/css_enums
index 7882baceb..49fd5870f 100644
--- a/css/css_enums
+++ b/css/css_enums
@@ -15,7 +15,7 @@ css_list_style_position outside inside
css_list_style_type disc circle square decimal lower_alpha lower_roman upper_alpha upper_roman none
css_margin auto length percent
css_text_align inherit left right center justify
-css_text_decoration none blink line_through overline underline
+css_text_decoration none blink line-through overline underline inherit
css_text_transform none capitalize lowercase uppercase
css_vertical_align baseline bottom middle sub super text_bottom text_top top percent
css_visibility inherit visible hidden
diff --git a/css/ruleset.c b/css/ruleset.c
index 0cda4b131..c2e84f1d1 100644
--- a/css/ruleset.c
+++ b/css/ruleset.c
@@ -50,6 +50,7 @@ static void parse_font_weight(struct css_style * const s, const struct css_node
static void parse_height(struct css_style * const s, const struct css_node * const v);
static void parse_line_height(struct css_style * const s, const struct css_node * const v);
static void parse_text_align(struct css_style * const s, const struct css_node * const v);
+static void parse_text_decoration(struct css_style * const s, const struct css_node * const v);
static void parse_visibility(struct css_style * const s, const struct css_node * const v);
static void parse_width(struct css_style * const s, const struct css_node * const v);
static void parse_white_space(struct css_style * const s, const struct css_node * const v);
@@ -70,6 +71,7 @@ static const struct property_entry property_table[] = {
{ "height", parse_height },
{ "line-height", parse_line_height },
{ "text-align", parse_text_align },
+ { "text-decoration", parse_text_decoration },
{ "visibility", parse_visibility },
{ "white-space", parse_white_space },
{ "width", parse_width },
@@ -518,6 +520,16 @@ void parse_text_align(struct css_style * const s, const struct css_node * const
s->text_align = z;
}
+void parse_text_decoration(struct css_style * const s, const struct css_node * const v)
+{
+ css_text_decoration z;
+ if (v->type != CSS_NODE_IDENT || v->next != 0)
+ return;
+ z = css_text_decoration_parse(v->data);
+ if (z != CSS_TEXT_DECORATION_UNKNOWN)
+ s->text_decoration = z;
+}
+
void parse_visibility(struct css_style * const s, const struct css_node * const v)
{
css_visibility z;