From aa24cdff0d5f1030902b9ce549cd71cb5b14b09b Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 28 Oct 2007 17:01:53 +0000 Subject: Bug fixes in parse_length, parse_clip, css_dump_style, css_dump_length by Franz Korntner. svn path=/trunk/netsurf/; revision=3635 --- css/css.c | 9 ++++----- css/ruleset.c | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'css') diff --git a/css/css.c b/css/css.c index e3b696cc0..8527a3b39 100644 --- a/css/css.c +++ b/css/css.c @@ -1655,8 +1655,7 @@ void css_dump_style(const struct css_style * const style) if (style->background_attachment == CSS_BACKGROUND_ATTACHMENT_UNKNOWN) fprintf(stderr, " UNKNOWN"); - else if (style->background_repeat == - CSS_BACKGROUND_ATTACHMENT_NOT_SET) + else if (style->background_attachment == CSS_BACKGROUND_ATTACHMENT_NOT_SET) ; else fprintf(stderr, " %s", @@ -1959,10 +1958,10 @@ void css_dump_style(const struct css_style * const style) css_list_style_type_name[ style->list_style_type]); - if (style->list_style_type == + if (style->list_style_position == CSS_LIST_STYLE_POSITION_UNKNOWN) fprintf(stderr, " UNKNOWN"); - else if (style->list_style_type == + else if (style->list_style_position == CSS_LIST_STYLE_POSITION_NOT_SET) ; else @@ -2435,7 +2434,7 @@ void css_dump_style(const struct css_style * const style) void css_dump_length(const struct css_length * const length) { - if (length->value == 0) + if (fabs(length->value) < 0.0001) fprintf(stderr, "0"); else fprintf(stderr, "%g%s", length->value, diff --git a/css/ruleset.c b/css/ruleset.c index 8b87dbfde..ddf639eaa 100644 --- a/css/ruleset.c +++ b/css/ruleset.c @@ -653,7 +653,7 @@ int parse_length(struct css_length * const length, css_unit u; float value; int num_length; - if (v->type == CSS_NODE_NUMBER && atof(v->data) == 0) { + if (v->type == CSS_NODE_NUMBER && fabs(atof(v->data)) < 0.0001) { length->unit = CSS_UNIT_PX; length->value = 0; return 0; @@ -1688,9 +1688,8 @@ void parse_clip(struct css_style * const s, const struct css_node * v) for (i = 0; i != 4; i++) { switch (t->type) { case CSS_NODE_IDENT: - if (t->data_length == 4 && - strncasecmp(t->data, "auto", 4) == 0) { - rect[i].rect = CSS_CLIP_AUTO; + if (t->data_length == 4 && strncasecmp(t->data, "auto", 4) == 0) { + rect[i].rect = CSS_CLIP_RECT_AUTO; } else return; -- cgit v1.2.3